Skip to content

Commit

Permalink
don't pass newlines to fasttext. this will fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Lohmaier committed Jul 5, 2022
1 parent 97a4984 commit e70fe18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions addon/globalPlugins/langPredict.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def predictLang(langChangeCmd: LangChangeCommand, text: str):
defaultLang = synth.availableVoices[synth.voice].language
if langChangeCmd is None:
langChangeCmd = LangChangeCommand(defaultLang)
text = text.replace('\n', ' ').replace('\r', ' ') #fasttext doe not like newlines
predictedLang = fastTextModel.predict(text)[0][0][9:] #strip '__label__'
log.debug('PREDICTED={0} TEXT={1}'.format(str(predictedLang), text))

Expand Down
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _(arg):
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description": _("""Predict the language of every spoken text with an ai model and change the voice accordingly, if available."""),
# version
"addon_version": "0.0.1",
"addon_version": "0.0.2",
# Author(s)
"addon_author": "Stefan Lohmaier <stefan@slohmaier.de>",
# URL for the add-on documentation support
Expand Down

0 comments on commit e70fe18

Please sign in to comment.