From 4d594b4cc569740e2539ece98e7b38b57588a0cc Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Fri, 28 Oct 2022 10:34:28 -0700 Subject: [PATCH] Remove build files (#8) * Remove build files * Add GitHub default .gitignore Python template Co-authored-by: Daniel McKnight --- .gitignore | 129 +++++++++++ build/lib/ovos_stt_plugin_vosk/__init__.py | 214 ------------------ build/lib/ovos_stt_plugin_vosk/version.py | 7 - ...vos_stt_plugin_vosk-0.1.3-py3-none-any.whl | Bin 4360 -> 0 bytes ovos_stt_plugin_vosk.egg-info/PKG-INFO | 25 -- ovos_stt_plugin_vosk.egg-info/SOURCES.txt | 10 - .../dependency_links.txt | 1 - .../entry_points.txt | 4 - ovos_stt_plugin_vosk.egg-info/requires.txt | 4 - ovos_stt_plugin_vosk.egg-info/top_level.txt | 1 - ovos_stt_plugin_vosk.egg-info/zip-safe | 1 - 11 files changed, 129 insertions(+), 267 deletions(-) create mode 100644 .gitignore delete mode 100644 build/lib/ovos_stt_plugin_vosk/__init__.py delete mode 100644 build/lib/ovos_stt_plugin_vosk/version.py delete mode 100644 dist/ovos_stt_plugin_vosk-0.1.3-py3-none-any.whl delete mode 100644 ovos_stt_plugin_vosk.egg-info/PKG-INFO delete mode 100644 ovos_stt_plugin_vosk.egg-info/SOURCES.txt delete mode 100644 ovos_stt_plugin_vosk.egg-info/dependency_links.txt delete mode 100644 ovos_stt_plugin_vosk.egg-info/entry_points.txt delete mode 100644 ovos_stt_plugin_vosk.egg-info/requires.txt delete mode 100644 ovos_stt_plugin_vosk.egg-info/top_level.txt delete mode 100644 ovos_stt_plugin_vosk.egg-info/zip-safe diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6e4761 --- /dev/null +++ b/.gitignore @@ -0,0 +1,129 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ diff --git a/build/lib/ovos_stt_plugin_vosk/__init__.py b/build/lib/ovos_stt_plugin_vosk/__init__.py deleted file mode 100644 index 43053aa..0000000 --- a/build/lib/ovos_stt_plugin_vosk/__init__.py +++ /dev/null @@ -1,214 +0,0 @@ -import json -from os.path import join, exists -from queue import Queue - -from ovos_plugin_manager.templates.stt import STT, StreamThread, StreamingSTT -from ovos_skill_installer import download_extract_zip, download_extract_tar -from ovos_utils.log import LOG -from ovos_utils.xdg_utils import xdg_data_home -from vosk import Model as KaldiModel, KaldiRecognizer -from speech_recognition import AudioData - - -class ModelContainer: - def __init__(self): - self.engines = {} - self.models = {} - - def get_engine(self, lang): - lang = lang.split("-")[0].lower() - self.load_language(lang) - return self.engines[lang] - - def get_partial_transcription(self, lang): - engine = self.get_engine(lang) - res = engine.PartialResult() - return json.loads(res)["partial"] - - def get_final_transcription(self, lang): - engine = self.get_engine(lang) - res = engine.FinalResult() - return json.loads(res)["text"] - - def process_audio(self, audio, lang): - engine = self.get_engine(lang) - if isinstance(audio, AudioData): - audio = audio.get_wav_data() - return engine.AcceptWaveform(audio) - - def enable_limited_vocabulary(self, words, lang): - """ - enable limited vocabulary mode - will only consider pre defined .voc files - """ - model_path = self.models[lang] - self.engines[lang] = KaldiRecognizer( - KaldiModel(model_path), 16000, json.dumps(words)) - - def enable_full_vocabulary(self, lang=None): - """ enable default transcription mode """ - model_path = self.models[lang] - self.engines[lang] = KaldiRecognizer( - KaldiModel(model_path), 16000) - - def load_model(self, model_path, lang): - lang = lang.split("-")[0].lower() - self.models[lang] = model_path - if model_path: - self.engines[lang] = KaldiRecognizer(KaldiModel(model_path), 16000) - else: - raise FileNotFoundError - - def load_language(self, lang): - lang = lang.split("-")[0].lower() - if lang in self.engines: - return - model_path = self.download_language(lang) - self.load_model(model_path, lang) - - def unload_language(self, lang): - if lang in self.engines: - del self.engines[lang] - self.engines.pop(lang) - - @staticmethod - def download_language(lang): - lang = lang.split("-")[0].lower() - model_path = ModelContainer.lang2modelurl(lang) - if model_path and model_path.startswith("http"): - model_path = ModelContainer.download_model(model_path) - return model_path - - @staticmethod - def download_model(url): - folder = join(xdg_data_home(), 'vosk') - name = url.split("/")[-1].split(".")[0] - model_path = join(folder, name) - if not exists(model_path): - LOG.info(f"Downloading model for vosk {url}") - LOG.info("this might take a while") - if url.endswith(".zip"): - download_extract_zip(url, folder=folder, skill_folder_name=name) - else: - download_extract_tar(url, folder=folder, skill_folder_name=name) - LOG.info(f"Model downloaded to {model_path}") - - return model_path - - @staticmethod - def lang2modelurl(lang, small=True): - lang2url = { - "en": "http://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip", - "en-in": "http://alphacephei.com/vosk/models/vosk-model-small-en-in-0.4.zip", - "cn": "https://alphacephei.com/vosk/models/vosk-model-small-cn-0.3.zip", - "ru": "https://alphacephei.com/vosk/models/vosk-model-small-ru-0.15.zip", - "fr": "https://alphacephei.com/vosk/models/vosk-model-small-fr-pguyot-0.3.zip", - "de": "https://alphacephei.com/vosk/models/vosk-model-small-de-0.15.zip", - "es": "https://alphacephei.com/vosk/models/vosk-model-small-es-0.3.zip", - "pt": "https://alphacephei.com/vosk/models/vosk-model-small-pt-0.3.zip", - "gr": "https://alphacephei.com/vosk/models/vosk-model-el-gr-0.7.zip", - "tr": "https://alphacephei.com/vosk/models/vosk-model-small-tr-0.3.zip", - "vn": "https://alphacephei.com/vosk/models/vosk-model-small-vn-0.3.zip", - "it": "https://alphacephei.com/vosk/models/vosk-model-small-it-0.4.zip", - "nl": "https://alphacephei.com/vosk/models/vosk-model-nl-spraakherkenning-0.6-lgraph.zip", - "ca": "https://alphacephei.com/vosk/models/vosk-model-small-ca-0.4.zip", - "ar": "https://alphacephei.com/vosk/models/vosk-model-ar-mgb2-0.4.zip", - "fa": "https://alphacephei.com/vosk/models/vosk-model-small-fa-0.5.zip", - "tl": "https://alphacephei.com/vosk/models/vosk-model-tl-ph-generic-0.6.zip" - } - biglang2url = { - "en": "https://alphacephei.com/vosk/models/vosk-model-en-us-aspire-0.2.zip", - "en-in": "http://alphacephei.com/vosk/models/vosk-model-en-in-0.4.zip", - "cn": "https://alphacephei.com/vosk/models/vosk-model-cn-0.1.zip", - "ru": "https://alphacephei.com/vosk/models/vosk-model-ru-0.10.zip", - "fr": "https://github.com/pguyot/zamia-speech/releases/download/20190930/kaldi-generic-fr-tdnn_f-r20191016.tar.xz", - "de": "https://alphacephei.com/vosk/models/vosk-model-de-0.6.zip", - "nl": "https://alphacephei.com/vosk/models/vosk-model-nl-spraakherkenning-0.6.zip", - "fa": "https://alphacephei.com/vosk/models/vosk-model-fa-0.5.zip" - - } - if not small: - lang2url.update(biglang2url) - lang = lang.lower() - if lang in lang2url: - return lang2url[lang] - lang = lang.split("-")[0] - return lang2url.get(lang) - - -class VoskKaldiSTT(STT): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - # model_folder for backwards compat - model_path = self.config.get("model_folder") or self.config.get("model") - - self.model = ModelContainer() - if model_path: - if model_path.startswith("http"): - model_path = ModelContainer.download_model(model_path) - self.model.load_model(model_path, self.lang) - else: - self.model.load_language(self.lang) - self.verbose = True - - def load_language(self, lang): - self.model.load_language(lang) - - def unload_language(self, lang): - self.model.unload_language(lang) - - def enable_limited_vocabulary(self, words, lang): - self.model.enable_limited_vocabulary(words, lang or self.lang) - - def enable_full_vocabulary(self, lang=None): - self.model.enable_full_vocabulary(lang or self.lang) - - def execute(self, audio, language=None): - lang = language or self.lang - self.model.process_audio(audio, lang) - return self.model.get_final_transcription(lang) - - -class VoskKaldiStreamThread(StreamThread): - def __init__(self, queue, lang, model, verbose=True): - super().__init__(queue, lang) - self.model = model - self.verbose = verbose - self.previous_partial = "" - self.running = True - - def handle_audio_stream(self, audio, language): - lang = language or self.language - if self.running: - for a in audio: - self.model.process_audio(a, lang) - self.text = self.model.get_partial_transcription(lang) - if self.verbose: - if self.previous_partial != self.text: - LOG.info("Partial Transcription: " + self.text) - self.previous_partial = self.text - return self.text - - def finalize(self): - self.running = False - if self.previous_partial: - if self.verbose: - LOG.info("Finalizing stream") - self.text = self.model.get_final_transcription(self.language) - self.previous_partial = "" - text = str(self.text) - self.text = "" - return text - - -class VoskKaldiStreamingSTT(StreamingSTT, VoskKaldiSTT): - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.verbose = self.config.get("verbose", False) - - def create_streaming_thread(self): - self.queue = Queue() - return VoskKaldiStreamThread( - self.queue, self.lang, self.model, self.verbose - ) diff --git a/build/lib/ovos_stt_plugin_vosk/version.py b/build/lib/ovos_stt_plugin_vosk/version.py deleted file mode 100644 index b4e1c6b..0000000 --- a/build/lib/ovos_stt_plugin_vosk/version.py +++ /dev/null @@ -1,7 +0,0 @@ -# The following lines are replaced during the release process. -# START_VERSION_BLOCK -VERSION_MAJOR = 0 -VERSION_MINOR = 1 -VERSION_BUILD = 3 -VERSION_ALPHA = 0 -# END_VERSION_BLOCK diff --git a/dist/ovos_stt_plugin_vosk-0.1.3-py3-none-any.whl b/dist/ovos_stt_plugin_vosk-0.1.3-py3-none-any.whl deleted file mode 100644 index 65cd3c2d4ae8828d64b85763753b0a10d3680cdb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4360 zcma)<2{e>#|HsGHSdv|&hX~om3=am$3l@BQF2|ULZlKX}^rr&ccEiKVoaF&RbVxEKUZ)%-z0pH$P_R^w6#X@g$ zu0Dp@gE;fk3(^gi^e!?Xnce7g@L2l2L~Hr@1i%p^xJQ1?`y{K86k<1 z$)^i&`_o~Y=_qD{EuJzTxAoec{R>YwpY{R!NoRzvR+`DII_jvdD1^HDc7`zuySTVm zN99%*ge@3e@4O!v6g`!YK%aY!wW$Ama*mAhP6Ksu>@EbN{$%m~vLg-$lD%+0^E`oT;qZIDB`jix>f>sghF-?S);rGv%xJcsLXTudr$ZTw_^$~+SvG}a` z4>hYS`^KL#l#LfMGK3-RjKItH>oS*44cvC#Qj5?=HbEFm3+8pk zQe&*w$FH6|R!ksfFZ1f1%O$v)wu(4jTvYb!FCnUZ{mhHDR_|@)%9~1(f1@{Wr``S} zzZN05EUmmpul@MQEmekxlSQ}7m)8#vVQB(q?>%z2vWiAW&I%^n9NKOw>uem𝔒` z4Ybw1;%}n~c5k>N)3Wn$LxXrF8xiQ7V}!~gB%doF?nR$@xNh`#j^`F9Ojh4&GDsnO zGGJN9aatq3#FMyYczczv_EPO@gPI+^kBs|Ju$Cr2r){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in_vosk.egg-info/PKG-INFO b/ovos_stt_plugin_vosk.egg-info/PKG-INFO deleted file mode 100644 index 1835657..0000000 --- a/ovos_stt_plugin_vosk.egg-info/PKG-INFO +++ /dev/null @@ -1,25 +0,0 @@ -Metadata-Version: 1.1 -Name: ovos-stt-plugin-vosk -Version: 0.1.3 -Summary: A vosk stt plugin for mycroft -Home-page: https://github.com/OpenVoiceOS/ovos-stt-plugin-vosk -Author: JarbasAi -Author-email: jarbasai@mailfence.com -License: Apache-2.0 -Description: UNKNOWN -Keywords: mycroft ovos plugin stt -Platform: UNKNOWN -Classifier: Development Status :: 3 - Alpha -Classifier: Intended Audience :: Developers -Classifier: Topic :: Text Processing :: Linguistic -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.0 -Classifier: Programming Language :: Python :: 3.1 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 diff --git a/ovos_stt_plugin_vosk.egg-info/SOURCES.txt b/ovos_stt_plugin_vosk.egg-info/SOURCES.txt deleted file mode 100644 index b772ce8..0000000 --- a/ovos_stt_plugin_vosk.egg-info/SOURCES.txt +++ /dev/null @@ -1,10 +0,0 @@ -setup.py -ovos_stt_plugin_vosk/__init__.py -ovos_stt_plugin_vosk/version.py -ovos_stt_plugin_vosk.egg-info/PKG-INFO -ovos_stt_plugin_vosk.egg-info/SOURCES.txt -ovos_stt_plugin_vosk.egg-info/dependency_links.txt -ovos_stt_plugin_vosk.egg-info/entry_points.txt -ovos_stt_plugin_vosk.egg-info/requires.txt -ovos_stt_plugin_vosk.egg-info/top_level.txt -ovos_stt_plugin_vosk.egg-info/zip-safe \ No newline at end of file diff --git a/ovos_stt_plugin_vosk.egg-info/dependency_links.txt b/ovos_stt_plugin_vosk.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/ovos_stt_plugin_vosk.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ovos_stt_plugin_vosk.egg-info/entry_points.txt b/ovos_stt_plugin_vosk.egg-info/entry_points.txt deleted file mode 100644 index 5990461..0000000 --- a/ovos_stt_plugin_vosk.egg-info/entry_points.txt +++ /dev/null @@ -1,4 +0,0 @@ -[mycroft.plugin.stt] -ovos-stt-plugin-vosk = ovos_stt_plugin_vosk:VoskKaldiSTT -ovos-stt-plugin-vosk-streaming = ovos_stt_plugin_vosk:VoskKaldiStreamingSTT - diff --git a/ovos_stt_plugin_vosk.egg-info/requires.txt b/ovos_stt_plugin_vosk.egg-info/requires.txt deleted file mode 100644 index da549c8..0000000 --- a/ovos_stt_plugin_vosk.egg-info/requires.txt +++ /dev/null @@ -1,4 +0,0 @@ -vosk -ovos-plugin-manager>=0.0.1 -ovos_skill_installer -SpeechRecognition>=3.8.1 diff --git a/ovos_stt_plugin_vosk.egg-info/top_level.txt b/ovos_stt_plugin_vosk.egg-info/top_level.txt deleted file mode 100644 index 726fb51..0000000 --- a/ovos_stt_plugin_vosk.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -ovos_stt_plugin_vosk diff --git a/ovos_stt_plugin_vosk.egg-info/zip-safe b/ovos_stt_plugin_vosk.egg-info/zip-safe deleted file mode 100644 index 8b13789..0000000 --- a/ovos_stt_plugin_vosk.egg-info/zip-safe +++ /dev/null @@ -1 +0,0 @@ -