Added concepts with the same key handling

This commit is contained in:
2019-11-18 17:02:02 +01:00
parent 7fa509555d
commit cb6be9fec7
15 changed files with 255 additions and 43 deletions
+9 -7
View File
@@ -32,14 +32,16 @@ class ExactConceptParser(BaseParser):
recognized = False
for combination in self.combinations(words):
concept_key = " ".join(combination)
# Very important question to think about later
# Must we return a new instance or the existing one
# That will depend on the context
# Let's return a new one for now and see if it works
concept = sheerka.new(concept_key)
if not sheerka.isinstance(concept, BuiltinConcepts.UNKNOWN_CONCEPT):
concept_key = " ".join(combination)
result = sheerka.new(concept_key)
if sheerka.isinstance(result, BuiltinConcepts.UNKNOWN_CONCEPT):
continue
concepts = result.body if sheerka.isinstance(result, BuiltinConcepts.ENUMERATION) else [result]
for concept in concepts:
# update the properties if needed
for i, token in enumerate(combination):
if token.startswith(Concept.PROPERTY_PREFIX):