hpprc commited on
Commit
697087c
·
1 Parent(s): 0a49b16
Files changed (1) hide show
  1. en-ja-align.py +4 -1
en-ja-align.py CHANGED
@@ -58,6 +58,7 @@ def parse_html_table(path: Path):
58
  cur_left_quote, cur_right_quote = 0, 0
59
  cur_left_parens_ja, cur_right_parens_ja = 0, 0
60
  cur_left_parens_ja2, cur_right_parens_ja2 = 0, 0
 
61
 
62
  for table in tables:
63
  for tr in table.find_all("tr"):
@@ -81,7 +82,7 @@ def parse_html_table(path: Path):
81
  and cur_left_quote == cur_right_quote
82
  and cur_left_parens_ja == cur_right_parens_ja
83
  and cur_left_parens_ja2 == cur_right_parens_ja2
84
- ):
85
  texts_en.append((cur_text_en + " " + text_en).strip())
86
  texts_ja.append((cur_text_ja + text_ja).strip())
87
  cur_text_en, cur_text_ja = "", ""
@@ -89,9 +90,11 @@ def parse_html_table(path: Path):
89
  cur_left_quote, cur_right_quote = 0, 0
90
  cur_left_parens_ja, cur_right_parens_ja = 0, 0
91
  cur_left_parens_ja2, cur_right_parens_ja2 = 0, 0
 
92
  else:
93
  cur_text_en += " " + text_en
94
  cur_text_ja += text_ja
 
95
 
96
  texts_en.append(cur_text_en.strip())
97
  texts_ja.append(cur_text_ja.strip())
 
58
  cur_left_quote, cur_right_quote = 0, 0
59
  cur_left_parens_ja, cur_right_parens_ja = 0, 0
60
  cur_left_parens_ja2, cur_right_parens_ja2 = 0, 0
61
+ continue_count = 0
62
 
63
  for table in tables:
64
  for tr in table.find_all("tr"):
 
82
  and cur_left_quote == cur_right_quote
83
  and cur_left_parens_ja == cur_right_parens_ja
84
  and cur_left_parens_ja2 == cur_right_parens_ja2
85
+ ) or continue_count >= 10:
86
  texts_en.append((cur_text_en + " " + text_en).strip())
87
  texts_ja.append((cur_text_ja + text_ja).strip())
88
  cur_text_en, cur_text_ja = "", ""
 
90
  cur_left_quote, cur_right_quote = 0, 0
91
  cur_left_parens_ja, cur_right_parens_ja = 0, 0
92
  cur_left_parens_ja2, cur_right_parens_ja2 = 0, 0
93
+ continue_count = 0
94
  else:
95
  cur_text_en += " " + text_en
96
  cur_text_ja += text_ja
97
+ continue_count += 1
98
 
99
  texts_en.append(cur_text_en.strip())
100
  texts_ja.append(cur_text_ja.strip())