alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.85k stars 1.1k forks source link

Text punctuation support #152

Open marlon-br opened 4 years ago

marlon-br commented 4 years ago

Hello, Do you know if the solution supports text punctuation or how to add this functionality?

nshmyrev commented 4 years ago

You can use external tools like https://github.com/ottokart/punctuator2 or https://github.com/kaituoxu/X-Punctuator

marlon-br commented 4 years ago

thanks, so Vosk itself does not support punctuation?

nshmyrev commented 4 years ago

No, not yet.

marlon-br commented 4 years ago

ok. i see. thanks

nshmyrev commented 2 years ago

Latest recommendation is https://github.com/benob/recasepunc

We don't plan to have it immediately, maybe, some time in the future.

nshmyrev commented 2 years ago

Btw, we have released some punctuation models, links are in https://alphacephei.com/vosk/models

ican24 commented 2 years ago

Latest recommendation is https://github.com/benob/recasepunc

We don't plan to have it immediately, maybe, some time in the future.

Good Afternoon Dear @nshmyrev, I see you developed 2 customized models for Russian and German languages using https://github.com/benob/recasepunc Could you tell me short hints how may I add text punctuation support of my language in recasepunc? Thank you in advance!

P.S. The solution is here https://github.com/benob/recasepunc/issues/6

szeidner commented 2 years ago

Btw, we have released some punctuation models, links are in https://alphacephei.com/vosk/models

This is so great! I was curious...are there plans / is it even possible to release a small model version with punctuation?

nshmyrev commented 2 years ago

@szeidner

This is so great! I was curious...are there plans / is it even possible to release a small model version with punctuation?

Thats actually a big research question. BERT and alike models are accurate, but they are not easy to compress to a small size. Things like distillbert are much less accurate for practical applications. Another approach to punctuation prediction is required. Distillation somewhat works, but not easy.

base21 commented 2 years ago

@nshmyrev could you give an example on how to use the punctuation model? Might be doing something completely wrong but I get an error while passing this model instead of the en-us model - Folder 'model' does not contain model files. Make sure you specified the model path properly in Model constructor. If you are not sure about relative path, use absolute path specification.

bvasoff commented 2 years ago

@nshmyrev could you give an example on how to use the punctuation model? Might be doing something completely wrong but I get an error while passing this model instead of the en-us model - Folder 'model' does not contain model files. Make sure you specified the model path properly in Model constructor. If you are not sure about relative path, use absolute path specification.

I see the same thing here - that link looks like a self contained recasepunc model, was that the intention? It isn't a drop in replacement for other vosk models right? It would be pretty great if that could work!

AnkS4 commented 2 years ago

@nshmyrev could you give an example on how to use the punctuation model? Might be doing something completely wrong but I get an error while passing this model instead of the en-us model - Folder 'model' does not contain model files. Make sure you specified the model path properly in Model constructor. If you are not sure about relative path, use absolute path specification.

@nshmyrev I have the same question. Could you please give the steps/example?

szeidner commented 2 years ago

It looks like those punctuation models are for use with recasepunc (not Vosk), so you would have to use it as the checkpoint file. Something like:

python recasepunc.py predict checkpoint/path_to_checkpoint_model < input.txt > output.txt
CoffeePerry commented 2 years ago

Hello, is the generation of a model with Italian punctuation planned? The Italian model available at the link works very well, but all transcriptions are lowercase and without punctuation.

nshmyrev commented 2 years ago

Hello, is the generation of a model with Italian punctuation planned?

You can easily train it yourself probably with recasepunc

CoffeePerry commented 2 years ago

I proceeded to train an Italian model of recasepunc. Is there a way to train an Italian model of Vosk (for example this) on the basis of that of recasepunc?

nshmyrev commented 2 years ago

I don't understand "train on the basis"

CoffeePerry commented 2 years ago

Sorry, I meant to understand how I could combine a Vosk model with the recasepunc model (as I think you have been done with this).

nshmyrev commented 2 years ago

You just feed recognized text into punctuation model and get punctuated text.

CoffeePerry commented 2 years ago

I apologize again. For a moment I assumed that models like this were a Vosk model (like this) which also recognized punctuation (without dependencies on recasepunc), but after downloading it (vosk-recasepunc-en-0.22.zip) and consulting the content, I realized that it is just as you tell me: the text is simply transcribed with the Vosk model then punctuation is added with the recasepunc model. Thanks for your patience.

silvioprog commented 6 months ago

Latest recommendation is https://github.com/benob/recasepunc

@nshmyrev just curiosity, do you have more recommendations? (especially in C/C++)

(the last update in this repo was 2y ago 😕)