def judge(word): app_id = "39bc88fcf7da5a2e42e311dbf872353f8a23960f7d4f021b20fefc7504ec76c6" api = GoolabsAPI(app_id) # See sample response below. ret = api.similarity(query_pair=[word, favoriteword]) print ret['score'] return ret['score']
def similarity(ctx, app_id, json_flag, query_pair, request_id): # type: (Context, unicode, bool, List[unicode], unicode) -> None """ Scoring the similarity of two words. """ app_id = clean_app_id(app_id) api = GoolabsAPI(app_id) ret = api.similarity(query_pair=query_pair, request_id=request_id) if json_flag: click.echo(format_json(api.response.json())) return click.echo('{0:.16f}'.format(ret['score']))