Punctuator
A service that automatically adds punctuation and casing to raw word-stream (eg. from speech2text) for polish, russian and english language.
Example input:
według webometrycznego rankingu uniwersytetów świata ze stycznia 2019 pokazującego zaangażowanie instytucji akademickich w internecie uczelnia zajmuje 5 miejsce w polsce wśród uczelni technicznych a na świecie 964 wśród wszystkich typów uczelni w rankingu szkół wyższych perspektyw politechnika wrocławska zajęła w 2019 roku 3 miejsce wśród uczelni technicznych oraz 6 miejsce spośród wszystkich uczelni akademickich w polsce
Output:
Według webometrycznego rankingu uniwersytetów świata ze stycznia 2019, pokazującego zaangażowanie instytucji akademickich w Internecie, uczelnia zajmuje 5. miejsce w Polsce wśród uczelni technicznych, a na świecie 964. Wśród wszystkich typów uczelni w rankingu szkół wyższych perspektyw Politechnika Wrocławska zajęła w 2019 roku 3. miejsce wśród uczelni technicznych oraz 6. miejsce spośród wszystkich uczelni akademickich w Polsce
Config
[deployment]
model_path_pl = /home/worker/model/punctuator_pl ; Path where the polish model is located
model_path_en = /home/worker/model/punctuator_en ; Path where the english model is located
model_path_ru = /home/worker/model/punctuator_ru ; Path where the russian model is located
languagetool_path = /home/worker/model/languagetool ; Path where languagetool server will be placed
max_context_size = 256 ; Number of tokens that will be oonsidered in prediciton at once. Must be between in range 2*overlap+1 to 512
overlap = 20 ; The number of tokens from the environment that will be taken at inference for a text fragment
device = cpu ; Device on which inference will be made (eg. cpu, cuda:0 etc)
LPMN
Punctuator have one optional argument language
with options: pl
ru
en
(defaults to pl):
filedir(/users/michal.pogoda)|any2txt|punctuator({"language":"pl"})
Mountpoints
If you want to cache the models, you need to mount the directory of /home/worker/models/
. Also, samba needs to be mounted as /samba
Pushing models into production
Production models should be placed in models directory. Then, to push them into production all you need to do is to run sync_to_s3.sh
script
./sync_to_s3.sh
Testing
There are example texts in the example_texts
directory. You can run punctuator, to predicth on those texts to see how well it is working for all available languages.
docker build . -t punctuator
docker run -it \
-v $(pwd)/example_texts:/test \
-v $(pwd)/data/models:/home/worker/models \
-v $(pwd)/data/lt:/home/worker/languagetool \
punctuator
--test