Skip to content

Commit

Permalink
Modified spelling.py again to be compatible with Python 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
vthorsteinsson committed Mar 25, 2019
1 parent 951e5c0 commit 5f7ea84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/reynir_correct/spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,11 @@ def stupid_backoff(w):
# multiplied with the current lambda (backoff) factor
return logprob(w) + lamb
# !!! TODO: Optimize the following
fq = freq(*ctx, w)
fq = freq(*(tuple(ctx) + (w,)))
if fq > 1:
# We have a meaningful frequency here:
# return the logprob multiplied with the current lambda
return logprob(*ctx, w) + lamb
return logprob(*(tuple(ctx) + (w,))) + lamb
# Zero count: back off to a simpler context
# and use the 'stupid backoff' to reduce the probability
ctx = ctx[1:]
Expand Down

0 comments on commit 5f7ea84

Please sign in to comment.