Skip to content

Commit

Permalink
chore(make_json_dict.py): Add dictionary conversion function of stati…
Browse files Browse the repository at this point in the history
…on name to dictionary conversion tool. fix #443 @1h
  • Loading branch information
tKondoYDC committed Oct 27, 2018
1 parent e1c5703 commit a5548b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tool/make_json_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import argparse
import json
import sys
import csv

LOWER_CASE = {u'ァ': u'ア', u'ィ': u'イ', u'ゥ': u'ウ', u'ェ': u'エ', u'ォ': u'オ',
u'ャ': u'ヤ', u'ュ': u'ユ', u'ョ': u'ヨ', u'ヮ': u'ワ',
Expand All @@ -35,6 +36,7 @@
parser = argparse.ArgumentParser(description=u'JSON辞書作成スクリプト')
parser.add_argument('-n', '--naistdic', action='store_true', help=u'NAIST Japanese Dictionaryの読み込み時に使用')
parser.add_argument('-p', '--pokemon', action='store_true', help=u'kotofurumiya/pokemon_dataの読み込み時に使用')
parser.add_argument('-s', '--station', action='store_true', help=u'geonlp_japan_stationの読み込み時に使用')
parser.add_argument('inputfile', type=argparse.FileType('r'))
parser.add_argument('outputfile', type=argparse.FileType('w'))
args = parser.parse_args()
Expand Down Expand Up @@ -62,6 +64,16 @@
else:
yomi += v
inputData[yomi] = [name]
elif args.station:
obj = csv.reader(f)
for line in obj:
org = line[2]
key = line[3]
if key in inputData:
if org not in inputData[key]:
inputData[key].append(org)
else:
inputData[key] = [org]
else:
sys.exit(u'オプションが指定されていません')

Expand Down

0 comments on commit a5548b7

Please sign in to comment.