goolabs/commands.py
def entity(ctx, app_id, sentence_file,
           json_flag, sentence, class_filter, request_id):
    # type: (Context, unicode, Optional[IO], bool, unicode, unicode, unicode) -> None # NOQA
    """ Extract unique representation from sentence. """

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

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

    api = GoolabsAPI(app_id)
    ret = api.entity(
        sentence=sentence,
        class_filter=class_filter,
        request_id=request_id
    )

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

    for ne in ret['ne_list']:
        click.echo(','.join(ne))
def entity(ctx, app_id, sentence_file,
           json_flag, sentence, class_filter, request_id):
    # type: (Context, unicode, Optional[IO], bool, unicode, unicode, unicode) -> None # NOQA
    """ Extract unique representation from sentence. """

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

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

    api = GoolabsAPI(app_id)
    ret = api.entity(
        sentence=sentence,
        class_filter=class_filter,
        request_id=request_id
    )

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

    for ne in ret['ne_list']:
        click.echo(','.join(ne))
def entity ( ctx , app_id , sentence_file , json_flag , sentence , class_filter , request_id ) : # type: (Context, unicode, Optional[IO], bool, unicode, unicode, unicode) -> None # NOQA app_id = clean_app_id ( app_id ) sentence = clean_sentence ( sentence , sentence_file ) if class_filter : class_filter = class_filter . replace ( ',' , '|' ) api = GoolabsAPI ( app_id ) ret = api . entity ( sentence = sentence , class_filter = class_filter , request_id = request_id ) if json_flag : click . echo ( format_json ( api . response . json ( ) ) ) return for ne in ret [ 'ne_list' ] : click . echo ( ',' . join ( ne ) )
Extract unique representation from sentence.
Extract unique representation from sentence .