{ "info": { "author": "Syntpump", "author_email": "lynnporu@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License" ], "description": "[![Pypi](https://img.shields.io/pypi/v/ctx19.svg)](https://pypi.python.org/pypi/ctx19)\n\n# Contextual19 Python Interpreter\n\nThis module provides you 2 classes to work with Ctx19. \nYou can [read here about Contextual19](https://github.com/syntpump/contextual19/).\n\n## `ctx19.parsers.Contextual19Parser`\n\nThis is just regular parser that takes rules in object representation.\n\n### Initialization\n\nTo initialize this class, just call it and take there rules in object representation:\n\n```python\nfrom ctx19.parsers import Contextual19Parser\ndata = [\n\t{\n\t\t\"if\": ...,\n\t\t\"then\": ...\n\t},\n\t...\n]\nparser = Contextual19Parser(data)\n```\n\nData you passed will be stored in `parser.data`.\n\n### Keywords\n* `bool` `saveContext` (default is `True`) \n\tThis parameter set transformation resistance of the rules. Suppose, we have this sentence: \n\t`[{a:0}, {a:1}, {a:2}]`, \n\tand this rules (inline-written): \n\t#1: `if previous a is 0 then a becomes 2`, \n\t#2: `if previous a is 1 then a becomes 3`. \n\tAfter executing rule #1 sentence becomes: \n\t`[{a:0}, {a:2}, {a:2}]` \n\tNow the rule #2 is not appliable in this contexts. That is what means \"transformation nonresistance\". To make the rule #2 work, `saveContext` must be set to `True` and Ctx19 module will remember original sentence before applying rules (via `deepcopy`, so some additional memory will be needed).\n\n### Methods\n\n* `apply(sentence: list) -> list` \n\tThis method apply rules, stored in `self.data` to the sentence you passed. \n\t`sentence` is the list of dictionaries which represents tokens with their properties. It can look like this:\n\t```json\n\t[\n\t\t{\n\t\t\t\"tense\": \"past\",\n\t\t\t\"gender\": \"neutral\",\n\t\t\t\"some_other_stuff\": \"other_value\"\n\t\t},\n\t\t{\n\t\t\t\"tense\": \"future\",\n\t\t\t\"voice\": \"active\",\n\t\t\t\"another_property\": \"another_value\"\n\t\t}\n\t]\n\t```\n\tMissing properties will be skipped.\n* `save(filepath: str) -> void` \n\tThis method will simply save the rules stored in `self.data` into file you passed as `filepath`.\n\n### Private methods\n\nThere's also some methods that should not be used in your code, but they are widely used in `Contextual19Parser.apply` method and they can be useful in some cases.\n\n* `ruleIsAppliable(rule: dict, sentence: list, token: int) -> bool` \n\tCheck if the given `rule` is appliable to the `token`th token in the `sentence`. It'll check the context.\n\n## `ctx19.parsers.Contextual19FileParser`\n\nThis is the children of `Contextual19Parser` class with the changed initialization method.\n\n### Initialization\n\nTo initialize this parser just pass path to file with rules as the `f` parameter:\n\n```python\nfrom ctx19.parsers import Contextual19FileParser\nparser = Contextual19FileParser(open(\"path/to/file.ctx19\"))\n```\n\n### Keywords\n* `bool` `astext` \n\tSet this to `True` to read text from `f` parameter instead of dealing with it as file.\n\t**Example of use:**\n\t```python\n\tdata = '''\n\tif\n\t\t...\n\tthen\n\t\t...\n\t...\n\t'''\n\tparser = Contextual19FileParser(data, astext=True)\n\t```\n\nSince this is the `Contextual19Parser` children, it'll inherit all the parent methods, but one new private was added.\n\n### Private methods\n\n* `parseFile(void) -> void` \n\tThis will parse Contextual19 syntax from the file saved in `self.file`. You can change the file and call this method again.\n\n## Reading other object notation formats\n\nFrom 1.2 version JSON and YAML parsers was moved in order to make ctx19 independent from other packages, but you can still do it yourself. Here's the example:\n```python\nimport json\nfrom ctx19.parsers import Contextual19Parser\nctx = Contextual19Parser(json.load(\"path/to/file.json\"))\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/syntpump/contextual19", "keywords": "nlp", "license": "", "maintainer": "", "maintainer_email": "", "name": "ctx19", "package_url": "https://pypi.org/project/ctx19/", "platform": "", "project_url": "https://pypi.org/project/ctx19/", "project_urls": { "Homepage": "https://github.com/syntpump/contextual19", "Syntpump on GitHub": "https://github.com/syntpump" }, "release_url": "https://pypi.org/project/ctx19/1.3/", "requires_dist": null, "requires_python": ">3", "summary": "A Python driver for Contextual19 markup language", "version": "1.3" }, "last_serial": 4838344, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "2418c67babdb163fb47ad0f66f788d3b", "sha256": "db420e629e29606541e634e9c296e29dbef188b82a3da2548d848b801064e9a2" }, "downloads": -1, "filename": "ctx19-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "2418c67babdb163fb47ad0f66f788d3b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3", "size": 3245, "upload_time": "2019-02-10T03:10:33", "url": "https://files.pythonhosted.org/packages/23/f6/1d43948ba0d79bc744dc8344134fc53ac9363135ae9024d24103c92ba3b1/ctx19-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dc6bda1d15469678f709faef9c34f684", "sha256": "4010897f2fa6ad5096e35e8d3d8e59141e417b3e5b9db0a606f8f61c6305c2bf" }, "downloads": -1, "filename": "ctx19-1.0.tar.gz", "has_sig": false, "md5_digest": "dc6bda1d15469678f709faef9c34f684", "packagetype": "sdist", "python_version": "source", "requires_python": ">3", "size": 6023, "upload_time": "2019-02-10T03:10:35", "url": "https://files.pythonhosted.org/packages/b6/25/39bd78e0d5f1bb105c9d3a40df2db88c8ee51f3b0ae078fb819bb8b76087/ctx19-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "2e28f3ec5ce0f06c5c7841439f6d9b7b", "sha256": "06930691ea9e51765280d641ee02d5623abc35b0961796afd8b27b9a81e16ab6" }, "downloads": -1, "filename": "ctx19-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2e28f3ec5ce0f06c5c7841439f6d9b7b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3", "size": 3275, "upload_time": "2019-02-10T03:29:19", "url": "https://files.pythonhosted.org/packages/59/a5/b834425b494d15e530f54b3fe66745bded02965e3a05036beeb1c2e30e66/ctx19-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "53e9ac02599ede08b7a23a51fc022956", "sha256": "af4590a1ffa7963a0b22ba37378cbaa07b3cf46a9232a9c1856d12972a7d804f" }, "downloads": -1, "filename": "ctx19-1.0.1.tar.gz", "has_sig": false, "md5_digest": "53e9ac02599ede08b7a23a51fc022956", "packagetype": "sdist", "python_version": "source", "requires_python": ">3", "size": 6020, "upload_time": "2019-02-10T03:29:20", "url": "https://files.pythonhosted.org/packages/18/6b/3ecdcf0a649d794ecbfcdb32a16f33574aa12d1dc8522e1924650242782f/ctx19-1.0.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "bd4e08ddfb8aa0a2bfa3b67f144d6d93", "sha256": "1f5c5dcdef325dfb97828d027b7742fa12103b8788f7b844fd4d961bb11d8c33" }, "downloads": -1, "filename": "ctx19-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "bd4e08ddfb8aa0a2bfa3b67f144d6d93", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3", "size": 6883, "upload_time": "2019-02-10T19:16:48", "url": "https://files.pythonhosted.org/packages/20/d5/dafd4228104fc5c759ef6c8ed28ea764c15f69e19b131c5a25f11123ebf1/ctx19-1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "137ddf84068c8f25a5e94c4db42d5660", "sha256": "32aef05fba22531ef2c0303e81216b8da641dd75b26da15ee7a320f8c68e0e04" }, "downloads": -1, "filename": "ctx19-1.2.tar.gz", "has_sig": false, "md5_digest": "137ddf84068c8f25a5e94c4db42d5660", "packagetype": "sdist", "python_version": "source", "requires_python": ">3", "size": 5822, "upload_time": "2019-02-10T19:16:49", "url": "https://files.pythonhosted.org/packages/93/94/20a175c095756a2683bac182c1a2498c210053b94e0f3aca1fd73a919aaf/ctx19-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "c65bdc67cd9b47f51ed56ede81ce6b82", "sha256": "20548d2c5980236b34f8031c11ab047d446a65c5cdb1102f91e7d46552230cea" }, "downloads": -1, "filename": "ctx19-1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c65bdc67cd9b47f51ed56ede81ce6b82", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3", "size": 6835, "upload_time": "2019-02-19T07:06:05", "url": "https://files.pythonhosted.org/packages/66/68/06f9de4e31c9fc7c851d3e02d19da5ed65817f050a90d8325ab385b675e4/ctx19-1.3-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c65bdc67cd9b47f51ed56ede81ce6b82", "sha256": "20548d2c5980236b34f8031c11ab047d446a65c5cdb1102f91e7d46552230cea" }, "downloads": -1, "filename": "ctx19-1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c65bdc67cd9b47f51ed56ede81ce6b82", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3", "size": 6835, "upload_time": "2019-02-19T07:06:05", "url": "https://files.pythonhosted.org/packages/66/68/06f9de4e31c9fc7c851d3e02d19da5ed65817f050a90d8325ab385b675e4/ctx19-1.3-py3-none-any.whl" } ] }