From 5f7ea84b7bda37cd4d2ce7fbd24a98a23e7f4cd8 Mon Sep 17 00:00:00 2001 From: Vilhjalmur Thorsteinsson Date: Mon, 25 Mar 2019 15:40:19 +0000 Subject: [PATCH] Modified spelling.py again to be compatible with Python 3.4 --- src/reynir_correct/spelling.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reynir_correct/spelling.py b/src/reynir_correct/spelling.py index 2f95d01..255aa97 100755 --- a/src/reynir_correct/spelling.py +++ b/src/reynir_correct/spelling.py @@ -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:]