UnboundLocalError: local variable 'normalized_id' referenced before assignment
Closed this issue · 1 comments
caufieldjh commented
When an extraction encounters an entity it cannot normalize, it isn't normally an issue - it just gets assigned the AUTO
prefix or equivalent default.
This currently raises an error, though:
INFO:ontogpt.engines.knowledge_engine:Could not ground and normalize N/A to Unit
Traceback (most recent call last):
File "/home/harry/ontogpt/.venv/bin/ontogpt", line 6, in <module>
sys.exit(main())
File "/home/harry/ontogpt/.venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/harry/ontogpt/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/harry/ontogpt/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/harry/ontogpt/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/harry/ontogpt/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/harry/ontogpt/src/ontogpt/cli.py", line 388, in extract
results = ke.extract_from_text(
File "/home/harry/ontogpt/src/ontogpt/engines/spires_engine.py", line 97, in extract_from_text
extracted_object = self.parse_completion_payload(
File "/home/harry/ontogpt/src/ontogpt/engines/spires_engine.py", line 563, in parse_completion_payload
return self.ground_annotation_object(raw, cls)
File "/home/harry/ontogpt/src/ontogpt/engines/spires_engine.py", line 633, in ground_annotation_object
obj = self.ground_annotation_object(val, rng_cls)
File "/home/harry/ontogpt/src/ontogpt/engines/spires_engine.py", line 635, in ground_annotation_object
obj = self.normalize_named_entity(val, slot.range) # type: ignore
File "/home/harry/ontogpt/src/ontogpt/engines/knowledge_engine.py", line 350, in normalize_named_entity
ne = NamedEntity(id=normalized_id, label=text)
UnboundLocalError: local variable 'normalized_id' referenced before assignment
caufieldjh commented
Oops, pushed fix to main (befcafe)