Basic conceptnet2.1 query

#!/usr/local/bin/python

import sys, os
reload(sys)

os.environ['CONCEPTNET'] = 'libs/conceptnet2.1'
sys.path.append('libs/')
sys.setdefaultencoding("latin1")

import ConceptNetDB
processor = ConceptNetDB.ConceptNetDB(None,'ConceptNet.ini')

phrase = sys.argv[1]
print  phrase

text = processor.nltools.guess_mood(phrase)
print text
 

$ python _test-mood.py
PC_524727138 <- for/IN good/JJ man/NN PC_902158629 <- of/IN party/NN PC_725835205 <- for/IN all/DT good/JJ men/NNS PC_502591577 <- of/IN the/DT party/NN [('disgusted', 0.4862797314730406), ('angry', 0.44568548377190498), ('sad', 0.25683556430435933), ('fearful', 0.2219426823049894), ('happy', 0.11441016214900629), ('surprised', 0.0)]