Skip to content

An extension of WordNet and VerbNet and analysing WordNet structure through MIT WordNet and VerbNet Java API

License

Notifications You must be signed in to change notification settings

26hzhang/WordNetExtension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordNet and VerbNet Extension in Java

Authour

It's an extension of WordNet API and VerbNet API to analyze the structures of WordNet and VerbNet as well as extract information from both hierarchical structured commonsense knowledge database.

For WordNet, the JWI (the MIT Java Wordnet Interface) tool is used, which is a Java library for interfacing with Wordnet. JWI supports access to Wordnet versions 1.6 through 3.0, among other related Wordnet extensions. Currently, JWI is released at version 2.4.0, all the binaries, manuals, development kit, API reference and etc. are available here. Besides, it's also allowed to be import into project through maven snippet: [link] (latest version 2.2.3).

For VerbNet, the JVerbnet tool is used, which is a Java library for interfacing with the University of Colorado's VerbNet data. It features API calls to retrieve verb classes by their id numbers, associated Wordnet keys or Propbank groupings. Currently, JVerbnet is released at version 1.2.0, samely, all the related resources are available at its project website, here. And its maven snippet is accessible through this link (latest vernsion 1.2.0.1).

Thus, this repository also contains all the methods and functions in the above tools, and, in addition, in order to make the WordNet and VerbNet are easily to be accessed,

WordNet

WordNet (WN) is a lexical database for the English language. It groups English words into sets of synonyms called synsets, provides short definitions and usage examples, and records a number of relations among these synonym sets or their members. WordNet can thus be seen as a combination of dictionary and thesaurus. For more details about WordNet, please see its official webpage: [link].

WordNet Online Demo!

VerbNet

VerbNet (VN) is the largest online verb lexicon currently available for English. It is a hierarchical domain-independent, broad-coverage verb lexicon with mappings to other lexical resources such as WordNet, Xtag, and FrameNet. VerbNet is organized into verb classes extending Levin classes through refinement and addition of subclasses to achieve syntactic and semantic coherence among members of a class. Each verb class in VN is completely described by thematic roles, selectional restrictions on the arguments, and frames consisting of a syntactic description and semantic predicates with a temporal function. For more details about VerbNet, please see its official webpage: [link].

VerbNet Online Demo!

Usage

WordNet (sample usages):

public class GeneralWordNetExample {
    public static void main (String[] args) {
        // get Verb Synset Iterator
        Iterator<ISynset> synsetIterator = WordNet.getSynsetIterator(POS.VERB);
        // validate and parse Sense Key String
        String senseKeyString = "make_clean%2:35:00::";
        // if senseKeyString is valid, convert it to ISenseKey, otherwise null
        ISenseKey key = WordNet.senseKeyPattern(senseKeyString) ? WordNet.parseSenseKeyString(senseKeyString) : null;
        assert key != null;
        IWord iWord = WordNet.getWordBySenseKey(key); // obtain IWord
        System.out.println(iWord.getLemma() + "\t" + iWord.getSynset() + "\t" + iWord.getLexicalID() + "...");
        // validate and parse Word ID
        String wordIdString = "WID-01535377-V-02-make_clean";
        System.out.println("WordID Pattern Result: " + WordNet.wordIdPattern(wordIdString));
        IWordID wordId = WordNet.wordIdPattern(wordIdString) ? WordNet.parseIWordIDString(wordIdString) : null;
        iWord =  WordNet.getWordByWordId(wordId);
        // validate and parse Synset ID
        ISynsetID synsetId = WordNet.parseSynsetIDString("SID-02081903-V");
        System.out.println("SynsetID Pattern Result: " + WordNet.synsetIdPattern("SID-02081903-V"));
        // others
        String lemma = "take";
        List<IWordID> ids = WordNet.getIndexWord(lemma, POS.VERB).getWordIDs();
        int index = 0;
        for (IWordID id : ids) {
            index++;
            iWord = WordNet.getWordByWordId(id);
            System.out.println(iWord.getLemma() + "\t" + WordNet.getTagCount4IWord(iWord) + "\t" + WordNet.getSenseNumber4IWord(iWord));
        }
        System.out.println(index);
        System.out.println(WordNet.getNumberOfSense4Word(lemma, POS.VERB));
        // ......
    }
}

VerbNet:

public class GeneralVerbNetExample {
    public static void main (String[] args) {
        System.out.println("All Classes: " + VerbNet.countAllVerbClasses());
        System.out.println("Root Classes: " + VerbNet.countRootVerbClasses());
        System.out.println("Sub Classes: " + VerbNet.countSubVerbClasses());
        Iterator<IVerbClass> iterator = VerbNet.rootVerbClassIterator(); // get IVerbClass iterator
        List<IVerbClass> rootVerbs = VerbNet.getRootVerbClasses();
        IVerbClass iVerbClass = VerbNet.getRootVerb("hit-18.1");
        List<IMember> members = iVerbClass.getMembers();
        List<String> wordNetKeys = VerbNet.iMemberToWordNetKeys(members.get(0)); 
        // ...
    }
}

About

An extension of WordNet and VerbNet and analysing WordNet structure through MIT WordNet and VerbNet Java API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published