Move pieces of parsing code in parsing module.

This commit is contained in:
kenkeiras 2017-05-11 20:56:01 +02:00
parent 3cc1f9bcde
commit ad975015a6
3 changed files with 5 additions and 4 deletions

View file

@ -67,6 +67,7 @@ def reprocess_language_knowledge(knowledge_base, examples):
def get_fit(knowledge, row):
row = row.lower().split()
for sample, ast in knowledge.trained:
if len(sample) != len(row):
continue
@ -74,6 +75,6 @@ def get_fit(knowledge, row):
if all(map(lambda x: (not isinstance(sample[x], str)
or sample[x] == row[x]),
range(len(sample)))):
return sample, ast
return row, sample, ast
else:
return None