Handle backtick-wrapped brackets in extraction result parsing
* Support `( and `( start patterns * Support )` and )` end patterns * Graceful fallback to warning logs * Strip 2 chars for backtick variants * Maintain existing bracket logic
This commit is contained in:
parent
19014c6471
commit
00de0a4be8
1 changed files with 12 additions and 6 deletions
|
|
@ -881,15 +881,21 @@ async def _process_extraction_result(
|
||||||
if record.startswith("(") or record.startswith("("):
|
if record.startswith("(") or record.startswith("("):
|
||||||
record = record[1:]
|
record = record[1:]
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
if record.startswith("`(") or record.startswith("`("):
|
||||||
f"{chunk_key}: Record starting bracket can not be found in extraction result"
|
record = record[2:]
|
||||||
)
|
else:
|
||||||
|
logger.warning(
|
||||||
|
f"{chunk_key}: Record starting bracket can not be found in extraction result"
|
||||||
|
)
|
||||||
if record.endswith(")") or record.endswith(")"):
|
if record.endswith(")") or record.endswith(")"):
|
||||||
record = record[:-1]
|
record = record[:-1]
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
if record.endswith(")`") or record.endswith(")`"):
|
||||||
f"{chunk_key}: Record ending bracket can not be found in extraction result"
|
record = record[:-2]
|
||||||
)
|
else:
|
||||||
|
logger.warning(
|
||||||
|
f"{chunk_key}: Record ending bracket can not be found in extraction result"
|
||||||
|
)
|
||||||
|
|
||||||
record = record.strip()
|
record = record.strip()
|
||||||
if record is None:
|
if record is None:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue