LocalSTT icon indicating copy to clipboard operation
LocalSTT copied to clipboard

more than one language

Open ippocratis opened this issue 2 years ago • 9 comments

So as naming is hardcoded I have to replace vosk model files inside vosk-catala folder. What if I need a second language? English and another?

ippocratis avatar Jul 30 '21 07:07 ippocratis

Regarding the model path, you can replace the name here.

In order to have two languages I guess the easiest way is to create two services. Just duplicate the VoskRecognitionService and rename it to something else. You also need to register it to handle intents here (create a new service entry). You'll need to switch everytime in your phone's preferences or as you're using K9nele I think it'll let you choose, right?

There is a way to get the language from the intent. I think it is the language of the keyboard but maybe it is just the language of the phone. If it were that of the keyboard you could use it to load one model or another.

Another alternative would be to show a list of available SpeechRecognizers in the SpeechActivity. You can pass a second parameter to SpeechRecognizer.createSpeechRecognizer (SpeechActivity.java#L110) defining the exact recognizer service to use (otherwise it uses the one you set as default).

I hope it helps. I might one day do this myself but I have no time right now.

ccoreilly avatar Jul 31 '21 05:07 ccoreilly

Thanks for pointing out I think I'll gonna try dublicating VoskRecognitionService kõnele lets you select on the popup voice input ''keyboard" yes The thing is I have zero experience with android studio but I hope its not gonna be that hard Thanks for your amazing app btw Its the only reliable solution to have an open source speech to text service on a degoogled device atm

ippocratis avatar Jul 31 '21 08:07 ippocratis

can not build

''' Could not GET 'https://dl.bintray.com/alphacep/vosk/com/alphacep/vosk-android/0.3.15/vosk-android-0.3.15.pom'. Received status code 403 from server: Forbidden Disable Gradle 'offline mode' and sync project '''

toggling gradle offline mode syncs but throws error ''' No cached version of com.alphacep:vosk-android:0.3.15 available for offline mode. '''

looks like bintray and jcenter is shuting down https://stackoverflow.com/a/67804820 so i cant see how i can move forward

maybe open an issue on vosk git? thanks

ippocratis avatar Aug 02 '21 09:08 ippocratis

Mmm true. They moved it to their own maven repository but version 0.3.15 is no longer available and the API changed a bit. I'll have a look see if I can update the repository to a state that builds.

ccoreilly avatar Aug 02 '21 20:08 ccoreilly

Thanks

ippocratis avatar Aug 03 '21 12:08 ippocratis

I pushed a new commit with the necessary changes and checked that it builds and works on Android 9. Let me know if you manage to build with your changes!

ccoreilly avatar Aug 03 '21 19:08 ccoreilly

thanks again app is buildable now i compiled an english apk the vosk model for my language is 1gb thou and when i try to build with two languages i get error "Out of memory: Required array size too large. Please fix the project's Gradle settings." i'll try to fix that , i'll search a bit btw app stand alone still stays in loading condition but works great used in konele thanks again and take care

ippocratis avatar Aug 04 '21 18:08 ippocratis

Great to here that. May I ask what OS and version you're running? Does it stay in the loading status if you for example click on the mic icon of your keyboard?

ccoreilly avatar Aug 04 '21 19:08 ccoreilly

Great to here that. May I ask what OS and version you're running? Does it stay in the loading status if you for example click on the mic icon of your keyboard?

on a redmi note 9s with arrow os with microg (custom rom) on it (android11) and it behaves the same either by the anysoft keyboard mic or the localstt app it self

logcat_08-04-2021_23-13-21.txt

i cant figure out anything out of the logcat

" Waiting to send key to Window{ecd0591 u0 cat.oreilly.localstt/cat.oreilly.localstt.SpeechActivity} because there are unprocessed events that may cause focus to change "

sounds relative but no idea what it may mean

ippocratis avatar Aug 04 '21 20:08 ippocratis