Skip to content

Conversation

@NeonJarbas
Copy link

@NeonJarbas NeonJarbas commented Mar 1, 2022

feat/stt control

  • new bus api to preload/unload a STT language
  • new bus api to define limited vocabulary for transcriptions

requires #77

bus.emit(Message('recognizer_loop:load_language',
                             {"lang": "pt-pt"}))
bus.emit(Message('recognizer_loop:set_limited_vocab',
                             {"vocabs": ["yes", "no"], 
                              "lang": "en-us"}))

@JarbasAl JarbasAl added the enhancement New feature or request label Mar 1, 2022
@codecov
Copy link

codecov bot commented Mar 1, 2022

Codecov Report

Merging #78 (5d3c5cf) into dev (51814d2) will increase coverage by 1.58%.
The diff coverage is 46.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #78      +/-   ##
==========================================
+ Coverage   49.08%   50.67%   +1.58%     
==========================================
  Files         115      117       +2     
  Lines        9720    10049     +329     
==========================================
+ Hits         4771     5092     +321     
- Misses       4949     4957       +8     
Impacted Files Coverage Δ
mycroft/gui/service.py 0.00% <0.00%> (ø)
mycroft/skills/__main__.py 0.00% <0.00%> (ø)
mycroft/skills/intent_services/converse_service.py 58.97% <0.00%> (ø)
...ycroft/skills/intent_services/padatious_service.py 47.87% <14.28%> (-3.12%) ⬇️
mycroft/client/speech/service.py 31.11% <36.93%> (+31.11%) ⬆️
mycroft/gui/homescreen.py 38.54% <38.54%> (ø)
mycroft/skills/intent_service_interface.py 41.07% <38.88%> (-2.17%) ⬇️
mycroft/skills/intent_service.py 62.11% <50.00%> (-0.39%) ⬇️
mycroft/gui/extensions.py 56.83% <56.83%> (ø)
mycroft/client/speech/listener.py 25.17% <59.37%> (+25.17%) ⬆️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b11b61...5d3c5cf. Read the comment docs.

JarbasAl pushed a commit to OpenVoiceOS/ovos-stt-plugin-vosk that referenced this pull request Mar 1, 2022
* feat/multi_lang_limited_voc

- add support for loading multiple languages, allows for lang to be set by request
- add support for OpenVoiceOS/ovos-core#78

authored-by: jarbasai <jarbasai@mailfence.com>
JarbasAl added 2 commits March 3, 2022 21:06
- new bus api to preload/unload a STT language
- new bus api to define limited vocabulary for transcriptions
@JarbasAl
Copy link
Member

JarbasAl commented Mar 3, 2022

needs OpenVoiceOS/ovos-utils#34 for tests to pass

@JarbasAl JarbasAl requested a review from NeonDaniel March 4, 2022 00:29
lang (str): default to system lang
top_words (bool): default True, augment vocab with 10k most common words for lang
english_fallback (bool): default False, use en res files if lang file not found
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to specify an optional fallback language here? English makes sense in many cases, but maybe for Portuguese or Catalan, Spanish would be a more logical default for example?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fallback is for failures of main STT, not for extra langs, fallback should be in same lang....

lang being session based the aim is that each engine can support multiple langs, and many of them can, but main stt could for example throw a UnsupporteLang exception. The take away is that each engine should account for the lang being requested inside the plugin itself

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, i misread, you mean voc fallback, i kept this because mycroft does it in their res files....

maybe we should remove this, its not like STT would pick it up...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.. If we keep it, I think it should be a configurable language.. I'm not sure if something like pt falling back to es would yield usable results (2 most similar languages that come to mind). I have no strong feelings about dropping it though..

LOG.exception(f"Failed to unload fallback STT lang: {lang}")

@staticmethod
def load_limited_vocabs(message=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add return annotation and/or docstring

@@ -0,0 +1,10000 @@
the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider a more descriptive name for this common_words.voc, essential_words.voc?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funny, those were my initial names but i found limited_stt more descriptive...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

limited_stt seems ambiguous to me; my first assumption was that it included intent-related vocabulary.. maybe base_vocabulary, basic_vocabulary, foundational_words? I see this as the set of words that a domain-specific vocabulary might be added to (i.e. load a list of medical terms for some medical application or a list of product names for a retail application)

self.timeout = timeout

def get_adapt_intent(self, utterance, lang="en-us"):
def get_adapt_intent(self, utterance, lang=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we try to read language from messages using dig_for_message here? Since we're generating new Message objects in these methods, this is the last place we have a chance of resolving the originating message

We could make a decorator for this that could be applicable to every other method that looks up user language

@JarbasAl JarbasAl added the on hold blocked until next major release label Apr 20, 2022
@JarbasAl JarbasAl marked this pull request as draft April 20, 2022 16:41
JarbasAl added a commit to OpenVoiceOS/ovos-stt-plugin-vosk that referenced this pull request Apr 22, 2022
- fix streaming STT
- handlers for load/unload lang
- handlers for limited vocab

related OpenVoiceOS/ovos-core/pull/78
@JarbasAl
Copy link
Member

reopen in ovos-listener if needed

@JarbasAl JarbasAl closed this May 16, 2023
@NeonJarbas NeonJarbas deleted the feat/stt_control branch January 6, 2024 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request on hold blocked until next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants