We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 908a11c commit dd31d9bCopy full SHA for dd31d9b
1 file changed
language_tool_python/utils.py
@@ -112,7 +112,7 @@ def correct(text: str, matches: List[Match]) -> str:
112
:rtype: str
113
"""
114
ltext = list(text)
115
- if len(matches):
+ if len(matches): # some suggestions available, we'll use first/best
116
matches = [match for match in matches if match.replacements]
117
if matches:
118
errors = [ltext[match.offset:match.offset + match.errorLength]
@@ -127,9 +127,9 @@ def correct(text: str, matches: List[Match]) -> str:
127
ltext[frompos:topos] = list(repl)
128
correct_offset += len(repl) - len(errors[n])
129
return ''.join(ltext)
130
- else:
+ else: # no suggestions for given language, i.e. gibberish submit
131
return str()
132
+ else: # Correct string submit
133
return None
134
135
0 commit comments