def do_lookup(self, line): args = line.split(' ') if not len(args) == 3: print "must have 3 arguments" return for i, arg in enumerate(args): if arg == "null": args[i] = None if i == 2: if arg == "True": args[i] = True else: args[i] = False print it.get_relations(cnet.lookup(args[0], limit=args[1], absolute=args[2]))
def query_word(self, word): json_document = json.dumps(cnet.lookup(word, limit=5), indent=4, separators=(',', ': ')) decoder = json.JSONDecoder() json_obj = decoder.decode(json_document) return json_obj