chore
Browse files- 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
|
| 68 |
-
cur_right_parens
|
| 69 |
|
| 70 |
-
cur_left_quote
|
| 71 |
-
|
| 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
|
| 78 |
-
cur_right_parens_ja
|
| 79 |
|
| 80 |
-
cur_left_parens_ja2
|
| 81 |
-
cur_right_parens_ja2
|
| 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("。")
|