2022-01-13 20:23:35 +04:00
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
2022-01-25 16:08:20 +04:00
|
|
|
|
from src.myontology import MyOntology
|
2022-01-24 17:04:54 +04:00
|
|
|
|
from src.nlp import NLP
|
2022-01-25 16:08:20 +04:00
|
|
|
|
from src.parse_tree.parse_tree import ParseTree
|
2022-02-03 18:16:08 +04:00
|
|
|
|
from src.syntax import Syntax
|
2022-01-13 20:23:35 +04:00
|
|
|
|
|
|
|
|
|
|
2022-01-27 23:15:40 +04:00
|
|
|
|
def _main(wav_file: str):
|
2023-05-31 00:05:42 +04:00
|
|
|
|
# text: str = Speech().run_recognition(wav_file)
|
2023-06-02 17:41:05 +04:00
|
|
|
|
text: str = 'Как получить деньги с заблокированной карты?'
|
2022-01-14 16:58:50 +04:00
|
|
|
|
print(f'Text: {text}')
|
2022-01-27 23:15:40 +04:00
|
|
|
|
parse_tree: ParseTree = Syntax().get_parse_tree(text)
|
2022-01-14 17:43:40 +04:00
|
|
|
|
print(f'Parse tree:\n{parse_tree}')
|
2023-05-31 00:05:42 +04:00
|
|
|
|
terms = NLP().get_terms(parse_tree)
|
2023-05-16 17:23:30 +04:00
|
|
|
|
print(f'Extracted terms:\n{", ".join(terms)}')
|
2022-06-23 22:21:17 +04:00
|
|
|
|
result: str = MyOntology().get_event_description(terms)
|
2023-05-31 00:05:42 +04:00
|
|
|
|
print(f'Result:\n{result}')
|
2022-01-13 20:23:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2022-01-27 23:15:40 +04:00
|
|
|
|
if len(sys.argv) < 2:
|
|
|
|
|
print(f'Usage: {sys.argv[0]} FILE')
|
|
|
|
|
exit(1)
|
|
|
|
|
_main(sys.argv[1])
|