Merge branch 'develop-1.24' into develop
This commit is contained in:
commit
1aeca1f240
@ -330,36 +330,18 @@ def extract_text_with_keywords(processed_paragraphs, keywords, follow_up_keyword
|
|||||||
|
|
||||||
if continue_collecting:
|
if continue_collecting:
|
||||||
if text == '[$$table_start$$]':
|
if text == '[$$table_start$$]':
|
||||||
try:
|
|
||||||
current_index += 1
|
current_index += 1
|
||||||
while processed_paragraphs[current_index] != '[$$table_over$$]':
|
while (processed_paragraphs[current_index] != '[$$table_over$$]'):
|
||||||
extracted_paragraphs[active_key].append(processed_paragraphs[current_index])
|
extracted_paragraphs[active_key].append(processed_paragraphs[current_index])
|
||||||
current_index += 1
|
current_index += 1
|
||||||
except IndexError:
|
|
||||||
print(f"IndexError: current_index={current_index} during table processing.")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"An unexpected error occurred while processing table: {e}")
|
|
||||||
return current_index
|
return current_index
|
||||||
|
if current_section_pattern and re.match(current_section_pattern, text):
|
||||||
if current_section_pattern:
|
|
||||||
try:
|
|
||||||
if re.match(current_section_pattern, text):
|
|
||||||
continue_collecting = False
|
continue_collecting = False
|
||||||
active_key = None
|
active_key = None
|
||||||
except re.error as re_err:
|
|
||||||
print(f"Regex error: {re_err} with pattern {current_section_pattern} and text '{text}'")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"An unexpected error occurred while matching section pattern: {e}")
|
|
||||||
else:
|
else:
|
||||||
if active_key is not None:
|
if active_key is not None:
|
||||||
try:
|
|
||||||
extracted_paragraphs[active_key].append(text)
|
extracted_paragraphs[active_key].append(text)
|
||||||
except KeyError:
|
|
||||||
print(f"KeyError: active_key='{active_key}' not found in extracted_paragraphs.")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"An unexpected error occurred while appending text: {e}")
|
|
||||||
return current_index
|
return current_index
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if match_keywords(text, keywords):
|
if match_keywords(text, keywords):
|
||||||
active_key = text
|
active_key = text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user