11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
+
|
from ..graphspell.spellchecker import SpellChecker
from ..graphspell.echo import echo
from .. import text
from . import gc_functions
from . import gc_options
from . import phonet
try:
# LibreOffice / OpenOffice
from com.sun.star.linguistic2 import SingleProofreadingError
from com.sun.star.text.TextMarkupType import PROOFREADING
from com.sun.star.beans import PropertyValue
#import lightproof_handler_${implname} as opt
|
457
458
459
460
461
462
463
464
465
466
467
468
469
470
|
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
if "<lemmas>" in dNode:
for sLemma in _oSpellChecker.getLemma(dToken["sValue"]):
if sLemma in dNode["<lemmas>"]:
if bDebug:
echo(" MATCH: >" + sLemma)
yield { "iToken1": iToken1, "iNode": dNode["<lemmas>"][sLemma] }
bTokenFound = True
# phonetic similarity
if "<phonet>" in dNode:
for sPhonet in dNode["<phonet>"]:
if sPhonet.endswith("!"):
sPhon = sPhonet[0:-1]
if dToken["sValue"] == sPhon:
continue
if dToken["sValue"][0:1].isupper():
if dToken["sValue"].lower() == sPhon:
continue
if dToken["sValue"].isupper() and dToken["sValue"].capitalize() == sPhon:
continue
if phonet.isSimilAs(dToken["sValue"], sPhonet.rstrip("!")):
if bDebug:
echo(" MATCH: %" + sPhonet)
yield { "iToken1": iToken1, "iNode": dNode["<phonet>"][sPhonet] }
bTokenFound = True
# morph arcs
if "<morph>" in dNode:
lMorph = dToken.get("lMorph", _oSpellChecker.getMorph(dToken["sValue"]))
if lMorph:
for sSearch in dNode["<morph>"]:
if "¬" not in sSearch:
# no anti-pattern
|