Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Conversation

@Teagan42
Copy link
Contributor

@Teagan42 Teagan42 commented Jul 4, 2017

Finish #440

Can someone with Kaldi please verify - I had to wipe my server the other day and haven't stood kaldi back up.

@augustnmonteiro augustnmonteiro self-requested a review July 5, 2017 14:00
@augustnmonteiro augustnmonteiro added the Status: To be reviewed Concept accepted and PR has sufficient information for full review label Jul 5, 2017
def execute(self, audio, language=None):
language = language or self.lang
config = ConfigurationManager.get().get("stt", {})
response = requests.post(self.config.get("uri"), data=audio.get_wav_data())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you split this line, is more than 80 columns it brokes pep8, thank you

@forslund
Copy link
Collaborator

forslund commented Jul 5, 2017

I'm currently building Kaldi to give this a try. but it seems to take forever! If someone with an existing install would like to test this my struggling CPU would be happy =)

def execute(self, audio, language=None):
language = language or self.lang
config = ConfigurationManager.get().get("stt", {})
response = requests.post(self.config.get("uri"), data=audio.get_wav_data())
Copy link
Collaborator

@forslund forslund Jul 5, 2017

Choose a reason for hiding this comment

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

also: the module requests need to be imported at the top of the file and I think you want to use the config variable you created above instead of self.config.

You can do

from requests import post

And then shorten this line by just making it
response = post(config.get("uri"), data=audio.get_wav_data())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, yup and yup.

@augustnmonteiro
Copy link
Contributor

augustnmonteiro commented Jul 5, 2017

@forslund mine just finished to compile, I'm downloading the models to run, but yeah, takes a lot of time

language = language or self.lang
config = ConfigurationManager.get().get("stt", {})
response = requests.post(self.config.get("uri"), data=audio.get_wav_data())
return get_response(response)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be

        return self.get_response(response)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Context switching between python for some side projects and Java for work - my bad. addressed.

response = requests.post(self.config.get("uri"), data=audio.get_wav_data())
return get_response(response)

def get_response(response):
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be

    def get_response(self, response):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed.

Copy link
Collaborator

@forslund forslund left a comment

Choose a reason for hiding this comment

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

A big thank you for contributing this. There are a couple of minor issues, but over all the code looks solid. Looking forward to getting this merged =)

@Teagan42
Copy link
Contributor Author

Teagan42 commented Jul 5, 2017

Sorry about that - wrote it real quick and didn't have a mycroft instance to test it against, in the middle of rebuilding some servers at home. Please check the latest commit

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.008%) to 40.092% when pulling 5d1cb4d on Teagan42:kaldi-stt into b5fc8bd on MycroftAI:dev.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.008%) to 40.092% when pulling 5d1cb4d on Teagan42:kaldi-stt into b5fc8bd on MycroftAI:dev.

@audunmg
Copy link

audunmg commented Jul 5, 2017

Great, it works for me with my kaldi setup!

May I suggest altering the comments in mycroft/configuration/mycroft.conf?
Specifically around 156:

// Speech to Text parameters
// Override: REMOTE
"stt": {
// Engine. Options: "mycroft", "google", "wit", "ibm"
"module": "mycroft"
},

to something like
// Speech to Text parameters
// Override: REMOTE
"stt": {
// Engine. Options: "mycroft", "google", "wit", "ibm", "kaldi"
"module": "mycroft"
// URI required for kaldi
// "uri": "http://localhost:8080/client/dynamic/recognize"
},

@forslund
Copy link
Collaborator

forslund commented Jul 5, 2017

Looking at the base class the config should really be something like

"stt": {
  "module": "kaldi",
  "kaldi": {
    "uri": "http://localhost"
  }
}

using this setup, self.config (which gets mapped to stt['kaldi']) can be used instead of the local variable that's created.

This is the format used by the other STT backends that need extra parameters.

@Teagan42
Copy link
Contributor Author

Teagan42 commented Jul 5, 2017

@forslund addressed. You're right, I should have looked at the base class more carefully

@coveralls
Copy link

coveralls commented Jul 5, 2017

Coverage Status

Coverage decreased (-0.5%) to 39.565% when pulling e0a8866 on Teagan42:kaldi-stt into b5fc8bd on MycroftAI:dev.

@forslund
Copy link
Collaborator

forslund commented Jul 5, 2017

Nice! Thank you!

@audunmg
Copy link

audunmg commented Jul 5, 2017

I checked out again, and still works nicely on my desktop.
Thank you!

@Teagan42
Copy link
Contributor Author

Can we get this merged up?

@augustnmonteiro augustnmonteiro removed the Status: To be reviewed Concept accepted and PR has sufficient information for full review label Jul 13, 2017
@augustnmonteiro
Copy link
Contributor

@Teagan42 thank you!!!

@augustnmonteiro augustnmonteiro merged commit a5d349a into MycroftAI:dev Jul 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants