File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 2424import string
2525import sys
2626import unicodedata
27+ import warnings
2728from collections import defaultdict
2829from itertools import cycle
2930from pathlib import Path
@@ -291,6 +292,8 @@ def load_bigram_dictionary(
291292 """Loads multiple dictionary entries from a file of word/frequency count
292293 pairs.
293294
295+ **NOTE**: Frequency count should be an integer that fits within 64 bits.
296+
294297 **NOTE**: Merges with any dictionary data already loaded.
295298
296299 Args:
@@ -323,6 +326,8 @@ def load_dictionary(
323326 """Loads multiple dictionary entries from a file of word/frequency count
324327 pairs.
325328
329+ **NOTE**: Frequency count should be an integer that fits within 64 bits.
330+
326331 **NOTE**: Merges with any dictionary data already loaded.
327332
328333 Args:
@@ -1090,6 +1095,7 @@ def _load_bigram_dictionary_stream(
10901095 continue
10911096 count = helpers .try_parse_int64 (parts [count_index ])
10921097 if count is None :
1098+ warnings .warn ("Failed to parse frequency count as a 64 bit integer." )
10931099 continue
10941100 key = (
10951101 f"{ parts [term_index ]} { parts [term_index + 1 ]} "
@@ -1128,6 +1134,7 @@ def _load_dictionary_stream(
11281134 continue
11291135 count = helpers .try_parse_int64 (parts [count_index ])
11301136 if count is None :
1137+ warnings .warn ("Failed to parse frequency count as a 64 bit integer." )
11311138 continue
11321139 key = parts [term_index ]
11331140 self .create_dictionary_entry (key , count )
You can’t perform that action at this time.
0 commit comments