Esempio n. 1
0
from chirptext import TextReport, FileHelper, Counter
from chirptext.cli import CLIApp, setup_logging
from chirptext.anhxa import to_obj
from yawlib import SynsetID
from yawlib.helpers import get_gwn
from yawlib.helpers import get_wn, get_omw

from omwtk.compare_wn import join_definitions

# -------------------------------------------------------------------------------
# Configuration
# -------------------------------------------------------------------------------

DATA_FOLDER = os.path.abspath(os.path.expanduser('./data'))
setup_logging('logging.json', 'logs')


def getLogger():
    return logging.getLogger(__name__)


# -------------------------------------------------------------------------------
# Data structure
# -------------------------------------------------------------------------------


class DefPatch(object):
    def __init__(self,
                 sensekey='',
                 orig_def='',
Esempio n. 2
0
import os
import logging

from chirptext import TextReport, Counter
from chirptext.cli import CLIApp, setup_logging

from coolisf import GrammarHub
from coolisf.mappings import PredSense
from coolisf.ergex import read_erg_lex
from coolisf.model import Predicate

# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------

setup_logging('logging.json', 'logs')
TRIVIAL_POS = 'navj'
ghub = GrammarHub()
EI = ghub.ERG_ISF


def getLogger():
    return logging.getLogger(__name__)


# ------------------------------------------------------------------------------
# Functions
# ------------------------------------------------------------------------------

def list_preds(cli, args):
    rp = TextReport(args.output)
Esempio n. 3
0
from chirptext.cli import CLIApp, setup_logging

from jamdict import Jamdict
from jamdict import config
from jamdict import version_info

# -------------------------------------------------------------------------------
# Configuration
# -------------------------------------------------------------------------------

JMD_XML = config.get_file('JMDICT_XML')
KD2_XML = config.get_file('KD2_XML')
JMD_DB = config.get_file('JAMDICT_DB')

if os.path.isfile('logging.json'):
    setup_logging('logging.json', 'logs')
else:
    setup_logging(os.path.join(config.home_dir(), 'logging.json'), 'logs')

# -------------------------------------------------------------------------------
# Functions
# -------------------------------------------------------------------------------


def get_jam(cli, args):
    if not args.jdb:
        args.jdb = None
    if args.kd2:
        cli.logger.warning("Jamdict database location: {}".format(args.jdb))
        cli.logger.warning("Kanjidic2 database location: {}".format(args.kd2))
        jmd = Jamdict(db_file=args.jdb,
Esempio n. 4
0
# -*- coding: utf-8 -*-

''' Chirptext Test Scripts
Latest version can be found at https://github.com/letuananh/chirptext

:copyright: (c) 2012 Le Tuan Anh <*****@*****.**>
:license: MIT, see LICENSE for more details.
'''

# This source code is a part of chirptext library
# Copyright (c) 2015, Le Tuan Anh <*****@*****.**>
# LICENSE: The MIT License (MIT)
#
# Homepage: https://github.com/letuananh/chirptext

import os
from chirptext.cli import setup_logging

TEST_DIR = os.path.dirname(__file__)
TEST_DATA = os.path.join(TEST_DIR, 'data')

setup_logging(os.path.join(TEST_DIR, 'logging.json'), os.path.join(TEST_DIR, 'logs'))
Esempio n. 5
0
from jamdict import JMDictXML
from jamdict import JMDictSQLite

# -------------------------------------------------------------------------------
# Configuration
# -------------------------------------------------------------------------------

TEST_DIR = Path(os.path.realpath(__file__)).parent
TEST_DATA = TEST_DIR / 'data'
if not TEST_DATA.exists():
    TEST_DATA.mkdir()
TEST_DB = TEST_DATA / 'test.db'
MINI_JMD = TEST_DATA / 'JMdict_mini.xml'
okashi = 'お菓子'

setup_logging(TEST_DIR / 'logging.json', 'logs')


def getLogger():
    return logging.getLogger(__name__)


# -------------------------------------------------------------------------------
# Test cases
# -------------------------------------------------------------------------------


class TestJamdictSQLite(unittest.TestCase):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.db = JMDictSQLite(str(TEST_DB))