Created
July 12, 2025 08:28
-
-
Save quicksilver0/efbe59c4ee9e2a324033141257e69578 to your computer and use it in GitHub Desktop.
Check for grammatical, style and spelling errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Поддерживает русский язык, находит грамматические, стилистические и орфографические ошибки. | |
pip install language-tool-python | |
import language_tool_python | |
# Создаём инструмент для русского языка | |
tool = language_tool_python.LanguageTool('ru-RU') | |
text = "Он пошол в школу. Я будеть дома." | |
# Получаем ошибки | |
matches = tool.check(text) | |
# Печатаем найденные ошибки | |
for match in matches: | |
print(f"Ошибка: {match.message}") | |
print(f"Текст: {text[match.offset:match.offset + match.errorLength]}") | |
print(f"Предложение: {match.replacements}\n") | |
# Output | |
# Ошибка: Возможная орфографическая ошибка | |
# Текст: пошол | |
# Предложение: ['пошёл'] | |
# Ошибка: Глагол "будеть" не существует | |
# Текст: будеть | |
# Предложение: ['будет', 'будьте'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment