diff --git a/VerdictCut/find_laws.py b/VerdictCut/find_laws.py index e225978..442e119 100644 --- a/VerdictCut/find_laws.py +++ b/VerdictCut/find_laws.py @@ -12,9 +12,11 @@ def find_laws(judgement, break_line='\r\n'): judgement, appendix_law_list, table_list) law_paragraph_list = law_paragraph.split(break_line) laws_list = [] - for data_text in (law_paragraph_list): + last_law_flag="" + for data_text in (law_paragraph_list): for law in all_laws_list: if law in data_text: + last_law_flag=law # print(key,regex_law(law,data_text)) processed_law = clean_data( regex_law(law, data_text), break_line) @@ -22,6 +24,13 @@ def find_laws(judgement, break_line='\r\n'): continue else: laws_list.append(processed_law) + elif last_law_flag!="" and re.search("^第\s*\d*\s*條",data_text)!=None: + processed_law = clean_data( + regex_law(last_law_flag, last_law_flag+data_text), break_line) + if processed_law in laws_list: + continue + else: + laws_list.append(processed_law) # 如果中華民國刑法已經找到,就刪除刑法的部分 # 保留含有細項的法條 laws_list_copy = laws_list.copy() diff --git a/VerdictCut/tool/find_name_law.py b/VerdictCut/tool/find_name_law.py index 4cfa061..69e2687 100644 --- a/VerdictCut/tool/find_name_law.py +++ b/VerdictCut/tool/find_name_law.py @@ -18,7 +18,6 @@ def find_name_and_law(judgement, break_line='\r\n'): people_dict = find_roles(judgement, target_roles=[ '被告'], break_line=break_line) name_list = find_name(people_dict) - # 找執掌法條 all_laws_list = get_all_laws_list() # 從論罪科刑裡面找法條