helper/main.py

27 lines
531 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}')
parse_tree = Syntax().run(text)
print(f'Parse tree: {parse_tree}')
if __name__ == '__main__':
_main()