bareun-apis


Namebareun-apis JSON
Version 0.11.0 PyPI version JSON
download
home_pagehttps://bareun.ai/
Summarybareunai-apis contains the python classes generated from the bareun ai APIs, which includes tagger, and so on.
upload_time2023-01-02 05:33:05
maintainer
docs_urlNone
authorGihyun YUN
requires_python>=3.6,<4.0
licenseBSD-3-Clause
keywords bareun grpc protobuf pos tagger korean
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # What is this?

`bareun-apis` is the generated python classes of GRPC API for bareun.ai.

The bareun.ai provides several service for deep learning NLP features.
This api has all of main features, which provides tokenizing, POS tagging for Korean.
It has also customized dictionary service.

## How to install

```shell
pip3 install bareun-apis
```

## How to use
- You can create your own baikal language service client.
- It is used for `bareunlpy`, the official bareun package for python.


```python
from google.protobuf.json_format import MessageToDict

import bareun.language_service_pb2 as pb
import bareun.language_service_pb2_grpc as ls

MAX_MESSAGE_LENGTH = 100*1024*1024

class BareunLanguageServiceClient:

    def __init__(self, remote):
        channel = grpc.insecure_channel(
            remote,
            options=[
                ('grpc.max_send_message_length', MAX_MESSAGE_LENGTH),
                ('grpc.max_receive_message_length', MAX_MESSAGE_LENGTH),
            ])

        self.stub = ls.LanguageServiceStub(channel)

    def analyze_syntax(self, document, auto_split=False):
        req = pb.AnalyzeSyntaxRequest()
        req.document.content = document
        req.document.language = "ko_KR"
        req.encoding_type = pb.EncodingType.UTF32
        req.auto_split_sentence = auto_split

        res = self.stub.AnalyzeSyntax(req)
        # print_syntax_as_json(res)
        return res

    def tokenize(self, document, auto_split=False):
        req = pb.TokenizeRequest()
        req.document.content = document
        req.document.language = "ko_KR"
        req.encoding_type = pb.EncodingType.UTF32
        req.auto_split_sentence = auto_split

        res = self.stub.Tokenize(req)
        # print_tokens_as_json(res)
        return res

def print_syntax_as_json(res: pb.AnalyzeSyntaxResponse, logf=sys.stdout):
    d = MessageToDict(res)
    import json
    json_str = json.dumps(d, ensure_ascii=False, indent=2)
    logf.write(json_str)
    logf.write('\n')

def print_tokens_as_json(res: pb.TokenizeResponse, logf=sys.stdout):
    d = MessageToDict(res)
    import json
    json_str = json.dumps(d, ensure_ascii=False, indent=2)
    logf.write(json_str)
    logf.write('\n')

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://bareun.ai/",
    "name": "bareun-apis",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "bareun,grpc,protobuf,POS tagger,Korean",
    "author": "Gihyun YUN",
    "author_email": "gih2yun@baikal.ai",
    "download_url": "https://files.pythonhosted.org/packages/0e/61/14bcc48917bd4affd26dd0e72e6dacc13f4c7bcae950c14bed4339b3e6cd/bareun_apis-0.11.0.tar.gz",
    "platform": null,
    "description": "# What is this?\n\n`bareun-apis` is the generated python classes of GRPC API for bareun.ai.\n\nThe bareun.ai provides several service for deep learning NLP features.\nThis api has all of main features, which provides tokenizing, POS tagging for Korean.\nIt has also customized dictionary service.\n\n## How to install\n\n```shell\npip3 install bareun-apis\n```\n\n## How to use\n- You can create your own baikal language service client.\n- It is used for `bareunlpy`, the official bareun package for python.\n\n\n```python\nfrom google.protobuf.json_format import MessageToDict\n\nimport bareun.language_service_pb2 as pb\nimport bareun.language_service_pb2_grpc as ls\n\nMAX_MESSAGE_LENGTH = 100*1024*1024\n\nclass BareunLanguageServiceClient:\n\n    def __init__(self, remote):\n        channel = grpc.insecure_channel(\n            remote,\n            options=[\n                ('grpc.max_send_message_length', MAX_MESSAGE_LENGTH),\n                ('grpc.max_receive_message_length', MAX_MESSAGE_LENGTH),\n            ])\n\n        self.stub = ls.LanguageServiceStub(channel)\n\n    def analyze_syntax(self, document, auto_split=False):\n        req = pb.AnalyzeSyntaxRequest()\n        req.document.content = document\n        req.document.language = \"ko_KR\"\n        req.encoding_type = pb.EncodingType.UTF32\n        req.auto_split_sentence = auto_split\n\n        res = self.stub.AnalyzeSyntax(req)\n        # print_syntax_as_json(res)\n        return res\n\n    def tokenize(self, document, auto_split=False):\n        req = pb.TokenizeRequest()\n        req.document.content = document\n        req.document.language = \"ko_KR\"\n        req.encoding_type = pb.EncodingType.UTF32\n        req.auto_split_sentence = auto_split\n\n        res = self.stub.Tokenize(req)\n        # print_tokens_as_json(res)\n        return res\n\ndef print_syntax_as_json(res: pb.AnalyzeSyntaxResponse, logf=sys.stdout):\n    d = MessageToDict(res)\n    import json\n    json_str = json.dumps(d, ensure_ascii=False, indent=2)\n    logf.write(json_str)\n    logf.write('\\n')\n\ndef print_tokens_as_json(res: pb.TokenizeResponse, logf=sys.stdout):\n    d = MessageToDict(res)\n    import json\n    json_str = json.dumps(d, ensure_ascii=False, indent=2)\n    logf.write(json_str)\n    logf.write('\\n')\n\n```\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "bareunai-apis contains the python classes generated from the bareun ai APIs, which includes tagger, and so on.",
    "version": "0.11.0",
    "split_keywords": [
        "bareun",
        "grpc",
        "protobuf",
        "pos tagger",
        "korean"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "e31b32b54ef968367af3ce360009940c",
                "sha256": "61199359876db790290a28f3d848ae8ed6770cb68bd28e238f16ff8792377529"
            },
            "downloads": -1,
            "filename": "bareun_apis-0.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e31b32b54ef968367af3ce360009940c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 22960,
            "upload_time": "2023-01-02T05:33:03",
            "upload_time_iso_8601": "2023-01-02T05:33:03.156660Z",
            "url": "https://files.pythonhosted.org/packages/24/61/b40793037c3cdde3d1a501e541ec3e38e070b4d1f684d27881e8751615ef/bareun_apis-0.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "cd3c03a1656693f271e53a68a9699a7d",
                "sha256": "9293e7e4f7f4e43661a176132c2d2445e3acd483f389221061644c32cefd6f96"
            },
            "downloads": -1,
            "filename": "bareun_apis-0.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cd3c03a1656693f271e53a68a9699a7d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 19301,
            "upload_time": "2023-01-02T05:33:05",
            "upload_time_iso_8601": "2023-01-02T05:33:05.247012Z",
            "url": "https://files.pythonhosted.org/packages/0e/61/14bcc48917bd4affd26dd0e72e6dacc13f4c7bcae950c14bed4339b3e6cd/bareun_apis-0.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-02 05:33:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "bareun-apis"
}
        
Elapsed time: 0.06371s