Skip to content

Commit

Permalink
Merge pull request #264 from OpenVoiceOS/release-0.3.0a1
Browse files Browse the repository at this point in the history
Release 0.3.0a1
  • Loading branch information
JarbasAl authored Sep 11, 2024
2 parents f35ac57 + 433e1d1 commit 2216f1f
Show file tree
Hide file tree
Showing 13 changed files with 313 additions and 267 deletions.
49 changes: 4 additions & 45 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,13 @@
# Changelog

## [0.2.0a1](https://github.com/OpenVoiceOS/ovos-plugin-manager/tree/0.2.0a1) (2024-09-10)
## [0.3.0a1](https://github.com/OpenVoiceOS/ovos-plugin-manager/tree/0.3.0a1) (2024-09-11)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-plugin-manager/compare/0.1.1a1...0.2.0a1)

**Implemented enhancements:**

- feat/triples\_plugins [\#257](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/257) ([JarbasAl](https://github.com/JarbasAl))

## [0.1.1a1](https://github.com/OpenVoiceOS/ovos-plugin-manager/tree/0.1.1a1) (2024-09-10)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-plugin-manager/compare/V0.1.1...0.1.1a1)

**Implemented enhancements:**

- feat/units\_kwarg\_solvers [\#247](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/247) ([JarbasAl](https://github.com/JarbasAl))
- feat/metadata [\#246](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/246) ([JarbasAl](https://github.com/JarbasAl))
- feat/embeddings\_metadata\_support [\#245](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/245) ([JarbasAl](https://github.com/JarbasAl))
- feat/add\_rerank\_method [\#243](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/243) ([JarbasAl](https://github.com/JarbasAl))
- feat/pipeline\_intent\_match [\#242](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/242) ([JarbasAl](https://github.com/JarbasAl))
- feat/pipeline\_plugin\_placeholder [\#241](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/241) ([JarbasAl](https://github.com/JarbasAl))
- feat/embeddings plugins [\#240](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/240) ([JarbasAl](https://github.com/JarbasAl))
- feat/alternative\_transcripts [\#236](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/236) ([JarbasAl](https://github.com/JarbasAl))
- feat/lang\_detection\_plugin [\#220](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/220) ([JarbasAl](https://github.com/JarbasAl))
- feat/restore phonetic spellings [\#195](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/195) ([JarbasAl](https://github.com/JarbasAl))

**Fixed bugs:**

- fix/restore\_dead\_code [\#256](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/256) ([JarbasAl](https://github.com/JarbasAl))
- fix/context\_kwarg\_backwards\_compat [\#248](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/248) ([JarbasAl](https://github.com/JarbasAl))
- refactor/solver\_decorators [\#244](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/244) ([JarbasAl](https://github.com/JarbasAl))
- fix/missing\_property [\#239](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/239) ([JarbasAl](https://github.com/JarbasAl))
- ensure cache dir exists [\#232](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/232) ([JarbasAl](https://github.com/JarbasAl))
- fix/playback\_time\_not\_abstract [\#230](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/230) ([JarbasAl](https://github.com/JarbasAl))
- fix/legacy\_playlist\_queue [\#227](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/227) ([JarbasAl](https://github.com/JarbasAl))
- hotfix/voice\_kwarg [\#223](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/223) ([JarbasAl](https://github.com/JarbasAl))
- hotfix/clean\_shutdown [\#222](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/222) ([JarbasAl](https://github.com/JarbasAl))
- fix/tts\_reload [\#219](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/219) ([JarbasAl](https://github.com/JarbasAl))
[Full Changelog](https://github.com/OpenVoiceOS/ovos-plugin-manager/compare/0.2.0...0.3.0a1)

**Merged pull requests:**

- chore:semver\_automations [\#259](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/259) ([JarbasAl](https://github.com/JarbasAl))
- license compliance [\#255](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/255) ([JarbasAl](https://github.com/JarbasAl))
- planned\_deprecations [\#254](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/254) ([JarbasAl](https://github.com/JarbasAl))
- refactor/improve\_readwritestream [\#234](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/234) ([JarbasAl](https://github.com/JarbasAl))
- refactor/deprecation\_warnings [\#233](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/233) ([JarbasAl](https://github.com/JarbasAl))
- fix/py3.12 [\#231](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/231) ([JarbasAl](https://github.com/JarbasAl))
- refactor/legacy\_audio [\#226](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/226) ([JarbasAl](https://github.com/JarbasAl))
- Fix file path handling in setup.py [\#225](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/225) ([NeonDaniel](https://github.com/NeonDaniel))
- Update for ovos-utils 0.0.X compat. [\#224](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/224) ([NeonDaniel](https://github.com/NeonDaniel))
- feat:fallback\_plugins [\#263](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/263) ([JarbasAl](https://github.com/JarbasAl))
- chore:semver\_versioning [\#262](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/262) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
21 changes: 10 additions & 11 deletions ovos_plugin_manager/g2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ def get_g2p_config(config: Optional[dict] = None) -> dict:


class OVOSG2PFactory:
""" replicates the base mycroft class, but uses only OPM enabled plugins"""
MAPPINGS = {
"dummy": "ovos-g2p-plugin-dummy",
"phoneme_guesser": "neon-g2p-plugin-phoneme-guesser",
"gruut": "neon-g2p-plugin-gruut"
}

@staticmethod
def get_class(config=None):
Expand All @@ -97,15 +91,13 @@ def get_class(config=None):
"""
config = get_g2p_config(config)
g2p_module = config.get("module") or 'dummy'
if g2p_module in OVOSG2PFactory.MAPPINGS:
g2p_module = OVOSG2PFactory.MAPPINGS[g2p_module]
if g2p_module == 'ovos-g2p-plugin-dummy':
if g2p_module == 'dummy':
return Grapheme2PhonemePlugin

return load_g2p_plugin(g2p_module)

@staticmethod
def create(config=None):
@classmethod
def create(cls, config=None):
"""Factory method to create a G2P engine based on configuration.
The configuration file ``mycroft.conf`` contains a ``g2p`` section with
Expand All @@ -115,13 +107,20 @@ def create(config=None):
"module": <engine_name>
}
"""
if "g2p" in config:
config = config["g2p"]
g2p_config = get_g2p_config(config)
g2p_module = g2p_config.get('module', 'dummy')
fallback = g2p_config.get("fallback_module")
try:
clazz = OVOSG2PFactory.get_class(g2p_config)
g2p = clazz(g2p_config)
LOG.debug(f'Loaded plugin {g2p_module}')
except Exception:
LOG.exception('The selected G2P plugin could not be loaded.')
if fallback in config and fallback != g2p_module:
LOG.info(f"Attempting to load fallback plugin instead: {fallback}")
config["module"] = fallback
return cls.create(config)
raise
return g2p
76 changes: 20 additions & 56 deletions ovos_plugin_manager/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,7 @@ def get_lang_detect_module_configs(module_name: str):
return load_plugin_configs(module_name, PluginConfigTypes.LANG_DETECT)


_fallback_lang_detect_plugin = "ovos-lang-detect-ngram-lm"
_fallback_translate_plugin = "ovos-translate-plugin-server"


class OVOSLangDetectionFactory:
"""
replicates the base neon class, but uses only OPM enabled plugins
"""
MAPPINGS = {
"libretranslate": "libretranslate_detection_plug",
"google": "googletranslate_detection_plug",
"amazon": "amazontranslate_detection_plug",
"cld2": "cld2_plug",
"cld3": "cld3_plug",
"langdetect": "langdetect_plug",
"fastlang": "fastlang_plug",
"lingua_podre": "lingua_podre_plug"
}

@staticmethod
def get_class(config=None):
Expand All @@ -120,12 +103,10 @@ def get_class(config=None):
lang_module = config.get("detection_module", config.get("module"))
if not lang_module:
raise ValueError("`language.detection_module` not configured")
if lang_module in OVOSLangDetectionFactory.MAPPINGS:
lang_module = OVOSLangDetectionFactory.MAPPINGS[lang_module]
return load_lang_detect_plugin(lang_module)

@staticmethod
def create(config=None) -> LanguageDetector:
@classmethod
def create(cls, config=None) -> LanguageDetector:
"""
Factory method to create a LangDetection engine based on configuration
Expand All @@ -140,37 +121,26 @@ def create(config=None) -> LanguageDetector:
if "language" in config:
config = config["language"]
lang_module = config.get("detection_module", config.get("module"))
cfg = config.get(lang_module, {})
fallback = cfg.get("fallback_module")
try:
config["module"] = lang_module
clazz = OVOSLangDetectionFactory.get_class(config)
if clazz is None:
raise ValueError(f"Failed to load module: {lang_module}")
LOG.info(f'Loaded the Language Detection plugin {lang_module}')
if lang_module in OVOSLangDetectionFactory.MAPPINGS:
lang_module = OVOSLangDetectionFactory.MAPPINGS[lang_module]
return clazz(config=get_plugin_config(config, "language",
lang_module))
except Exception:
# The Language Detection backend failed to start, fall back if appropriate.
if lang_module != _fallback_lang_detect_plugin:
lang_module = _fallback_lang_detect_plugin
LOG.error(f'Language Detection plugin {lang_module} not found. '
f'Falling back to {_fallback_lang_detect_plugin}')
clazz = load_lang_detect_plugin(_fallback_lang_detect_plugin)
if clazz:
return clazz(config=get_plugin_config(config, "language",
lang_module))

LOG.exception(f'Language Detection plugin {lang_module} could not be loaded!')
if fallback in config and fallback != lang_module:
LOG.info(f"Attempting to load fallback plugin instead: {fallback}")
config["detection_module"] = fallback
return cls.create(config)
raise


class OVOSLangTranslationFactory:
""" replicates the base neon class, but uses only OPM enabled plugins"""
MAPPINGS = {
"libretranslate": "libretranslate_plug",
"google": "googletranslate_plug",
"amazon": "amazontranslate_plug",
"apertium": "apertium_plug"
}

@staticmethod
def get_class(config=None):
Expand All @@ -190,12 +160,10 @@ def get_class(config=None):
lang_module = config.get("translation_module", config.get("module"))
if not lang_module:
raise ValueError("`language.translation_module` not configured")
if lang_module in OVOSLangTranslationFactory.MAPPINGS:
lang_module = OVOSLangTranslationFactory.MAPPINGS[lang_module]
return load_tx_plugin(lang_module)

@staticmethod
def create(config=None) -> LanguageTranslator:
@classmethod
def create(cls, config=None) -> LanguageTranslator:
"""
Factory method to create a LangTranslation engine based on configuration
Expand All @@ -210,24 +178,20 @@ def create(config=None) -> LanguageTranslator:
if "language" in config:
config = config["language"]
lang_module = config.get("translation_module", config.get("module"))
cfg = config.get(lang_module, {})
fallback = cfg.get("fallback_module")
try:
config["module"] = lang_module
clazz = OVOSLangTranslationFactory.get_class(config)
if clazz is None:
raise ValueError(f"Failed to load module: {lang_module}")
LOG.info(f'Loaded the Language Translation plugin {lang_module}')
if lang_module in OVOSLangTranslationFactory.MAPPINGS:
lang_module = OVOSLangTranslationFactory.MAPPINGS[lang_module]
return clazz(config=get_plugin_config(config, "language",
lang_module))
except Exception:
# The Language Translation backend failed to start, fall back if appropriate.
if lang_module != _fallback_translate_plugin:
lang_module = _fallback_translate_plugin
LOG.error(f'Language Translation plugin {lang_module} '
f'not found. Falling back to {_fallback_translate_plugin}')
clazz = load_tx_plugin(_fallback_translate_plugin)
if clazz:
return clazz(config=get_plugin_config(config, "language",
lang_module))

LOG.exception(f'Language Translation plugin {lang_module} could not be loaded!')
if fallback in config and fallback != lang_module:
LOG.info(f"Attempting to load fallback plugin instead: {fallback}")
config["translation_module"] = fallback
return cls.create(config)
raise
13 changes: 11 additions & 2 deletions ovos_plugin_manager/microphone.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def get_class(config=None):
microphone_module = config.get("module")
return load_microphone_plugin(microphone_module)

@staticmethod
def create(config=None):
@classmethod
def create(cls, config=None):
"""Factory method to create a microphone engine based on configuration.
The configuration file ``mycroft.conf`` contains a ``microphone`` section with
Expand All @@ -60,18 +60,27 @@ def create(config=None):
"module": <engine_name>
}
"""
if "microphone" in config:
config = config["microphone"]
microphone_config = get_microphone_config(config)
microphone_module = microphone_config.get('module')
fallback = microphone_config.get("fallback_module")
try:
clazz = OVOSMicrophoneFactory.get_class(microphone_config)
# Note that configuration is expanded for this class of plugins
# since they are dataclasses and don't have the same init signature
# as other plugin types
microphone_config.pop('lang')
microphone_config.pop('module')
if fallback:
microphone_config.pop('fallback_module')
microphone = clazz(**microphone_config)
LOG.debug(f'Loaded microphone plugin {microphone_module}')
except Exception:
LOG.exception('The selected microphone plugin could not be loaded.')
if fallback in config and fallback != microphone_module:
LOG.info(f"Attempting to load fallback plugin instead: {fallback}")
config["module"] = fallback
return cls.create(config)
raise
return microphone
33 changes: 17 additions & 16 deletions ovos_plugin_manager/vad.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ def get_vad_config(config: dict = None) -> dict:


class OVOSVADFactory:
""" replicates the base mycroft class, but uses only OPM enabled plugins"""
MAPPINGS = {
"silero": "ovos-vad-plugin-silero",
"webrtcvad": "ovos-vad-plugin-webrtcvad"
}

@staticmethod
def get_class(config=None):
Expand All @@ -84,12 +79,10 @@ def get_class(config=None):
raise ValueError(f"VAD Plugin not configured in: {config}")
if vad_module == "dummy":
return VADEngine
if vad_module in OVOSVADFactory.MAPPINGS:
vad_module = OVOSVADFactory.MAPPINGS[vad_module]
return load_vad_plugin(vad_module)

@staticmethod
def create(config=None):
@classmethod
def create(cls, config=None):
"""Factory method to create a VAD engine based on configuration.
The configuration file ``mycroft.conf`` contains a ``VAD`` section with
Expand All @@ -99,16 +92,24 @@ def create(config=None):
"module": <engine_name>
}
"""
vad_config = get_vad_config(config)
plugin = vad_config.get("module")
if "listener" in config:
config = config["listener"]
if "VAD" in config:
config = config["VAD"]
plugin = config.get("module")
if not plugin:
raise ValueError(f"VAD Plugin not configured in: {vad_config}")
raise ValueError(f"VAD Plugin not configured in: {config}")

plugin_config = config.get(plugin, {})
fallback = plugin_config.get("fallback_module")

try:
clazz = OVOSVADFactory.get_class(vad_config)
# module name not expected in config; don't change passed config
plugin_config = dict(vad_config)
plugin_config.pop("module")
clazz = OVOSVADFactory.get_class(config)
return clazz(plugin_config)
except Exception:
LOG.exception(f'VAD plugin {plugin} could not be loaded!')
if fallback in config and fallback != plugin:
LOG.info(f"Attempting to load fallback plugin instead: {fallback}")
config["module"] = fallback
return cls.create(config)
raise
6 changes: 3 additions & 3 deletions ovos_plugin_manager/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 2
VERSION_MINOR = 3
VERSION_BUILD = 0
VERSION_ALPHA = 0
# END_VERSION_BLOCK
VERSION_ALPHA = 1
# END_VERSION_BLOCK
10 changes: 0 additions & 10 deletions ovos_plugin_manager/wakewords.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ def get_wws(scan=False):


class OVOSWakeWordFactory:
""" replicates the base mycroft class, but uses only OPM enabled plugins"""
MAPPINGS = {
"dummy": "ovos-ww-plugin-dummy",
"pocketsphinx": "ovos-ww-plugin-pocketsphinx",
"precise": "ovos-ww-plugin-precise",
"snowboy": "ovos-ww-plugin-snowboy",
"porcupine": "porcupine_wakeword_plug"
}

@staticmethod
def get_class(hotword: str, config: Optional[dict] = None) -> type:
Expand All @@ -128,8 +120,6 @@ def get_class(hotword: str, config: Optional[dict] = None) -> type:
f"Returning base HotWordEngine")
return HotWordEngine
ww_module = hotword_config[hotword]["module"]
if ww_module in OVOSWakeWordFactory.MAPPINGS:
ww_module = OVOSWakeWordFactory.MAPPINGS[ww_module]
return load_wake_word_plugin(ww_module)

@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ovos-utils < 0.2.0, >=0.0.38
ovos-bus-client < 0.2.0, >=0.0.9
ovos-config < 0.2.0, >=0.0.12
ovos-utils>=0.0.38,<1.0.0
ovos_bus_client>=0.0.8,<1.0.0
ovos-config>=0.0.12,<1.0.0
combo_lock~=0.2
requests~=2.26
quebra_frases
Expand Down
Loading

0 comments on commit 2216f1f

Please sign in to comment.