[Corpora-List] java API to wordnet

Tom Morton tsmorton at gmail.com
Sat Apr 9 13:35:14 UTC 2005


Dan Bikel has a nice WordNet java package as well. I believe the licencing 
is research only for that.
http://www.cis.upenn.edu/~dbikel/software.html#wn

I'm using JWNL package within the opennlp.tools package
(opennlp.sf.net<http://opennlp.sf.net>).
It was a bit of a pain to figure out how to make the JWNL dictionary object 
without giving it a file reference to the xml file that JWNL uses to 
configure itself. The code below does this, and is configured for WordNet 
1.7 and higher. It also seems to works fine with 1.6 for features which were 
also found in that version as well. Enjoy...Tom

String searchDirectory = "/home/tsmorton/wordnet-1.6/dict"; //dict directory 
where wordnet is installed

PointerType.initialize();
Adjective.initialize();
VerbFrame.initialize();
Map suffixMap = new HashMap();
suffixMap.put(POS.NOUN,new String[][] 
{{"s",""},{"ses","s"},{"xes","x"},{"zes","z"},{"ches","ch"},{"shes","sh"},{"men","man"},{"ies","y"}});
suffixMap.put(POS.VERB,new String[][] 
{{"s",""},{"ies","y"},{"es","e"},{"es",""},{"ed","e"},{"ed",""},{"ing","e"},{"ing",""}});
suffixMap.put(POS.ADJECTIVE,new String[][] 
{{"er",""},{"est",""},{"er","e"},{"est","e"}});
DetachSuffixesOperation tokDso = new DetachSuffixesOperation(suffixMap);
tokDso.addDelegate(DetachSuffixesOperation.OPERATIONS,new Operation[] {new 
LookupIndexWordOperation(),new LookupExceptionsOperation()});
TokenizerOperation tokOp = new TokenizerOperation(new String[] {" ","-"});
tokOp.addDelegate(TokenizerOperation.TOKEN_OPERATIONS,new Operation[] {new 
LookupIndexWordOperation(),new LookupExceptionsOperation(),tokDso});
DetachSuffixesOperation morphDso = new DetachSuffixesOperation(suffixMap);
morphDso.addDelegate(DetachSuffixesOperation.OPERATIONS,new Operation[] {new 
LookupIndexWordOperation(),new LookupExceptionsOperation()});
Operation[] operations = {new LookupExceptionsOperation(), morphDso , 
tokOp};
morphy = new DefaultMorphologicalProcessor(operations);
FileManager manager = new FileManagerImpl(searchDirectory,
PrincetonRandomAccessDictionaryFile.class);
FileDictionaryElementFactory factory = new 
PrincetonWN17FileDictionaryElementFactory();
FileBackedDictionary.install(manager, morphy,factory,true);
dict = net.didion.jwnl.dictionary.Dictionary.getInstance();
morphy = dict.getMorphologicalProcessor();
}


On Apr 8, 2005 11:40 AM, Piao, Songlin <s.piao at lancaster.ac.uk> wrote:
> 
> I am using JWNL (wordnet Java API), and found it is very convenient to 
> link/embed it into other tools (if you are using java). It is a bit slower, 
> but if the speed is not so vital for your work, particularly if you do not 
> check every word in large texts, it serves the purpose very well.
> 
> For version JWNL 1.3, see http://sourceforge.net/projects/jwordnet/
> 
> Dr. Scott Songlin Piao
> ----------------------
> UCREL
> Computing Department
> Lancaster Univesity
> Lancaster LA1 4WA
> UK
> 
> Tel: +44 1524 510345
> 
> 
> -----Original Message-----
> From: owner-corpora at lists.uib.no [mailto:owner-corpora at lists.uib.no]On
> Behalf Of Grazia Russo-Lassner
> Sent: 08 April 2005 15:52
> To: corpora at uib.no
> Subject: [Corpora-List] java API to wordnet
> 
> Hello,
> 
> does any of you have any experience with a java API to WordNet ?
> 
> Could you please send me a pointer to it and maybe a brief description of
> some of its characteristics (which database, speed, flexibility of API,
> etc.) or any information about it that you think might be useful ?
> 
> Thank you very much in advance,
> 
> Grazia
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/corpora/attachments/20050409/10dc7e33/attachment.htm>


More information about the Corpora mailing list