Skip to content

Commit e03017c

Browse files
committed
Fix apertium#62 by splitting analyzed text at 'middle' forward slash instead of
at the first forward slash.
1 parent b97c35b commit e03017c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def getCoverages(text, modes, penalize=False):
121121
def getCoverage(text, mode, modeDir, penalize=False):
122122
analysis = apertium(text, mode, modeDir)
123123
lexicalUnits = removeDotFromDeformat(text, re.findall(r'\^([^\$]*)\$([^\^]*)', analysis))
124-
analyzedLexicalUnits = list(filter(lambda x: not x[0].split('/')[1][0] in '*&#', lexicalUnits))
124+
analyzedLexicalUnits = list(filter(lambda x: not x[0].split('/')[(x[0].count('/') + 1) // 2][0] in '*&#', lexicalUnits))
125125
if len(lexicalUnits) and not penalize:
126126
return len(analyzedLexicalUnits) / len(lexicalUnits)
127127
elif len(lexicalUnits) and len(text) and penalize:

0 commit comments

Comments
 (0)