vosk-android-demo icon indicating copy to clipboard operation
vosk-android-demo copied to clipboard

How to switch the recognized language?

Open cl-6666 opened this issue 3 years ago • 9 comments

Hello, I have a problem. I don’t know how to switch languages. I’ve tested the English and the effect is okay. I want to try Chinese. How do I do it?

cl-6666 avatar Feb 23 '21 10:02 cl-6666

Download

https://alphacephei.com/vosk/models/vosk-model-small-cn-0.3.zip

unpack over English files:

https://github.com/alphacep/vosk-android-demo/tree/master/models/src/main/assets/sync/model-android

modify grammar here and run:

https://github.com/alphacep/vosk-android-demo/blob/1725bde253128641e544471f875cf736474ee0a1/app/src/main/java/org/kaldi/demo/KaldiActivity.java#L143

it should work

nshmyrev avatar Feb 23 '21 10:02 nshmyrev

Thank you. For such a problem, I want to automatically switch the national language in the APP to avoid replacing the model every time. I want to put the prepared model in the project in advance. Is there a good way to generate the so library for the model? Is form dependent?

cl-6666 avatar Feb 24 '21 01:02 cl-6666

If you want to support 2 languages inside the app you need 100 mb in the app. Not nice.

You can implement model download from the internet so users can pick the language.

nshmyrev avatar Feb 24 '21 01:02 nshmyrev

see https://github.com/alphacep/vosk-android-demo/issues/54#issuecomment-851030622

k3b avatar May 30 '21 17:05 k3b

@cl-6666 I have written an example of how to switch the language on the fly when a button is pressed. See https://github.com/r-bird/vosk-android-demo/tree/multi_lang.

In this case the second language is German, but you should be able to adjust it to Chinese with little effort. Just:

The example is designed to work completely offline, so every language you add requires approx. 50 MB.

r-bird avatar Aug 31 '21 13:08 r-bird

Can someone explain me what's the problem with 50mb in a app. A game takes over 4gb. With that in mind, does a bigger module work, like a 2gb? Is the problem the space it takes or the computing power for it?

DeveloKing avatar Oct 22 '21 07:10 DeveloKing

I want to do a speech recognition app so the capability to recognize is above the space needed by the app

DeveloKing avatar Oct 22 '21 07:10 DeveloKing

Can someone explain me what's the problem with 50mb in a app. A game takes over 4gb.

There is no big problem, just take in account that bigger models are usually slower and might not run on android phone. Also, its not so nice to download say 300Mb just for voice input.

nshmyrev avatar Oct 22 '21 08:10 nshmyrev

There is no big problem, just take in account that bigger models are usually slower and might not run on android phone. Also, its not so nice to download say 300Mb just for voice input.

@nshmyrev I definitely can understand this. Do you suggest a proper way to handle voice triggers with kaldi and vosk + online model stored? I am thinking of working on something like this, I was able to achieve it offline but was wondering if it could happen online that would help users a lot. Thanks

cdhiraj40 avatar Mar 19 '22 16:03 cdhiraj40