Differences From Artifact [b9b88866b3]:
- File grammalecte-cli.py — part of check-in [8012c45f37] at 2019-05-25 06:53:17 on branch trunk — [py][core] new parser, [cli] update command list and rename some commands (user: olr, size: 12708) [annotate] [blame] [check-ins using]
To Artifact [03fd556d3c]:
- File grammalecte-cli.py — part of check-in [4e38c87cf8] at 2019-05-25 10:20:32 on branch trunk — [cli] new command: @@ for full analysis (user: olr, size: 13853) [annotate] [blame] [check-ins using]
| ︙ | |||
256 257 258 259 260 261 262 263 264 265 266 267 268 269 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | + + + + + + + + + + + + + |
sFilter = sText[sText.find(" "):].strip() if " " in sText else None
oGrammarChecker.gce.displayRules(sFilter)
elif sText in ("/quit", "/q"):
break
elif sText.startswith("/rl"):
# reload (todo)
pass
elif sText.startswith("@@"):
for sParagraph in txt.getParagraph(sText):
if xArgs.textformatter:
sText = oTextFormatter.formatText(sParagraph)
for dSentence in oGrammarChecker.gce.parse(sText[2:], bDebug=xArgs.debug, bFullInfo=True):
echo("{nStart}:{nEnd}".format(**dSentence))
echo(" <" + dSentence["sSentence"]+">")
for dToken in dSentence["lToken"]:
print(" {0[nStart]:>3}:{0[nEnd]:<3} {1} {0[sType]:<14} {0[sValue]:<16} {2:<10} {3}".format(dToken, \
"×" if dToken.get("bToRemove", False) else " ",
" ".join(dToken.get("lMorph", "")), \
"·".join(dToken.get("aTags", "")) ) )
#print(dToken)
else:
for sParagraph in txt.getParagraph(sText):
if xArgs.textformatter:
sText = oTextFormatter.formatText(sParagraph)
sRes = oGrammarChecker.generateParagraph(sParagraph, bEmptyIfNoErrors=xArgs.only_when_errors, nWidth=xArgs.width, bDebug=xArgs.debug)
if sRes:
echo("\n" + sRes)
|
| ︙ |