Build an open future with us.

Invest in Mycroft and become a community partner.

Guide to add a new language


#1

I made a guide on how to add a new language


#2

Hello,

Thank you for the guide, but even is a step-by-step guide, I still have many doubts in where is supposed to made all those changes.

Step1: find a STT engine that supports your language: Ok, I want to add spanish. So I guess there would be no problem with any STT engine, but for the easiness sake, I 'll choose Google.
Step2: - find a TTS engine that supports your language: The same than before, I’ll choose Google.

I guess those two steps must be set on the home.mycroft.ai advanced settings. But for Google STT to work I need an API KEY, which I don’t know how to get one and for the Google’s TTS I need a “voice” which I neither know what to put here.

Step3: Change your config file
Which config file? /etc/mycroft.conf? As seems a yml/json file like your example, I guess it is. So, a new question arises, step1 and step2 should be put here or in home.mycroft.com?
My /etc/mycroft.conf now is only this

{
  "enclosure": {
    "platform": "mycroft_mark_1",
    "platform_build": 7,
    "port": "/dev/ttyAMA0",
    "rate": 9600,
    "timeout": 5,
    "update": true,
    "test": false
  },
  "VolumeSkill": {
    "default_level": 6,
    "min_volume": 0,
    "max_volume": 83
  }
}

How would be if I want to add spanish support with google there?

Sorry for those newbie questions, I’m not confortable enough yet with mycroft…


#3

While I haven’t tested changing the language, I think I can help set it up. For STT, Mycroft’s backend STT currently uses Google, so it might actually work by default (if I remember correctly, it picked up Spanish before without even changing the config). Then, to actually change the language settings, try adding:

,
"lang": "pt-pt"

for example, to add Portuguese. After doing this and restarting, Mycroft should respond in the other language for any vocab files that have been translated to the language. I put pt-pt in the example because I believe a few parts have already been translated to Portuguese. However, while it will technically speak another language, it will pronounce it horribly using the english TTS system, so for that you’d need to setup Mimic with Spanish. I remember this is possible, but I don’t remember the steps fir this.


#4

Where I’m supposed to set this? I’ve set up on /etc/mycroft/mycroft.conf but after restarting the device didn’t answer and the eyes on the screen were a light spinning incessantly


#5

i will update the guide to make it clearer

you may be getting your settings overrided by the remote config in mycroft.ai, the spinning eyes may be a different problem, i think it was a know bug a while back?


#6

Removing the lang line from mycroft.conf eyes turned normal again, but now doesn’t understands me… mycroft-speech-client.log says

14:08:19.515 - mycroft.client.speech.listener:transcribe:146 - ERROR - Could not request Speech Recognition recognition request failed: Forbidden

and mycroft-messagebus.log says

14:11:20.932 - mycroft.messagebus.service.ws:on_message:41 - DEBUG - {"data": {}, "type": "recognizer_loop:record_begin", "context": null}
14:11:20.995 - mycroft.messagebus.service.ws:on_message:41 - DEBUG - {"data": {}, "type": "Command: mouth.listen", "context": null}
14:11:23.143 - mycroft.messagebus.service.ws:on_message:41 - DEBUG - {"data": {}, "type": "recognizer_loop:record_end", "context": null}
14:11:23.574 - mycroft.messagebus.service.ws:on_message:41 - DEBUG - {"data": {"session": "08c503be-68b9-42fb-851d-007965a75131", "utterance": "hey mycroft"}, "type": "recognizer_loop:wakeword", "context": null}
14:11:23.624 - mycroft.messagebus.service.ws:on_message:41 - DEBUG - {"data": {}, "type": "Command: mouth.reset", "context": null}

But I guess this is another problem :expressionless:


#7

Make sure when you add the line you add a comma before so that it looks exactly like this:

{
  "enclosure": {
    "platform": "mycroft_mark_1",
    "platform_build": 7,
    "port": "/dev/ttyAMA0",
    "rate": 9600,
    "timeout": 5,
    "update": true,
    "test": false
  },
  "VolumeSkill": {
    "default_level": 6,
    "min_volume": 0,
    "max_volume": 83
  },
  "lang": "pt-pt"
}

I’m not quite sure about the other error.


#8

Regarding the last issue, I did as I’d readed somewhere else and deleted the /home/mycroft/.mycroft/identity/identity2.json and readded the mycroft via home.mycroft.ai, and Mycroft started to work again. Just in case, I did wipe it and began the entire process.

On the main subject… thank you it was the comma… :man_facepalming:

Anyway, despite now mycroft listen what I say in spanish, it continues saying “sorry, I didn’t catch that”. Seeing at the logs, I can see how it can “understand what I’m saying”

19:10:44.115 - mycroft.client.speech.main:handle_wakeword:50 - INFO - Wakeword Detected: hey mycroft
19:10:44.184 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai
19:10:45.044 - mycroft.client.speech.mic:listen:492 - DEBUG - Waiting for wake word…
19:10:45.135 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 “POST /v1/stt?lang=es-ES&limit=1 HTTP/1.1” 200 None
19:10:45.756 - mycroft.client.speech.listener:transcribe:144 - DEBUG - STT: qué distancia hay de la tierra a la luna
19:10:45.760 - mycroft.client.speech.main:handle_utterance:55 - INFO - Utterance: [u’qu\xe9 distancia hay de la tierra a la luna’]
19:10:45.810 - mycroft.client.speech.main:handle_complete_intent_failure:67 - INFO - Failed to find intent.

But no answer, I guess is the “intent” problem.

How should I continue now?


#9

the skills are not translated, you must also translate those

there is a “en-us” folder, just clone it to “es-es” and translate

dialog/en-us/speak.dialog
vocab/en-us/sentence.intent
vocab/en-us/keyword.voc
regex/en-us/regex.rx


#10

Great!

I’ve translated the skill skill-date-time into spanish and now Mycroft can understand that command! :ok_man:

Now the last step should be mycroft speaking spanish, I mean, he telling the time in spanish or the typical messages “sorry, I didn’t catch that” and so… how can I accomplish that?

(this is exciting! :smile: )


#11

some skilsl use .dialog files, these are easy to translate

others, for example jokes skill, generate speech at runtime, the jokes skills has no way to be translated

for some skills you may need to edit the code of the skill

translate all bits of the kind self.speak(“something im speaking”), ideally skill makers should always use self.speak_dialog for this reason, but not all skills do


#12

skill-time-dialgog has the .dialog files which I’ve translated, but it continues spealing in english, and not in the translated version.

I guess I didn’t configure at all the TTS engine and its still using the defaults. Well, I didn’t configured neither STT nor TTS at all, to be honest, I’ve only set the “lang” parameter on mycroft.con since I didn’t understand how to configure any module explained on your guide.

My mycroft.con now is just this:

{
“enclosure”: {
“platform”: “mycroft_mark_1”,
“platform_build”: 10,
“port”: “/dev/ttyAMA0”,
“rate”: 9600,
“timeout”: 5.0,
“update”: true,
“test”: false
},
“VolumeSkill”: {
“default_level”: 6,
“min_volume”: 0,
“max_volume”: 83
},
“ipc_path”: “/ramdisk/mycroft/ipc/”,
“lang”: “es-es”
}

I would like espeak as engine, that’s the problem, I do not know how to add it to the configuration without break anything. Could you please specify how can I get it?


#13

I use the espeak example in my guide…

Mycroft as several possible configuration files, you can change the
configuration at home.mycroft.ai

If you do not wish to use the mycroft.ai endpoint change your config located at “~/.mycroft/mycroft.conf”

Change your config file to use TTS and STT engine of choice

    "lang": "pt-pt",
    ...
    "tts": {
      "module": "espeak",
      ...
      "espeak": {
        "lang": "pt-pt",
        "voice": "m1"
      }
    "stt": {
      "module": "ibm",
      ...
      "ibm":{
        "credential" : {
            "username": "xxxxxxxxxxxxxxx",
            "password": "xxx"
            }
      }

If remote configuration is enabled it will override your changes, disable it

    "server": {
     ...
     "update": false,
     ...
    },

#14

Identation matters like in yaml or python? Sometimes I see two spaces, sometimes one and sometimes three blank spaces.
I fear to break it again (it seems pretty fragile and I had to reimage mark1 twice, because rolling back changes let mycroft unusable and with the spinning eyes)


#15

by the way, those changes must be done on ~/.mycroft/mycroft.conf or /etc/mycroft/mycroft.conf?
What’s the difference between the two of them? Whenever I modified the ~/.mycroft/mycroft.conf, the system has become unstable (spinnig eyes thing)


#16

On thing more, on Mark1 there is a pi user, a mycroft user and root.
when I speak of ~/.mycroft/mycroft.conf I mean /home/mycroft/.mycroft/mycroft.conf, but perhaps I should create a /root/.mycroft/mycrof.conf or /home/pi/.mycroft/mycroft.conf, both non-existent.
That’s why before the doubt, I have been using /etc/mycroft/mycroft.conf, editing it as root, thinking that perhaps it would be global…
That’s right?


#17

configs are loaded by this order, each override the previous

DEFAULT_CONFIG = 'mycroft-core/mycroft/configuration/mycroft.conf’
SYSTEM_CONFIG = '/etc/mycroft/mycroft.conf’
USER_CONFIG = ‘~/.mycroft/mycroft.conf’)
REMOTE_CONFIG = “mycroft.ai”


#18

No way, if I put something else more than the “lang” parametert, then mark1 stops working (the damn spinning eyes… :cry:
I guess I’m doing something wrong, but I cannot see what is…

Could you please provide a working example (in pt-pt if just fine) for me to try to adapt it to spanish? Perhaps starting from a non-english working settings I can accomplish and see what I’m doing wrong faster than this… :bowing_man:


#19

@malevolent

Hello

I’m working on the french translation for mycroft-core and mycroft-skill.

Before working in mark1, the more easy is to working on Linux on your computer by compiling mycroft-core source code because adding a new language for mycroft is not easy.
I will update the wiki page https://github.com/MycroftAI/mycroft-core/wiki/Adding-a-new-language with steps by steps tasks when I will find a STT (Speech to text) software that works in local with french.
My goal is to have my mycroft mark 1 in french for christmas 2017.
And it will be not easy …


#20

i have no idea what is happening with the rollign eyes (dont have mark1)

you must either share logs for us to hunt the error or your config so we can help, there’s not much else i can show you… you probably are using invalid syntax in the config i assume, some missing , or using single quotes ’ instead of "