21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
_HELP = """
/help /h show this text
?word1 [word2] ... words analysis
!word suggestion
>word draw path of word in the word graph
=filter show all entries whose morphology fits to filter
/lopt /lo list options
/+ option1 [option2] ... activate grammar checking options
/- option1 [option2] ... deactivate grammar checking options
/lrules [pattern] /lr list rules
/--rule1 [rule2] ... deactivate grammar checking rule
/++rule1 [rule2] ... reactivate grammar checking rule
/quit /q exit
"""
def _getText (sInputText):
sText = input(sInputText)
if sText == "*":
|
<
<
>
>
|
|
>
>
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
_HELP = """
/help /h show this text
?word1 [word2] ... words analysis
!word suggestion
>word draw path of word in the word graph
=filter show all entries whose morphology fits to filter
/lopt /lo list options
/lrules [pattern] /lr list rules
/o+ option1 [option2] ... activate grammar checking options
/o- option1 [option2] ... deactivate grammar checking options
/r+ rule1 [rule2] ... reactivate grammar checking rule
/r- rule1 [rule2] ... deactivate grammar checking rule
/textformatter /tf switch on/off the text formatter
/debug /d switch on/off the debug mode
/quit /q exit
"""
def _getText (sInputText):
sText = input(sInputText)
if sText == "*":
|
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
sFlexPattern = sSearch[0:nCut]
sTagsPattern = sSearch[nCut+1:]
else:
sFlexPattern = sSearch
sTagsPattern = ""
for aRes in oSpellChecker.select(sFlexPattern, sTagsPattern):
echo("\t".join(aRes))
elif sText.startswith("/+ "):
oGrammarChecker.gce.setOptions({ opt:True for opt in sText[3:].strip().split() if opt in oGrammarChecker.gce.getOptions() })
echo("done")
elif sText.startswith("/- "):
oGrammarChecker.gce.setOptions({ opt:False for opt in sText[3:].strip().split() if opt in oGrammarChecker.gce.getOptions() })
echo("done")
elif sText.startswith("/-- "):
for sRule in sText[3:].strip().split():
oGrammarChecker.gce.ignoreRule(sRule)
echo("done")
elif sText.startswith("/++ "):
for sRule in sText[3:].strip().split():
oGrammarChecker.gce.reactivateRule(sRule)
echo("done")
elif sText in ("/debug", "/d"):
xArgs.debug = not xArgs.debug
echo("debug mode on" if xArgs.debug else "debug mode off")
elif sText in ("/textformatter", "/tf"):
|
|
|
|
|
|
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
sFlexPattern = sSearch[0:nCut]
sTagsPattern = sSearch[nCut+1:]
else:
sFlexPattern = sSearch
sTagsPattern = ""
for aRes in oSpellChecker.select(sFlexPattern, sTagsPattern):
echo("\t".join(aRes))
elif sText.startswith("/o+ "):
oGrammarChecker.gce.setOptions({ opt:True for opt in sText[3:].strip().split() if opt in oGrammarChecker.gce.getOptions() })
echo("done")
elif sText.startswith("/o- "):
oGrammarChecker.gce.setOptions({ opt:False for opt in sText[3:].strip().split() if opt in oGrammarChecker.gce.getOptions() })
echo("done")
elif sText.startswith("/r- "):
for sRule in sText[3:].strip().split():
oGrammarChecker.gce.ignoreRule(sRule)
echo("done")
elif sText.startswith("/r+ "):
for sRule in sText[3:].strip().split():
oGrammarChecker.gce.reactivateRule(sRule)
echo("done")
elif sText in ("/debug", "/d"):
xArgs.debug = not xArgs.debug
echo("debug mode on" if xArgs.debug else "debug mode off")
elif sText in ("/textformatter", "/tf"):
|