def in_wordnet(word):
    base = wordnet.morphy(word)
    if base is None:
        base = word
    for d in wordnet.Dictionaries.values():
        if base in d:
            return True
        if word in d:
            return True
    return False
Beispiel #2
0
def runWordnet():
        #if False:
          #for leaf in c.leaves():
            #if(leaf[1]=="VBN" or leaf[1]=="VBD" or leaf[1]=="JJ"):
            #if (re.match("TO|BE.*|DO.*|HV.*|MD|IN|PP", leaf[1])):  
            #  cfdcohort[cohortvalue].inc(leaf)         
            #  cfdleaves[leaf].inc(cohortvalue)
              
                    maxscore = -1
                    try:
                      verb = wordnet.morphy(leaf[0], wordnet.VERB)
                      senses = wordnet.V[verb]
                      for sense in senses:
                        ref_verbs = ["submit","obtain","enter","access","archive","retrieve","present","post","query","import","download","view","find","deposit"]
                        s = set([])
                        for ref in ref_verbs:
                          newscore = wordnet.V[ref][0].path_similarity(sense)
                          s.update(wordnet.V[ref][0].hypernym_paths()[0])
                          maxscore = max(maxscore,newscore)
                        print s,"\n\n"
                    except:
                      maxscore = -2
                    print maxscore
Beispiel #3
0
 def stem(self, word):
     return morphy(word)