Пример #1
0
def demonstrate_source_lookup(source_uri):
    print 'Demonstrating LookUp source API'
    lookup = LookUp()
    data = lookup.search_source(source_uri)
    r = Result(data)
    r.print_raw_result()
    print
Пример #2
0
def demonstrate_source_lookup(source_uri):
    print 'Demonstrating LookUp source API'
    lookup = LookUp()
    data = lookup.search_source(source_uri)
    r = Result(data)
    r.print_raw_result()
    print
Пример #3
0
def demonstrate_lookup(concept):
    print 'Demonstrating LookUp concept API'
    lookup = LookUp(offset=1, limit=1)
    data = lookup.search_concept(concept)
    r = Result(data)
    edges = r.parse_all_edges()
    for edge in edges:
        edge.print_edge()
        edge.print_all_attrs()
    print

    print 'Demonstrating LookUp concept API cleaning self referencing edges'
    lookup = LookUp(offset=1, limit=1)
    data = lookup.search_concept(concept)
    r = Result(data)
    r.print_raw_result()
    print
Пример #4
0
def demonstrate_lookup(concept):
    print 'Demonstrating LookUp concept API'
    lookup = LookUp(offset=1, limit=1)
    data = lookup.search_concept(concept)
    r = Result(data)
    edges = r.parse_all_edges()
    for edge in edges:
        edge.print_edge()
        edge.print_all_attrs()
    print

    print 'Demonstrating LookUp concept API cleaning self referencing edges'
    lookup = LookUp(offset=1, limit=1)
    data = lookup.search_concept(concept)
    r = Result(data)
    r.print_raw_result()
    print
Пример #5
0
from conceptnet5_client.web.api import LookUp, Association
from conceptnet5_client.utils.result import Result


lookup = LookUp(limit = 1)
response = lookup.search_concept('chick-fil-a')
r = Result(response)
r.print_raw_result()
##edges = r.parse_all_edges(clean_self_ref = True) 
##[edge.print_edge() for edge in edges]

##a = Association()
##data = a.get_similar_concepts_by_term_list(['organization', 'company'])
##r = Result(data)
##r.print_raw_result()