Commit a4c676fe authored by PkSM3's avatar PkSM3

[UPDATE] good version :)

parent 31fd980b
......@@ -134,8 +134,8 @@ class ModelCache(dict):
for column in self._columns
if key.__class__ == column.type.python_type
]
if len(conditions) == 0:
raise KeyError
# if len(conditions) == 0:
# raise KeyError
element = session.query(self._model).filter(or_(*conditions)).first()
if element is None:
raise KeyError
......
......@@ -195,6 +195,7 @@ class NgramsExtractors(defaultdict):
ngramsextractors = NgramsExtractors()
def extract_ngrams(corpus, keys):
print("yoloo")
dbg = DebugTime('Corpus #%d - ngrams' % corpus.id)
default_language_iso2 = None if corpus.language_id is None else cache.Language[corpus.language_id].iso2
# query the metadata associated with the given keys
......@@ -224,7 +225,7 @@ def extract_ngrams(corpus, keys):
ngramsextractor = ngramsextractors[language_iso2]
for text in nodeinfo[2:]:
if text is not None and len(text):
ngrams = ngramsextractor.extract_ngrams(text)
ngrams = ngramsextractor.extract_ngrams(text.replace("[","").replace("]",""))
for ngram in ngrams:
terms = ' '.join([token for token, tag in ngram]).lower()
n = len(ngram)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment