Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: allow custom STT engines as plug-ins #612 #614

Closed

Conversation

SoloVeniaASaludar
Copy link
Contributor

Allow custom STT engines as plug-ins.

See #612 for details

@clusterfudge
Copy link
Contributor

I might recommend something like the following:

class STTFactory(object):
    CLASSES = {
        "mycroft": MycroftSTT,
        "google": GoogleSTT,
        "wit": WITSTT,
        "ibm": IBMSTT
    }

    @staticmethod
    def register_stt(name, engine_class):
        # assert api signature
        # ...
        CLASSESS.put(name, engine_class)

    @staticmethod
    def create():
        config = ConfigurationManager.get().get("stt", {})
        module = config.get("module", "mycroft")
        clazz = STTFactory.CLASSES.get(module)
        return clazz()

And then we can avoid importlib, and the convention of splitting config strings to try to construct plugins.

@SoloVeniaASaludar
Copy link
Contributor Author

Thanks for the comment.

Who will call "register_stt" ?

@clusterfudge
Copy link
Contributor

I see the meat of your question :). I'm assuming you want something that's entirely config driven, as opposed to something that requires writing code to inject. I don't think there's a precedent for that in mycroft (aside from skills), so someone from the core team may want to chime in on what direction they see that going.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants