#!/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 syntax import Syntax def _main(): if len(sys.argv) < 2: print(f'Usage: {sys.argv[0]} FILE') exit(1) wav_file: str = sys.argv[1] speech_server: str = 'http://vosk.athene.tech' text: str = Speech().run_recognition(wav_file, speech_server) print(f'Text: {text}') syntax_server: str = 'http://syntaxnet.athene.tech' parse_tree: ParseTree = Syntax().get_parse_tree(text, syntax_server) print(f'Parse tree:\n{parse_tree}') nouns: List[str] = NLP().get_nouns(parse_tree) print(f'Nouns:\n{" ".join([noun for noun in nouns])}') result: str = MyOntology().get_event_description(nouns) print(f'Test: {result}') if __name__ == '__main__': _main()