#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = "NLUlite" __version__ = "0.1.4" __license__ = "BSD" from NLUlite import ServerProxy, Wisdom server = ServerProxy("localhost", 4001) wisdom = Wisdom(server) wisdom.import_from_server("name_ID") answer = wisdom.ask("Who goes to Germany") print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy() wisdom = Wisdom(server) wisdom.add_feed('http://en.wikinews.org/w/index.php?title=Special:NewPages&feed=rss') wisdom.save('fetched.wisdom') print 'The feed was saved in "fetched.wisdom".'
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy() wisdom = Wisdom(server) wisdom.add_feed('http://en.wikinews.org/w/index.php?title=Special:NewPages&feed=rss') answer = wisdom.ask('what happens where') print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy() wisdom = Wisdom(server) wisdom.add_url('http://simple.wikipedia.org/wiki/Snakes') wisdom.save('fetched.wisdom') print 'The article was saved in "fetched.wisdom".'
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = "NLUlite" __version__ = "0.1.4" __license__ = "BSD" from NLUlite import ServerProxy, Wisdom server = ServerProxy() wisdom = Wisdom(server) wisdom.load("fetched.wisdom") answer = wisdom.ask("what happens where") print answer.comment() for item in answer.elements(): print item.comment()
from NLUlite import ServerProxy, Wisdom, join_answers server = ServerProxy() wisdom = Wisdom(server) wisdom.add('David might go to a pub. Tim already went there.') answer=wisdom.ask('who will go to a pub') print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy('localhost', 4001) w = Wisdom(server) w.add('The chancellor is going to Berlin.') answer = w.ask('Who goes to Germany?') print answer.comment() for item in answer.elements(): print item.text print item.description for pair in item.pairs: print pair.query + ':' + pair.reply
""" NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom, Writer server = ServerProxy('localhost', 4001) wisdom = Wisdom(server) wisdom.add('The chancellor had planned to go to Berlin January 10, 2102.') answer = wisdom.ask('is someone going to Germany?') ## answer = wisdom1.ask('who goes to Berlin?') # Print a comment to all the answers writer= Writer(wisdom) print writer.write(answer) for item in answer.elements(): print writer.write(item)
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.0.3' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom, Writer server = ServerProxy('localhost', 4001) wisdom = Wisdom(server) wisdom.add('David is happy. If a person is happy, he smiles.') answer = wisdom.ask('Who smiles?') print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = "NLUlite" __version__ = "0.1.4" __license__ = "BSD" from NLUlite import ServerProxy, Wisdom server = ServerProxy("localhost", 4001) wisdom = Wisdom(server) wisdom.add("The chancellor is going to Berlin.") wisdom.save_rdf("test.rdf")
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy() wisdom = Wisdom(server) wisdom.add_url('http://simple.wikipedia.org/wiki/Snakes') answer = wisdom.ask('what do the snakes need') print answer.comment() for item in answer.elements(): print item.comment()
NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom, join_answers server = ServerProxy() wisdom1 = Wisdom(server) wisdom2 = Wisdom(server) wisdom1.add('David goes to the cinema to see a movie') wisdom2.add('Anna travels to Germany for business') question = 'who goes where' # Ask the question answers1 = wisdom1.ask(question) answers2 = wisdom2.ask(question) answers = join_answers([answers1, answers2]) print answers.comment() for item in answers.elements() : print item.comment()
from NLUlite import ServerProxy, Wisdom server = ServerProxy('localhost', 4001) wisdom = Wisdom(server) wisdom.load('~/NLUlite/wisdoms/common.wisdom') wisdom.add('David sells a car to Maria') answer = wisdom.ask('Who buys what from whom?') print answer.comment() for item in answer.elements(): print item.comment()
from NLUlite import ServerProxy, Wisdom, WisdomParameters server = ServerProxy() wisdom = Wisdom(server) wp= WisdomParameters() wp.set_do_solver('true') # Rules are always applied wisdom.set_wisdom_parameters(wp) wisdom.add('Socrates is a man. If someone is a man he is mortal.') answers = wisdom.ask("is socrates a mortal") answer_comment = answers.comment() item_comment = "" for item in answers.elements(): item_comment += item.comment() print answers.comment() for item in answers.elements() : print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy() wisdom = Wisdom(server) wisdom.load('fetched.wisdom') answer = wisdom.ask('what do the snakes need') print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy('localhost', 4001) wisdom = Wisdom(server) wisdom.add('[% this is the description %] The chancellor is going to Berlin. If someone is happy and is satisfied he smiles.') wisdom.save('test.wisdom')
NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy('localhost', 4001) wisdom = Wisdom(server) wisdom.add('The chancellor is going to Berlin') answer = wisdom.ask('Who goes to Germany') print answer.comment() for item in answer.elements(): print item.comment() wisdom.clear() answer = wisdom.ask('Who goes to Germany') print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = "NLUlite" __version__ = "0.1.4" __license__ = "BSD" from NLUlite import ServerProxy, Wisdom server = ServerProxy("localhost", 4001) w = Wisdom(server) w.add("[% Taken from wikipedia %] The chancellor goes to Berlin.") answer = w.ask("Who goes to Germany?") print answer.comment() for item in answer.elements(): print item.comment() print "[%" + item.description + "%]"
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy('localhost', 4001) wisdom = Wisdom(server) wisdom.add('The chancellor is going to Berlin') answer = wisdom.ask('person#1 that goes to a place#2') print answer.comment() for item in answer.elements('person#1'): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy() wisdom = Wisdom(server) wisdom.add('The chancellor is going to Berlin on October 2010') answer = wisdom.ask('Who goes to Germany after 2009') print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = "NLUlite" __version__ = "0.1.4" __license__ = "BSD" from NLUlite import ServerProxy, Wisdom, Writer server = ServerProxy("localhost", 4001) wisdom = Wisdom(server) wisdom.add("David is happy. If a person is happy, he smiles.") answer = wisdom.ask("Who smiles?") print answer.comment() for item in answer.elements(): for pair in item.pairs: print pair.query + ": " + pair.reply for rule in item.rules: print rule.text
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = "NLUlite" __version__ = "0.1.4" __license__ = "BSD" from NLUlite import ServerProxy, Wisdom server = ServerProxy("localhost", 4001) wisdom = Wisdom(server) wisdom.add("The chancellor is going to Berlin.") wisdom.export_to_server("name_ID")
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom server = ServerProxy('localhost', 4001) wisdom = Wisdom(server) wisdom.load('test.wisdom') answer = wisdom.ask('Who goes to germany') print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = 'NLUlite' __version__ = '0.1.4' __license__ = 'BSD' from NLUlite import ServerProxy, Wisdom, Writer server = ServerProxy('localhost', 4001) wisdom = Wisdom(server) wisdom.add('The chancellor is going to Berlin') answer = wisdom.match('someone moves to Germany') print answer.comment() for item in answer.elements(): print item.comment()
#!/usr/bin/env python """ NLUlite is a high-level Natural Language Understanding framework. This file is an example of the framework. This file is released with BSD license. """ __author__ = "NLUlite" __version__ = "0.1.4" __license__ = "BSD" from NLUlite import ServerProxy, Wisdom server = ServerProxy("localhost", 4001) wisdom = Wisdom(server) wisdom.add("The chancellor is going to Berlin") answer = wisdom.ask("person that goes to Germany") print answer.comment() for item in answer.elements(): print item.comment()