73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
if not os.path.exists(spfParsingTest):
print(f"No file <gc_test.txt> in <{spHere}>")
return
with open(spfParsingTest, "r", encoding="utf-8") as hSrc:
nUnexpectedErrors = 0
nTestWithExpectedError = 0
nTestWithExpectedErrorAndSugg = 0
for i, sLine in enumerate( s for s in hSrc if not s.startswith("#") and s.strip() ):
sLineNum = sLine[:10].strip()
sLine = sLine[10:].strip()
sOption = None
m = zOption.search(sLine)
if m:
sLine = sLine[m.end():]
sOption = m.group(1)
|
|
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
if not os.path.exists(spfParsingTest):
print(f"No file <gc_test.txt> in <{spHere}>")
return
with open(spfParsingTest, "r", encoding="utf-8") as hSrc:
nUnexpectedErrors = 0
nTestWithExpectedError = 0
nTestWithExpectedErrorAndSugg = 0
for sLine in ( s for s in hSrc if not s.startswith("#") and s.strip() ):
sLineNum = sLine[:10].strip()
sLine = sLine[10:].strip()
sOption = None
m = zOption.search(sLine)
if m:
sLine = sLine[m.end():]
sOption = m.group(1)
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
lFoundSuggs = sFoundSuggs.split("|")
if len(lExpectedSuggs) != len(lFoundSuggs) or set(lExpectedSuggs) != set(lFoundSuggs):
return False
return True
def purgeMessage (sMessage):
for sToReplace, sReplacement in [
("l’ ", "l’"), ("d’ ", "d’"), ("n’ ", "n’"), ("j’ ", "j’"), ("m’ ", "m’"), ("t’ ", "t’"), ("s’ ", "s’"), ("qu’ ", "qu’"),
("L’ ", "L’"), ("D’ ", "D’"), ("N’ ", "N’"), ("J’ ", "J’"), ("M’ ", "M’"), ("T’ ", "T’"), ("S’ ", "S’"), ("QU’ ", "QU’")
]:
sMessage = sMessage.replace(sToReplace, sReplacement)
return sMessage
|
>
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
lFoundSuggs = sFoundSuggs.split("|")
if len(lExpectedSuggs) != len(lFoundSuggs) or set(lExpectedSuggs) != set(lFoundSuggs):
return False
return True
def purgeMessage (sMessage):
"remove space after elided French words"
for sToReplace, sReplacement in [
("l’ ", "l’"), ("d’ ", "d’"), ("n’ ", "n’"), ("j’ ", "j’"), ("m’ ", "m’"), ("t’ ", "t’"), ("s’ ", "s’"), ("qu’ ", "qu’"),
("L’ ", "L’"), ("D’ ", "D’"), ("N’ ", "N’"), ("J’ ", "J’"), ("M’ ", "M’"), ("T’ ", "T’"), ("S’ ", "S’"), ("QU’ ", "QU’")
]:
sMessage = sMessage.replace(sToReplace, sReplacement)
return sMessage
|