-
Notifications
You must be signed in to change notification settings - Fork 40
Misc Scripts
Patrick Hammer edited this page May 30, 2020
·
12 revisions
Python interface The interface file is available in /misc/Python/NAR.py From there:
>>> import NAR as nar
>>> print(nar.AddInput("<a --> b>."))
{'input': [{'occurrenceTime': 'eternal', 'punctuation': '.', 'term': '<a --> b>', 'truth': {'frequency': '1.000000,', 'confidence': '0.900000'}}], 'derivations': [], 'answers': [], 'executions': []}
>>> print(nar.AddInput("<?1 --> b>?"))
{'input': [{'occurrenceTime': 'eternal', 'punctuation': '?', 'term': '<?1 --> b>'}], 'derivations': [], 'answers': [{'occurrenceTime': 'eternal', 'punctuation': '0', 'term': '<a --> b>', 'truth': {'frequency': '1.000000,', 'confidence': '0.900000'}}], 'executions': []}
>>> print(nar.AddInput("*stats"))
{'countConceptsMatchedTotal': 1.0, 'countConceptsMatchedMax': 1.0, 'countConceptsMatchedAverage': 0.0, 'currentTime': 2.0, 'total_concepts': 1.0, 'Maximum_chain_length_in_concept_hashtable': 1.0, 'Maximum_chain_length_in_atoms_hashtable': 1.0}
>>> nar.Exit()
Example of processing toothbrush.nal with UDPNAR (Continuous run of ONA):
Run with --verbose to see the steps of the demo
Run with --iterations to get an average of real-time required for handling toothbrush.nal
python3 toothbrush_demo.py --verbose
python3 toothbrush_demo.py --iterations 20
IRC interface
Run via irc_nar.py, needs Python 2.