import edu.smu.tspell.wordnet.NounSynset;
import edu.smu.tspell.wordnet.Synset;
import edu.smu.tspell.wordnet.SynsetType;
import edu.smu.tspell.wordnet.WordNetDatabase;
import javax.swing.JApplet;
import javax.swing.JFrame;
public class JavaApplication4
{
String a[]=new String[2];
public static void main(String a[])
{
String ar[]={"faith"};
int j=0;
while(j<2)
{
System.setProperty("wordnet.database.dir", "C:\\ProgramFiles(x86)\\WordNet\\2.1\\dict");
NounSynset nounSynset;
NounSynset[] hyponyms;
WordNetDatabase database = WordNetDatabase.getFileInstance();
Synset[] synsets = database.getSynsets(ar[j], SynsetType.NOUN);
System.out.println("*********************************************");
for (int i = 0; i < synsets.length; i++)
{
nounSynset = (NounSynset)(synsets[i]);
hyponyms = nounSynset.getHyponyms();
System.err.println(nounSynset.getWordForms()[0] +": " + nounSynset.getDefinition() + ") has " + hyponyms.length + " hyponyms")
}
j++;
}
System.out.println("*********************************************");
}
}
我收到错误,因为错误打开索引文件:C:\ ProgramFiles \ WordNet \ 2.1 \ dict \ index.sense。这个JAWS适用于Windows吗?使用index.sense文件的错误
答案 0 :(得分:2)
我在Windows中也遇到了同样的问题。
我将dict的路径更改为“C:\ Program Files(x86)\ WordNet \ dict \”,并在System.setProperty中执行相同操作,如下所示:
System.setProperty(“wordnet.database.dir”,“C:\ Program Files(x86)\ WordNet \ dict \”);
它有效。