I am trying to build a bespoke dictionary. I am testing with jwnl. I get the following error:
net.didion.jwnl.JWNLException: Unable to install
net.didion.jwnl.dictionary.FileBackedDictionary
My xml file -
<?xml version="1.0" encoding="UTF-8"?>
<jwnl_properties language="en">
<version publisher="Princeton" number="2.0" language="en"/>
<dictionary class="net.didion.jwnl.dictionary.FileBackedDictionary">
<param name="morphological_processor" value="net.didion.jwnl.dictionary.morph.DefaultMorphologicalProcessor">
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
<param value="net.didion.jwnl.dictionary.morph.TokenizerOperation">
<param name="delimiters">
<param value=" "/>
<param value="-"/>
</param>
<param name="token_operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
</param>
</param>
</param>
</param>
<param name="dictionary_element_factory" value="net.didion.jwnl.princeton.data.PrincetonWN17FileDictionaryElementFactory"/>
<param name="file_manager" value="net.didion.jwnl.dictionary.file_manager.FileManagerImpl">
<param name="file_type" value="net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile"/>
<param name="dictionary_path" value="/"/>
</param>
</dictionary>
<resource class="PrincetonResource"/>
I have the following Java code -
Document doc = Jsoup.parse(page);
try {
JWNL.initialize(new FileInputStream("file_properties.xml"));
String s = doc.text();
String[] words = s.split(" ");
for (String word: words) {
// check is word is in dictionary
IndexWord aWordIndexNoun = Dictionary.getInstance().getIndexWord(POS.NOUN, word);
IndexWord aWordIndexAdj = Dictionary.getInstance().getIndexWord(POS.ADJECTIVE, word);
}
} catch (Exception e) {
System.out.println("system found an error - " + e);
}
I am using Java 1.7, under Ubuntu and using Eclipse for testing. I assume the error is in dictionary_path but I cannot find anything that works. I did not manually download wordnet database - I am unsure where that is located. Does anyone have any ideas to solve this problem?
I worked out the answer is to install mysql but I have not tested that because my system uses mongo db.