-
Notifications
You must be signed in to change notification settings - Fork 40
Misc Scripts
Patrick Hammer edited this page Apr 11, 2021
·
12 revisions
Concept filter Allows to filter for the highest k useful concepts:
./NAR shell | python3 concept_usefulness_filter.py 10
Graph export Together with the previous it allows to visualize and output the most useful concepts:
./NAR shell InspectionOnExit < nalfile.nal | python3 concept_usefulness_filter.py 10 | python3 concepts_to_graph.py
Derivation priority filter Allows to show only derivations above a certain priority threshold:
./NAR shell | python3 DerivationPriorityFilter.py 0.8
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.