Adding in contents of enamdict
Former-commit-id: 2738889da33182d941c2179afbc5f3d776dc886a
This commit is contained in:
parent
3ba372c9c7
commit
1c5129f82b
@ -2,7 +2,8 @@
|
||||
|
||||
KANJIDIC=util/kanjidic
|
||||
EDICT=util/edict
|
||||
ENAMDICT=util/enamdict
|
||||
DICT=yomi_base/japanese/dictionary.db
|
||||
|
||||
[ -f $DICT ] && rm $DICT
|
||||
util/compile.py --kanjidic $KANJIDIC --edict $EDICT $DICT
|
||||
util/compile.py --kanjidic $KANJIDIC --edict $EDICT $DICT --enamdict $ENAMDICT
|
||||
|
@ -40,21 +40,31 @@ PARSED_TAGS = {
|
||||
'aux', # auxiliary
|
||||
'aux-adj', # auxiliary adjective
|
||||
'aux-v', # auxiliary verb
|
||||
'c', # company name
|
||||
'conj', # conjunction
|
||||
'ctr', # counter
|
||||
'exp', # Expressions (phrases, clauses, etc.)
|
||||
'f', # female given name
|
||||
'g', # given name, as-yet not classified by sex
|
||||
'h', # full (usually family plus given) name of a particular person
|
||||
'int', # interjection (kandoushi)
|
||||
'iv', # irregular verb
|
||||
'm', # male given name
|
||||
'n', # noun (common) (futsuumeishi)
|
||||
'n-adv', # adverbial noun (fukushitekimeishi)
|
||||
'n-pref', # noun, used as a prefix
|
||||
'n-suf', # noun, used as a suffix
|
||||
'n-t', # noun (temporal) (jisoumeishi)
|
||||
'num', # numeric
|
||||
'p', # place-name
|
||||
'pn', # pronoun
|
||||
'pr', # product name
|
||||
'pref' , # prefix
|
||||
'prt', # particle
|
||||
's', # surname
|
||||
'st', # stations
|
||||
'suf', # suffix
|
||||
'u', # person name, either given or surname, as-yet unclassified
|
||||
'v1', # Ichidan verb
|
||||
'v2a-s', # Nidan verb with 'u' ending (archaic)
|
||||
'v4h', # Yodan verb with `hu/fu' ending (archaic)
|
||||
@ -172,18 +182,21 @@ def writeEdict(cursor, values):
|
||||
cursor.executemany('INSERT INTO Terms VALUES(?, ?, ?, ?)', values)
|
||||
|
||||
|
||||
def build(path, kanjidic, kradfile, edict):
|
||||
def build(path, kanjidic, kradfile, edict, enamdict):
|
||||
with sqlite3.connect(path) as db:
|
||||
cursor = db.cursor()
|
||||
|
||||
if kanjidic is not None:
|
||||
writeKanjiDic(cursor, parseKanjiDic(kanjidic))
|
||||
writeKanjiDic(db, parseKanjiDic(kanjidic))
|
||||
|
||||
if kradfile is not None:
|
||||
writeKradFile(cursor, parseKradFile(kradfile))
|
||||
writeKradFile(db, parseKradFile(kradfile))
|
||||
|
||||
terms = []
|
||||
if edict is not None:
|
||||
writeEdict(cursor, parseEdict(edict))
|
||||
terms += parseEdict(edict)
|
||||
if enamdict is not None:
|
||||
terms += parseEdict(enamdict)
|
||||
if len(terms) > 0:
|
||||
writeEdict(db, terms)
|
||||
|
||||
|
||||
def main():
|
||||
@ -191,13 +204,20 @@ def main():
|
||||
parser.add_option('--kanjidic', dest='kanjidic')
|
||||
parser.add_option('--kradfile', dest='kradfile')
|
||||
parser.add_option('--edict', dest='edict')
|
||||
parser.add_option('--enamdict', dest='enamdict')
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
if len(args) == 0:
|
||||
parser.print_help()
|
||||
else:
|
||||
build(args[0], options.kanjidic, options.kradfile, options.edict)
|
||||
build(
|
||||
args[0],
|
||||
options.kanjidic,
|
||||
options.kradfile,
|
||||
options.edict,
|
||||
options.enamdict
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
739358
util/enamdict
Normal file
739358
util/enamdict
Normal file
File diff suppressed because it is too large
Load Diff
@ -17,5 +17,5 @@
|
||||
|
||||
|
||||
c = {
|
||||
'appVersion': '0.14b',
|
||||
'appVersion': '0.15b',
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:76e8f49f623012ca646b235b660c244070f0fff53811b77c429b907878c28585
|
||||
size 20201472
|
||||
oid sha256:7944b0babc6812a36c01265b8df517f15f5358dee415ece53736c5c2136aa5cb
|
||||
size 57806848
|
||||
|
@ -240,10 +240,9 @@ def extractKindleDeck(filename):
|
||||
words = list()
|
||||
|
||||
try:
|
||||
connection = sqlite3.connect(unicode(filename))
|
||||
for row in connection.execute('select word from WORDS'):
|
||||
with sqlite3.connect(unicode(filename)) as db:
|
||||
for row in db.execute('select word from WORDS'):
|
||||
words.append(row[0])
|
||||
connection.close()
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user