ExactConceptParser can now recognize concepts by their names

This commit is contained in:
2020-05-21 16:27:18 +02:00
parent d357329f51
commit 37d3d16e21
17 changed files with 347 additions and 112 deletions
+20
View File
@@ -255,6 +255,26 @@ class BaseParser:
return start, end
@staticmethod
def merge_concepts(list_a, b):
if not b:
return list_a
list_b = b if isinstance(b, list) else [b]
if not list_a:
return list_b
by_ids = {c.id for c in list_b}
for c in list_b:
if c.id in by_ids: # and c.metadata.is_evaluated == by_ids[c.id].metadata.is_evaluated:
continue
list_a.append(c)
by_ids.add(c.id)
return list_a
class BaseTokenizerIterParser(BaseParser):