The model corrects spelling errors and typos by bringing all the words in the text to the norm of the Russian language.
Corrector was trained based on the model
M2M100-1.2B.
An extensive dataset with “artificial” errors was taken as a training corpus: the corpus was assembled on the basis of the Russian-language Wikipedia and transcripts of Russian-language videos, then typos and spelling errors were automatically introduced into it using the library
SAGE.
The model is the fine-tuned version of the
pre-train.
Below are automatic metrics for determining the correctness of the spell checkers.
We compare our solution with both open automatic spell checkers and the ChatGPT family of models on all four available datasets:
1from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
2
3path_to_model = "ai-forever/sage-m2m100-1.2B"
4model = M2M100ForConditionalGeneration.from_pretrained(path_to_model)
5tokenizer = M2M100Tokenizer.from_pretrained(path_to_model, src_lang="ru", tgt_lang="ru")
6
7sentence = "прийдя в МГТУ я был удивлен никого необноружив там…"
8encodings = tokenizer(sentence, return_tensors="pt")
9generated_tokens = model.generate(
10 **encodings, forced_bos_token_id=tokenizer.get_lang_id("ru"))
11answer = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
12
13print(answer)
14#["прийдя в МГТУ я был удивлен никого не обнаружив там..."]
Model
M2M100-1.2B, on the basis of which our solution is made, and its source code are supplied under the MIT open license.
Our solution also comes with MIT license.