Exemple #1
0
	def __init__(self, emoticon_file=path+'/data/emoticons.csv', \
			affect_wordnet_file=path+'/data/affectiveWNmatrix.pickle'):
		# Build emoticon dictionary
		self.emoticon = {}
		emoticon_reader = csv.reader(open(emoticon_file, 'r'))
		for emoticon, meaning in emoticon_reader:
			self.emoticon[emoticon.decode('utf-8')] = meaning
		self.emoticon_list = self.emoticon.keys()
		# Create blending of affect WordNet and ConceptNet
		cnet = conceptnet_2d_from_db('en')
		affectwn_raw = get_picklecached_thing(affect_wordnet_file)
		affectwn_normalized = affectwn_raw.normalized()
		theblend = Blend([affectwn_normalized, cnet])
		self.affectwn = theblend.svd()
		# Get natural language processing tool
		self.nl = get_nl('en')
from csc.conceptnet4.analogyspace import conceptnet_by_relations, identities_for_all_relations
from csc.divisi.blend import Blend
from csc.divisi import export_svdview

byrel = conceptnet_by_relations('en')
t=identities_for_all_relations(byrel)
b=Blend(byrel.values()+[t])
s=b.svd()
export_svdview.write_packed(s.u, 'littleblend', lambda x:x)
s.summarize()
Exemple #3
0
from csc.conceptnet4.analogyspace import conceptnet_by_relations, identities_for_all_relations
from csc.divisi.blend import Blend
from csc.divisi import export_svdview

byrel = conceptnet_by_relations('en')
t = identities_for_all_relations(byrel)
b = Blend(byrel.values() + [t])
s = b.svd()
export_svdview.write_packed(s.u, 'littleblend', lambda x: x)
s.summarize()