Skip to content

Commit 3b8dbb2

Browse files
committed
Add conversion for quotes
1 parent e79fb30 commit 3b8dbb2

5 files changed

Lines changed: 14 additions & 12 deletions

File tree

build/convert_tables.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@
1515
# - cache/convert_table_words_twp.txt
1616
# - cache/convert_table_chars_twp.txt
1717

18+
from itertools import chain
1819
from opencc import OpenCC
1920

2021
def build_entries(twp=False):
21-
with open('opencc_data/STCharacters.txt') as f: # s2t
22-
for line in f:
23-
k, vx = line.rstrip('\n').split('\t')
24-
v = vx.split(' ')[0] # Only select the first candidate
25-
v = t2twp(v) if twp else v # s2t -> s2twp
26-
yield k, v
27-
28-
with open('opencc_data/STPhrases.txt') as f: # s2t
29-
for line in f:
22+
with open('opencc_data/STCharacters.txt') as f1, \
23+
open('opencc_data/STPhrases.txt') as f2, \
24+
open('build/extra_convert_table.txt') as f3: # s2t
25+
for line in chain(f1, f2, f3):
3026
k, vx = line.rstrip('\n').split('\t')
3127
v = vx.split(' ')[0] # Only select the first candidate
3228
v = t2twp(v) if twp else v # s2t -> s2twp

build/extra_convert_table.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
“ 「
2+
” 」
3+
‘ 『
4+
’ 』

build/font.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
import subprocess
88

9-
FONT_VERSION = 1.005
9+
FONT_VERSION = 1.006
1010

1111
# Define the max entries size in a subtable.
1212
# We define a number that is small enough here, so that the entries will not exceed
@@ -194,7 +194,7 @@ def remove_glyph(obj, glyph_name):
194194
# Remove glyph from glyph_order table
195195
try:
196196
obj['glyph_order'].remove(glyph_name)
197-
except ValueError as e:
197+
except ValueError:
198198
pass
199199

200200
# Remove glyph from glyf table

build/name.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"encodingID": 1,
4040
"languageID": 1033,
4141
"nameID": 0,
42-
"nameString": "Copyright © 2020 Ayaka Mikazuki."
42+
"nameString": "Copyright © 2020-2021 Ayaka Mikazuki."
4343
},
4444
{
4545
"platformID": 3,

test/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ <h2>测试台湾字词转换</h2>
4949
<p class="tw">我们在老挝的服务器的硬盘需要使用互联网算法软件解决异步的问题</p>
5050
<p>为什么你在床里面睡着?</p>
5151
<p class="tw">为什么你在床里面睡着?</p>
52+
<p>他站起来问:“老师,‘有条不紊’的‘紊’是什么意思?”</p>
53+
<p class="tw">他站起来问:“老师,‘有条不紊’的‘紊’是什么意思?”</p>
5254
<p>台式机</p>
5355
<p class="tw">台式机</p>
5456
<p>着装污染虚伪发泄棱柱群众里面</p>

0 commit comments

Comments
 (0)