问题
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("*********************************************");
}
}
I get the error as Error opening index file:C:\ProgramFiles\WordNet\2.1\dict\index.sense . Does this JAWS work for windows? wats wrong with index.sense file
回答1:
I also faced the same problem in windows.
I changed the path of the dict to "C:\Program Files (x86)\WordNet\dict\", and did the same in System.setProperty as follows:
System.setProperty("wordnet.database.dir", "C:\Program Files (x86)\WordNet\dict\");
And it worked.
来源:https://stackoverflow.com/questions/28735706/find-synonyms-using-jaws-in-netbeans