hpprc commited on
Commit
820ee10
·
1 Parent(s): 5ad5573
Files changed (1) hide show
  1. en-ja-align.py +8 -12
en-ja-align.py CHANGED
@@ -64,21 +64,17 @@ def parse_html_table(path: Path):
64
  text_en, _, text_ja = (preprocess(td.text) for td in tr.find_all("td"))
65
  text_ja = unicodedata.normalize("NFKC", text_ja)
66
 
67
- cur_left_parens = min(cur_left_parens + text_en.count("("), 1)
68
- cur_right_parens = min(cur_right_parens + text_en.count(")"), 1)
69
 
70
- cur_left_quote = min(
71
- cur_left_quote + len(list(re.findall(r"``", text_en))), 1
72
- )
73
- cur_right_quote = min(
74
- cur_right_quote + len(list(re.findall(r"''", text_en))), 1
75
- )
76
 
77
- cur_left_parens_ja = min(cur_left_parens_ja + text_ja.count("「"), 1)
78
- cur_right_parens_ja = min(cur_right_parens_ja + text_ja.count("」"), 1)
79
 
80
- cur_left_parens_ja2 = min(cur_left_parens_ja2 + text_ja.count("『"), 1)
81
- cur_right_parens_ja2 = min(cur_right_parens_ja2 + text_ja.count("』"), 1)
82
 
83
  if (
84
  text_ja.strip().endswith("。")
 
64
  text_en, _, text_ja = (preprocess(td.text) for td in tr.find_all("td"))
65
  text_ja = unicodedata.normalize("NFKC", text_ja)
66
 
67
+ cur_left_parens += min(text_en.count("("), 1)
68
+ cur_right_parens += min(text_en.count(")"), 1)
69
 
70
+ cur_left_quote += min(len(list(re.findall(r"``", text_en))), 1)
71
+ cur_right_quote += min(len(list(re.findall(r"''", text_en))), 1)
 
 
 
 
72
 
73
+ cur_left_parens_ja += min(text_ja.count("「"), 1)
74
+ cur_right_parens_ja += min(text_ja.count("」"), 1)
75
 
76
+ cur_left_parens_ja2 += min(text_ja.count("『"), 1)
77
+ cur_right_parens_ja2 += min(text_ja.count("』"), 1)
78
 
79
  if (
80
  text_ja.strip().endswith("。")