reigai = dic.union(reigai, reigai_station) reigai = dic.union(reigai, reigai_kigou) dict = dic.difference(dict, reigai) # 例外辞書の内容を削除 if grade <= 6: reigai = dic.difference(reigai, dic.hyougai(reigai)) reigai = dic.difference(reigai, dic.hyougai_yomi(reigai, grade)) zyosuusi = dic.load('zyosuusi.dic') zyosuusi = dic.difference(zyosuusi, dic.hyougai_yomi(zyosuusi, grade)) # 基本辞書をつくります。 dict = dic.difference(dict, dic.okuri(dict)) # おくりがなのついた熟語を削除 dict = dic.difference(dict, dic.hyougai(dict)) # 表外の漢字を使用している熟語を削除 dict = dic.difference(dict, dic.hyougai_yomi(dict, grade)) # 表外のよみかたをつかっている熟語を削除 dict = dic.difference(dict, dic.wago(dict, grade)) # 和語の熟語を削除 if 6 < grade: dict = dic.union(dict, dic.load('fuhyou.dic')) # 常用漢字表・付表の熟語を追加。 dict = dic.union(dic.zyouyou(grade), dict) # 常用漢字を追加 if 1 < grade: dict = dic.union(dict, dic.load('kahen.dic')) # カ変活用を追加 dict = dic.union(zyosuusi, dict) # 助数詞を先頭に追加 dict = dic.union(dict, reigai) # 例外を追加 if 8 <= grade: dict = dic.union( dict, dic.load('tc2.compat.dic')) # tc2のmazegaki.dic辞書から選択した単語を追加。 if 6 < grade: dict = dic.union(dict, dic.load('greek.dic')) # ギリシア文字辞書を追加。 dict = dic.difference(dict, dic.load('drop.dic')) # 独自に削除したい熟語を削除。 dict = dic.union(dict, dic.load('basic.dic')) # 「にほん」を追加。
# Copyright 2017 Esrille Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import io import re import sys from signal import signal, SIGPIPE, SIG_DFL import dic if __name__ == '__main__': signal(SIGPIPE, SIG_DFL) path = 'restrained.dic' if 2 <= len(sys.argv): path = sys.argv[1] dict = dic.load(path) wago = dic.wago(dict) dic.output(wago)