Esempio n. 1
0
def init_monk():
    config=default_config()
    ms.initialize(default_config())
    is_initialized = True
    likeTS = ms.yaml2json('travelgene/pymonk-master/examples/turtle_scripts/turtle_like.yml')
    # print likeTS
    likeT = ms.create_turtle(likeTS)
    likeT.save()
Esempio n. 2
0
from monk.math.cmath import sign0
import pymongo
import monk.core.api as ms
from monk.roles.configuration import default_config
from pymongo import MongoClient
import json
client = MongoClient()

def printJson(my_json):
	parsed = json.loads(my_json)
	print json.dumps(parsed,indent=4,sort_keys=True)

if __name__=='__main__':

	config=default_config()
	ms.initialize(default_config())

	stemTS = ms.yaml2json('turtle_scripts/turtle_stem.yml')
	stemT = ms.create_turtle(stemTS)
	# print stemT.generic()
	ents = ms.load_entities()
	# print len(ents)
	# print ents[0].generic()
	fields=['title', 'comment', 'desc']
	print [stemT.predict(ent, fields) for ent in ents]
	stemT.save()
	[ent.save() for ent in ents]
	likeTS = ms.yaml2json('turtle_scripts/turtle_like.yml')
	# print likeTS
	likeT = ms.create_turtle(likeTS)