Skip to content
Snippets Groups Projects

Support for russian and english models

Merged Michał Pogoda requested to merge en-ru-support into master
All threads resolved!
Viewing commit 6c7d5b93
Show latest version
1 file
+ 4
2
Compare changes
  • Side-by-side
  • Inline
+ 4
2
@@ -27,7 +27,8 @@ def _post_process(text: str, url: str):
for match in resp.json()['matches']:
if match['rule']['category']['id'] == 'PUNCTUATION':
if len(match['replacements']) > 0:
text = text.replace(text[match['offset']:match['offset']+match['length']], match['replacements'][0]['value'])
text = text.replace(text[match['offset']:match['offset']+match['length']],
match['replacements'][0]['value'])
return text
class Worker(nlp_ws.NLPWorker):
@@ -40,7 +41,8 @@ class Worker(nlp_ws.NLPWorker):
self.overlap = int(self.config["overlap"])
self.device = self.config["device"]
self.languagetool_url = "http://languagetool:{}/v2/check".format(self.config["languagetool_port"])
self.languagetool_url = "http://languagetool:{}/v2/check".format(
self.config["languagetool_port"])
model_path = self.config["model_path"]
self.model = AutoModelForTokenClassification.from_pretrained(