コード例 #1
0
ファイル: difference.py プロジェクト: esrille/ibus-hiragana
#
# 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 codecs
import re
import sys

from signal import signal, SIGPIPE, SIG_DFL

import dic

if __name__ == '__main__':
    signal(SIGPIPE, SIG_DFL)
    if 3 <= len(sys.argv):
        a = sys.argv[1]
    else:
        a = '/usr/share/skk/SKK-JISYO.ML'
    if 3 <= len(sys.argv):
        b = sys.argv[2]
    elif 2 <= len(sys.argv):
        b = sys.argv[1]
    else:
        b = 'restrained.dic'
    print(";", a, "−", b)
    dict = dic.difference(dic.load(a), dic.load(b))
    dic.output(dict)
コード例 #2
0
# 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 codecs
import re
import sys

from signal import signal, SIGPIPE, SIG_DFL

import dic

if __name__ == '__main__':
    signal(SIGPIPE, SIG_DFL)
    a = '/usr/share/skk/SKK-JISYO.ML'
    if 2 <= len(sys.argv):
        a = sys.argv[1]
    b = '/usr/share/skk/SKK-JISYO.jinmei'
    if 3 <= len(sys.argv):
        b = sys.argv[2]
    dict = dic.intersection(dic.load(a), dic.load(b))
    print(";", a, "∩", b)
    dic.output(dict)
コード例 #3
0
# 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 codecs
import re
import sys

from signal import signal, SIGPIPE, SIG_DFL

import dic

if __name__ == '__main__':
    signal(SIGPIPE, SIG_DFL)
    a = 'restrained.dic'
    if 2 <= len(sys.argv):
        a = sys.argv[1]
    b = 'katakana.dic'
    if 3 <= len(sys.argv):
        b = sys.argv[2]
    dict = dic.intersection_yomi(dic.load(a), dic.load(b))
    print(";", a, "∩", b)
    dic.output(dict)
コード例 #4
0
ファイル: kigou.py プロジェクト: esrille/ibus-hiragana
# Copyright (c) 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 codecs
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)
    kigou = dic.kigou(dict)
    dic.output(kigou)
コード例 #5
0
ファイル: union.py プロジェクト: junhg0211/ibus-hiragana
# 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 codecs
import re
import sys

from signal import signal, SIGPIPE, SIG_DFL

import dic

if __name__ == '__main__':
    signal(SIGPIPE, SIG_DFL)
    dict = {}
    op = ''
    print(";", end='')
    for path in sys.argv[1:]:
        print(op, path, end='')
        op = " ∪"
        dict = dic.union(dict, dic.load(path))
    print('')
    dic.output(dict)
コード例 #6
0
ファイル: restrain.py プロジェクト: junhg0211/ibus-hiragana
import codecs
import re
import sys

from signal import signal, SIGPIPE, SIG_DFL

import dic

if __name__ == '__main__':
    signal(SIGPIPE, SIG_DFL)

    path = '/usr/share/skk/SKK-JISYO.ML'
    if 2 <= len(sys.argv):
        path = sys.argv[1]
    dict = dic.load(path)
    dict = dic.difference(dict, dic.yougen(dict))  # 用言を削除
    dict = dic.union(dict, dic.load('my.dic'))  # 独自に追加したい熟語を追加。

    grade = 8
    if 3 <= len(sys.argv):
        grade = int(sys.argv[2])

    # 人名、地名、駅名、記号については、人名漢字の使用を許容し、例外辞書に格納しておきます。
    zinmei = dic.load('/usr/share/skk/SKK-JISYO.jinmei')
    reigai_zinmei = dic.intersection(dict, zinmei)
    geo = dic.load('/usr/share/skk/SKK-JISYO.geo')
    reigai_geo = dic.intersection(dict, geo)
    station = dic.load('/usr/share/skk/SKK-JISYO.station')
    reigai_station = dic.intersection(dict, station)
    reigai_kigou = dic.kigou(dict)