如何使用语言工具创建用于拼写检查的字典?我不是Java程序员,这是我第一次看到LT。
我有这个文件
affaire,chose,question
chose,emploi,fonction,service,travail,tâche
cause,chose,matière
chose,point,question,tête
chose,objet,élément
chose,machin,truc
Run Code Online (Sandbox Code Playgroud)
我想有一个像这样的关联数组:
affaire => chose, question
cause => chose, matière
chose => emploi, fonction, service, travail, tache, point, question, tete, objet élément, machin, truc
Run Code Online (Sandbox Code Playgroud)
甚至更好,每当我找到一个新单词时,将单词保存为键,将上下文(左或右和右)保存为值...例如:
affaire => chose, question
cause => chose, matière
chose => affaire, question, cause, matière, emploi, fonction, service, travail, tache, point, question, tete, objet élément, machin, truc
Run Code Online (Sandbox Code Playgroud)
目前我正在尝试以这种方式创建关联数组:
$in = "test.txt";
$out = "res_test.txt";
open(IN, "<", $in);
open(OUT, ">", $out);
%list = '';
while(defined($l = <IN>)){
if ($l =~ /((\w+),(.*))/){ …Run Code Online (Sandbox Code Playgroud) 我试图从用户的输入创建一个数组,然后我会分析它并判断它是否是一个对称数组。
但是我的 while 循环中已经有问题了,我不明白问题出在哪里。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
int array[] = {};
int i = 0;
int user = 0;
int k = 0;
int size_array = 0;
int j = 0;
printf("Write some numbers, -1 to end \n");
while(user != -1){
printf("k = %d\n", k);
scanf("%d", &user);
array[i] = user;
i = i+1;
k = k+1;
}
size_array = k;
printf("nb of entries = %d\n", size_array);
for (j = 0; j < size_array; j++){
printf("%d",array[j]); …Run Code Online (Sandbox Code Playgroud) arrays ×1
c ×1
dictionary ×1
hashmap ×1
java ×1
languagetool ×1
nlp ×1
perl ×1
regex ×1
while-loop ×1