Skip to content

Commit

Permalink
Fix Issue plasticityai#38
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayP13 committed Nov 25, 2018
1 parent 5133197 commit b4c2da0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pymagnitude/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class Magnitude(object):
OOV_RNG_LOCK = threading.Lock()
SQLITE_MAX_VARIABLE_NUMBER = max(max((_sqlite_try_max_variable_number(n)
for n in [99, 999, 9999, 99999])), 1)
MAX_KEY_LENGTH_FOR_STEM = 150
MAX_KEY_LENGTH_FOR_OOV_SIM = 1000
ENGLISH_PREFIXES = ['counter', 'electro', 'circum', 'contra', 'contro',
'crypto', 'deuter', 'franco', 'hetero', 'megalo',
Expand Down Expand Up @@ -718,8 +719,9 @@ def _oov_english_stem_english_ixes(self, key):

def _oov_stem(self, key):
"""Strips away common prefixes and suffixes."""
if self.language == 'en':
return self._oov_english_stem_english_ixes(key)
if len(key) <= Magnitude.MAX_KEY_LENGTH_FOR_STEM:
if self.language == 'en':
return self._oov_english_stem_english_ixes(key)
return key

def _db_query_similar_keys_vector(
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version_info__ = ('0', '1', '118')
__version_info__ = ('0', '1', '119')
__version__ = '.'.join(__version_info__)

0 comments on commit b4c2da0

Please sign in to comment.