29 lines
645 B
Python
29 lines
645 B
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import warnings
|
|
|
|
from speech import Speech
|
|
from syntax import Syntax
|
|
|
|
if not sys.warnoptions:
|
|
warnings.simplefilter("ignore")
|
|
|
|
|
|
def _main():
|
|
if len(sys.argv) < 2:
|
|
print(f'Usage: {sys.argv[0]} FILE')
|
|
exit(1)
|
|
wav_file = sys.argv[1]
|
|
speech_server = 'http://vosk.athene.tech'
|
|
text = Speech().run(wav_file, speech_server)
|
|
print(f'Text: {text}')
|
|
syntax_server = 'http://syntaxnet.athene.tech'
|
|
parse_tree = Syntax().run(text, syntax_server)
|
|
print(f'Parse tree:\n{parse_tree}')
|
|
print(f'Nouns:\n{parse_tree.get_nouns()}')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
_main()
|