29 lines
794 B
Python
29 lines
794 B
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
from typing import List
|
|
|
|
from src.myontology import MyOntology
|
|
from src.nlp import NLP
|
|
from src.parse_tree.parse_tree import ParseTree
|
|
from src.speech import Speech
|
|
from src.syntax import Syntax
|
|
|
|
|
|
def _main(wav_file: str):
|
|
text: str = Speech().run_recognition(wav_file)
|
|
print(f'Text: {text}')
|
|
parse_tree: ParseTree = Syntax().get_parse_tree(text)
|
|
print(f'Parse tree:\n{parse_tree}')
|
|
terms: List[str] = NLP().get_by_template(parse_tree, ['NOUN', 'VERB', 'ADJ'])
|
|
print(f'Extracted terms:\n{" ".join(terms)}')
|
|
result: str = MyOntology().get_event_description(terms)
|
|
print(f'Test:\n{result}')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) < 2:
|
|
print(f'Usage: {sys.argv[0]} FILE')
|
|
exit(1)
|
|
_main(sys.argv[1])
|