{"id":19646154,"url":"https://github.com/yoctol/yoctol-nlu-py","last_synced_at":"2025-09-04T18:34:10.469Z","repository":{"id":69890895,"uuid":"88953140","full_name":"Yoctol/yoctol-nlu-py","owner":"Yoctol","description":"Yoctol understood SDK for python.","archived":false,"fork":false,"pushed_at":"2018-07-25T06:25:34.000Z","size":5368,"stargazers_count":9,"open_issues_count":12,"forks_count":4,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-05T09:11:25.782Z","etag":null,"topics":["python","sdk","yoctol-natural-language"],"latest_commit_sha":null,"homepage":"http://yoctol-nlu-py.readthedocs.io/en/latest/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yoctol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-21T07:05:02.000Z","updated_at":"2025-01-20T10:48:23.000Z","dependencies_parsed_at":"2023-04-04T22:47:09.797Z","dependency_job_id":null,"html_url":"https://github.com/Yoctol/yoctol-nlu-py","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yoctol%2Fyoctol-nlu-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yoctol%2Fyoctol-nlu-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yoctol%2Fyoctol-nlu-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yoctol%2Fyoctol-nlu-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yoctol","download_url":"https://codeload.github.com/Yoctol/yoctol-nlu-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251338504,"owners_count":21573570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","sdk","yoctol-natural-language"],"created_at":"2024-11-11T14:37:07.378Z","updated_at":"2025-04-28T15:30:33.640Z","avatar_url":"https://github.com/Yoctol.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yoctol-nlu-py\n[![Build Status](https://travis-ci.org/Yoctol/yoctol-nlu-py.svg?branch=master)](https://travis-ci.org/Yoctol/yoctol-nlu-py)\n[![PyPI version](https://badge.fury.io/py/yoctol-nlu.svg)](https://badge.fury.io/py/yoctol-nlu)\n\nYoctol Natural Language Understanding SDK for python.\n\n## Install\nUse Python3\n```\npip install yoctol-nlu\n```\n\n## Usage\n\n### Intent Classifier Service\n\n#### Fetch Model \u0026 One Line Prediction\n```python\nfrom ynlu import NLUClient\n\nclient = NLUClient(token='YOUR_TOKEN_HERE')\n\n# Get all possible clf ids\nids = client.get_all_available_clf_ids()\nprint(ids)\n\n# Get model by id\nmodel = client.get_model_by_id(ids[0])\n\n# Predict\nintent_prediction, entity_prediction = model.predict('飲料喝到飽')\n\n# Also could get the clf by clf's name\n# Get all possible clf names\nnames = client.get_all_available_clf_names()\nprint(names)\n\n# Get model by name\nmodel = client.get_model_by_name(names[0])\n\n# Predict\nintent_prediction, entity_prediction = model.predict('飲料喝到飽')\n```\n\n#### Evaluations for Intent\n```python\nfrom ynlu import NLUClient\nfrom ynlu.sdk.evaluation import {\n    # Accuracy\n    intent_accuracy_score_with_threshold,\n    # Precision\n    intent_precision_score_with_threshold,\n    # Recall\n    intent_recall_score_with_threshold,\n}\n\nclient = NLUClient(token='YOUR_TOKEN_HERE')\nmodel = client.get_model_by_id('TARGET_MODEL_ID_HERE')\n\ntest_data = [\n    'This is a line ',\n    'for testing the NLUClient ',\n    'and evaluating the prediction ',\n    'from the trained model. ',\n]\n\nintent_predictions, entities_predictions = model.batch_predict(test_data)\n\n# Pure Accuracy\nprint(intent_accuracy_score_with_threshold(\n        intent_predictions=intent_predictions,\n        y_trues=test_data,\n        threshold=0.,\n    )\n)\n# Accuracy with threshold 0.5\nprint(intent_accuracy_score_with_threshold(\n        intent_predictions=intent_predictions,\n        y_trues=test_data,\n        threshold=0.5,\n    )\n)\n```\n\nCheck out the tutorials for more examples.\n\n## Documentation\n\nWe rely on Sphinx for user and API documentation.\n\nYou can run just make to do rebuild the API stubs and then build the HTML documentation.\n\n```\ncd docs\nmake # equivalent to `make apidoc \u0026\u0026 make html`\n```\n\nTo only build the html pages:\n\n```\ncd docs\nmake html\n```\n\nTo just re-generate the API reference.\n\n```\ncd docs\nmake apidoc # calls sphinx-apidoc\n```\nRun `make help` for a full list of build options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoctol%2Fyoctol-nlu-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoctol%2Fyoctol-nlu-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoctol%2Fyoctol-nlu-py/lists"}