goolabs/commands.py
def morph(ctx, app_id, sentence_file, json_flag,
          sentence, info_filter, pos_filter, request_id):
    # type: (Context, unicode, Optional[IO], bool, unicode, unicode, unicode, unicode) -> None  # NOQA
    """ Morphological analysis for Japanese."""

    app_id = clean_app_id(app_id)
    sentence = clean_sentence(sentence, sentence_file)

    if info_filter:
        info_filter = info_filter.replace(',', '|')

    if pos_filter:
        pos_filter = pos_filter.replace(',', '|')

    api = GoolabsAPI(app_id)
    ret = api.morph(
        sentence=sentence,
        info_filter=info_filter,
        pos_filter=pos_filter,
        request_id=request_id,
    )

    if json_flag:
        click.echo(format_json(api.response.json()))
        return

    for words in ret['word_list']:
        for word in words:
            click.echo(','.join(word))
def morph(ctx, app_id, sentence_file, json_flag,
          sentence, info_filter, pos_filter, request_id):
    # type: (Context, unicode, Optional[IO], bool, unicode, unicode, unicode, unicode) -> None  # NOQA
    """ Morphological analysis for Japanese."""

    app_id = clean_app_id(app_id)
    sentence = clean_sentence(sentence, sentence_file)

    if info_filter:
        info_filter = info_filter.replace(',', '|')

    if pos_filter:
        pos_filter = pos_filter.replace(',', '|')

    api = GoolabsAPI(app_id)
    ret = api.morph(
        sentence=sentence,
        info_filter=info_filter,
        pos_filter=pos_filter,
        request_id=request_id,
    )

    if json_flag:
        click.echo(format_json(api.response.json()))
        return

    for words in ret['word_list']:
        for word in words:
            click.echo(','.join(word))
Morphological analysis for Japanese.