How to use the pyknp.Morpheme function in pyknp

To help you get started, we’ve selected a few pyknp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kensuke-Mitsuzawa / JapaneseTokenizers / test / test_juman_wrapper_python2.py View on Github external
def test_juman_wrapper(self):
        try:
            from pyknp import Juman

            juman = Juman()
            result = juman.analysis(u"これはペンです。")
            logger.debug(','.join(mrph.midasi for mrph in result))

            for mrph in result.mrph_list():
                assert isinstance(mrph, pyknp.Morpheme)
                logger.debug(u"見出し:%s, 読み:%s, 原形:%s, 品詞:%s, 品詞細分類:%s, 活用型:%s, 活用形:%s, 意味情報:%s, 代表表記:%s" \
                  % (mrph.midasi, mrph.yomi, mrph.genkei, mrph.hinsi, mrph.bunrui, mrph.katuyou1, mrph.katuyou2, mrph.imis, mrph.repname))
        except ImportError:
            logger.debug('skip test_juman_wrapper')
github Kensuke-Mitsuzawa / JapaneseTokenizers / JapaneseTokenizer / common / juman_utils.py View on Github external
def extract_morphological_information(mrph_object, is_feature, is_surface):
    # type: (pyknp.Morpheme, bool, bool) -> TokenizedResult
    """This method extracts morphlogical information from token object.
    """
    assert isinstance(mrph_object, pyknp.Morpheme)
    assert isinstance(is_feature, bool)
    assert isinstance(is_surface, bool)

    surface = mrph_object.midasi
    word_stem = mrph_object.genkei

    tuple_pos = (mrph_object.hinsi, mrph_object.bunrui)

    misc_info = {
        'katuyou1': mrph_object.katuyou1,
        'katuyou2': mrph_object.katuyou2,
        'imis': mrph_object.imis,
        'repname': mrph_object.repname
    }

    token_object = TokenizedResult(
github Kensuke-Mitsuzawa / JapaneseTokenizers / JapaneseTokenizer / juman_wrapper / juman_wrapper.py View on Github external
def __extract_morphological_information(self, mrph_object, is_feature, is_surface):
        """This method extracts morphlogical information from token object.
        """
        assert isinstance(mrph_object, pyknp.Morpheme)
        assert isinstance(is_feature, bool)
        assert isinstance(is_surface, bool)

        surface = mrph_object.midasi
        word_stem = mrph_object.genkei

        tuple_pos = (mrph_object.hinsi, mrph_object.bunrui)

        misc_info = {
            'katuyou1': mrph_object.katuyou1,
            'katuyou2': mrph_object.katuyou2,
            'imis': mrph_object.imis,
            'repname': mrph_object.repname
        }

        token_object = TokenizedResult(

pyknp

Python module for JUMAN/KNP

See COPYING
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Similar packages