Unroll get_matching last list-comprehension.
This commit is contained in:
parent
e6cbb54382
commit
7cdf8a310d
@ -278,14 +278,23 @@ def get_matching(sample, other):
|
|||||||
x[0][i][0] == sample[0][i][0],
|
x[0][i][0] == sample[0][i][0],
|
||||||
other))
|
other))
|
||||||
|
|
||||||
return [sample[0][x] if isinstance(sample[0][x], str)
|
matching = []
|
||||||
else
|
for x in range(l): # Generate the combination of this and other(s) matcher
|
||||||
sample[0][x] if isinstance(sample[0][x], tuple)
|
first_sample_data = sample[0][x]
|
||||||
else {'groups': sample[0][x]['groups'] & reduce(lambda a, b: a & b,
|
if isinstance(first_sample_data, str):
|
||||||
map(lambda y: y[0][x]['groups'],
|
matching.append(first_sample_data)
|
||||||
other))}
|
elif isinstance(first_sample_data, tuple):
|
||||||
for x
|
matching.append(first_sample_data)
|
||||||
in range(l)]
|
else:
|
||||||
|
this_groups = sample[0][x]['groups']
|
||||||
|
if len(other) > 0:
|
||||||
|
other_groups = reduce(lambda a, b: a & b,
|
||||||
|
map(lambda y: y[0][x]['groups'],
|
||||||
|
other))
|
||||||
|
this_groups = this_groups & other_groups
|
||||||
|
|
||||||
|
matching.append({'groups': this_groups})
|
||||||
|
return matching
|
||||||
|
|
||||||
|
|
||||||
def reprocess_language_knowledge(knowledge_base, examples):
|
def reprocess_language_knowledge(knowledge_base, examples):
|
||||||
|
Loading…
Reference in New Issue
Block a user