Skip to content

Commit 77975ee

Browse files
committed
bump version to 2.9.4
1 parent f394f57 commit 77975ee

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ If you want to apply a particular suggestion from a `Match`, use `Match.select_r
7171
'There is a book on the table.'
7272
```
7373

74+
### Determine whether a text is grammatically correct
75+
76+
If you want to determine whether a text is grammatically correct, you can use the `classify_matches` function from `language_tool_python.utils`. It will return a `TextStatus` enum value indicating whether the text is correct, faulty, or garbage. Here is an example:
77+
78+
```python
79+
>>> import language_tool_python
80+
>>> from language_tool_python.utils import classify_matches
81+
>>> tool = language_tool_python.LanguageTool('en-US')
82+
>>> matches = tool.check('This is a cat.')
83+
>>> matches_1 = tool.check('This is a cats.')
84+
>>> matches_2 = tool.check('fabafbafzabfabfz')
85+
>>> classify_matches(matches)
86+
<TextStatus.CORRECT: 'correct'>
87+
>>> classify_matches(matches_1)
88+
<TextStatus.FAULTY: 'faulty'>
89+
>>> classify_matches(matches_2)
90+
<TextStatus.GARBAGE: 'garbage'>
91+
```
92+
7493
## Example usage
7594

7695
From the interpreter:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "language_tool_python"
3-
version = "2.9.3"
3+
version = "2.9.4"
44
requires-python = ">=3.9"
55
description = "Checks grammar using LanguageTool."
66
readme = { file = "README.md", content-type = "text/markdown" }

0 commit comments

Comments
 (0)