Skip to content

Commit

Permalink
Fixes as per code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinbjornt committed Aug 28, 2024
1 parent b163751 commit 182768c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/icegrams/ngrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

# Import the CFFI wrapper for the trie.cpp C++ module
# (see also trie.py and build_trie.py)
elif __name__ == "__main__":
if __name__ == "__main__":
# Running as a main program
from _trie import lib as trie_cffi, ffi # type: ignore # pylint: disable=import-error
from trie import Trie
Expand All @@ -157,7 +157,7 @@
# unpacked and ready for use
import importlib.resources as importlib_resources

ref = importlib_resources.files("icegrams").joinpath("resources/trigrams.bin")
ref = importlib_resources.files("icegrams").joinpath("resources", "trigrams.bin")
BINARY_FILENAME = str(ref)

ffi: Any = cast(Any, ffi) # type: ignore
Expand Down Expand Up @@ -865,8 +865,8 @@ def bigram_frequency(self, i0: Optional[int], i1: Optional[int]) -> int:
if i0 is None or i1 is None:
return 0
# Check degenerate case
# if not (i0 or i1):
# return 0
if not (i0 or i1):
return 0
assert self._unigram_ptrs_ml is not None
p1, p2 = self._unigram_ptrs_ml.lookup_pair(i0)
# Then, look for id i1 within the level 2 ids delimited by [p1, p2>
Expand Down

0 comments on commit 182768c

Please sign in to comment.