Skip to content

Commit 1515e28

Browse files
Peter JohnsonPeter Johnson
authored andcommitted
fix: shannon words
1 parent b08dbbf commit 1515e28

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

evaluation_function/models/shannon_words_ngram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
A simple n-gram (word) Shannon-style language model with add-one smoothing.
33
"""
4-
import lmdb, pickle, json, os, random
4+
import lmdb, pickle, json, os, random, traceback
55
from pathlib import Path
66
from io import StringIO
77
from lf_toolkit.evaluation import Result, Params
@@ -34,7 +34,7 @@ def normalize_context(ctx, n):
3434
def query_sharded(n, context):
3535
"""Query the sharded LMDB for the given n-gram context. Returns counts dict or None."""
3636
context = normalize_context(context, n)
37-
n_dir = BASE_DIR / f"ngrams_{n}"
37+
n_dir = MODEL_DIR / f"ngrams_{n}"
3838
with open(n_dir / "index.json") as f:
3939
index = json.load(f)
4040
shard = shard_for(tuple(context), len(index))

0 commit comments

Comments
 (0)