{ "info": { "author": "Matt Yan", "author_email": "syan4@ualberta.ca", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Build Tools" ], "description": "# hfstol\n![travis-badge](https://travis-ci.org/Madoshakalaka/hfstol.svg?branch=master)\n![code-cov](https://codecov.io/gh/Madoshakalaka/hfstol/branch/master/graphs/badge.svg)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/hfstol.svg)](https://pypi.python.org/pypi/hfstol/)\n\nhfst-optimized-lookup in python\n\n\n`pip install hfstol`\n\nAll below examples are based on two `.hfstol` files\n\nrespectively: [crk-descriptive-analyzer.hfstol crk-normative-generator.hfstol](https://github.com/UAlbertaALTLab/plains-cree-fsts/releases)\n\n\n# Use\n\nexample with `crk-descriptive-analyzer.hfstol` :\n\n```python\nfrom hfstol import HFSTOL\n\nhfst = HFSTOL.from_file('crk-descriptive-analyzer.hfstol')\n\nhfst.feed('niska')\n# returns: \n# (('niska', '+N', '+A', '+Sg'), ('niska', '+N', '+A', '+Obv'))\n\nhfst.feed_in_bulk(['niska', 'kinip\u00e2n\u00e2naw'])\n# returns: \n# {'niska': {('niska', '+N', '+A', '+Obv'), ('niska', '+N', '+A', '+Sg')}, 'kinip\u00e2n\u00e2naw': {('nip\u00e2w', '+V', '+AI', '+Ind', '+Prs', '+12Pl')}}\n\nhfst.feed_in_bulk_fast(['niska', 'kinip\u00e2n\u00e2naw'], multi_process=4)\n# returns:\n# {'niska': {'niska+N+A+Obv', 'niska+N+A+Sg'}, 'kinip\u00e2n\u00e2naw': {'nip\u00e2w+V+AI+Ind+Prs+12Pl'}}\n\n```\n\nexample with `crk-normative-generator.hfstol` :\n\n```python\nfrom hfstol import HFSTOL\n\nhfst = HFSTOL.from_file('crk-normative-generator.hfstol')\n\nhfst.feed('niska+N+A+Pl')\n# returns: \n# (('niskak',),)\n\nhfst.feed_in_bulk([\"niska+N+A+Pl\", 'nip\u00e2w+V+AI+Ind+Prs+12Pl'])\n# returns: \n# {'niska+N+A+Pl': {('niskak',)}, 'nip\u00e2w+V+AI+Ind+Prs+12Pl': {('kinip\u00e2n\u00e2naw',), ('kinip\u00e2naw',)}}\n\nhfst.feed_in_bulk_fast([\"niska+N+A+Pl\", 'nip\u00e2w+V+AI+Ind+Prs+12Pl'], multi_process=4)\n# returns:\n# {'niska+N+A+Pl': {'niskak'}, 'nip\u00e2w+V+AI+Ind+Prs+12Pl': {'kinip\u00e2n\u00e2naw', 'kinip\u00e2naw'}}\n```\n\nto see a comprehensive API behaviour including edge cases, see [this test file](https://github.com/Madoshakalaka/hfstol/blob/master/tests/test_apply.py) (what if I `feed('absolute garbage')`)\n\n# API signatures\n\n\n```python\n\n# HFSTOL.from_file\n\n@classmethod\ndef from_file(cls, filename: Union[str, pathlib.Path]): \n \"\"\"\n :param filename: the `.hfstol` file\n :return: an `HFSTOL` instance, which you can use to convert surface forms to deep forms\n \"\"\"\n pass\n\n\n# HFSTOL.feed\n\ndef feed(self, surface_form: str, concat: bool = True) -> Tuple[Tuple[str, ...], ...]:\n \"\"\"\n feed surface form to hfst\n\n :param surface_form: the surface form\n :param concat: whether to concatenate single characters\n\n example output for `surface_form` = 'niskak', with `crk-descriptive-analyzer.hfstol`\n - True: (('niska', '+N', '+A', '+Pl'), ('n\u00eesk\u00e2w', '+V', '+II', '+II', '+Cnj', '+Prs', '+3Sg'))\n - False: (('n', 'i', 's', 'k', 'a', '+N', '+A', '+Pl'), ('n', '\u00ee', 's', 'k', '\u00e2', 'w', '+V', '+II', '+II', '+Cnj', '+Prs', '+3Sg'))\n\n example output for `surface_form` = 'niska+N+A+Pl' with `crk-normative-generator.hfstol`\n - True: (('niskak',),)\n - False: (('n', 'i', 's', 'k', 'a', 'k'),)\n\n example output for `surface_form` = 'niska+N+A+Pl' with `crk-normative-generator.hfstol` (an inflection that has two spellings)\n - True: (('kinip\u00e2naw',), ('kinip\u00e2n\u00e2naw',))\n -False: (('k', 'i', 'n', 'i', 'p', '\u00e2', 'n', 'a', 'w'), ('k', 'i', 'n', 'i', 'p', '\u00e2', 'n', '\u00e2', 'n', 'a', 'w'))\n \"\"\"\n pass\n \n# HFSTOL.feed_in_bulk \n\ndef feed_in_bulk(self, surface_forms: List[str], concat=True) -> Dict[str, Set[Tuple[str, ...]]]:\n \"\"\"\n feed a multiple of surface forms to hfst at once\n\n :param surface_forms:\n :return: a dictionary with keys being each surface form fed in, values being their corresponding deep forms\n \"\"\"\n pass\n\n# HFSTOL.feed_in_bulk_fast\n\ndef feed_in_bulk_fast(self, strings: Iterable[str], multi_process: int = 1) -> Dict[str, Set[str]]:\n \"\"\"\n calls `hfstol-optimized-lookup`. Evaluation is magnitudes faster. Note the generated symbols will all be all concatenated.\n e.g. instead of ['n', 'i', 's', 'k', 'a', '+N', '+A', '+Pl'] it returns ['niska+N+A+Pl']\n\n :keyword multi_process: Defaults to 1. Specify how many parallel processes you want to speed up computation. A rule is to have processes at most your machine core count.\n \"\"\"\n\n```\n\n\n# To Use `feed_in_bulk_fast`\n\n`feed_in_bulk_fast` calls compiled C code, which can be 100 times faster than `feed_in_bulk`. \n\nIt requires `hfst-optimized-lookup` installed. Version 1.2 is tested to work. For linux system, installing can be as easy as `sudo apt install hfst`. For other systems see [installation guide](https://github.com/hfst/hfst#installation)\n\nIf `hfst-optimized-lookup` is not found, calling `feed_in_bulk_fast` throws `ImportError`", "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/Madoshakalaka/hfstol", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "hfstol", "package_url": "https://pypi.org/project/hfstol/", "platform": "", "project_url": "https://pypi.org/project/hfstol/", "project_urls": { "Bug Reports": "https://github.com/Madoshakalaka/hfstol/issues", "Funding": "https://github.com/Madoshakalaka/hfstol", "Homepage": "https://github.com/Madoshakalaka/hfstol", "Say Thanks!": "https://github.com/Madoshakalaka/hfstol", "Source": "https://github.com/Madoshakalaka/hfstol" }, "release_url": "https://pypi.org/project/hfstol/1.2.10/", "requires_dist": null, "requires_python": ">=3.5", "summary": "hfst optimised lookup reimplemented in python. Including a wrapper to the original hfst-optimized-lookup", "version": "1.2.10" }, "last_serial": 6001922, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "7bb40b829964c2819c490c9fee4409fe", "sha256": "6c66f5687f8f74c3acb13347785a804158ad96a1acb6a6e9d5a854e316014935" }, "downloads": -1, "filename": "hfstol-0.0.0.tar.gz", "has_sig": false, "md5_digest": "7bb40b829964c2819c490c9fee4409fe", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12842, "upload_time": "2019-07-23T21:54:51", "url": "https://files.pythonhosted.org/packages/98/25/9fdd3fc752c529707d5141f1f5e780d7d13de111a48b761fa0f3a60f2fb4/hfstol-0.0.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "dcf68f2461c9de959f02594f5a11591d", "sha256": "23f343f345cac71537425c889e081beb5861a9a69cdde15af827310edd3bd391" }, "downloads": -1, "filename": "hfstol-1.0.0.tar.gz", "has_sig": false, "md5_digest": "dcf68f2461c9de959f02594f5a11591d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 11326, "upload_time": "2019-07-25T20:01:23", "url": "https://files.pythonhosted.org/packages/10/fc/da271f670bf574ac4d66a8c157ed51cd06c7e0bbbf93e36d0acf1b9c0c20/hfstol-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "d8376051fec82152fbc15e47acc52394", "sha256": "b0a45cee09e2dc8a9869914b393c6ca640a2fb492b7059bcdd27e9406a368b49" }, "downloads": -1, "filename": "hfstol-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d8376051fec82152fbc15e47acc52394", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 11328, "upload_time": "2019-07-25T20:00:03", "url": "https://files.pythonhosted.org/packages/68/27/0bd8da55df711d6ca45ea8cc71e6d495fbb25f99bc01b67349de1f36a7b2/hfstol-1.0.1.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "4789d9ace73accc339417c257c56e974", "sha256": "521efaf97b4ca53b3ee839fa53216325a61dbe481fc35a1b6512118e1eebcfa8" }, "downloads": -1, "filename": "hfstol-1.1.3.tar.gz", "has_sig": false, "md5_digest": "4789d9ace73accc339417c257c56e974", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 11692, "upload_time": "2019-08-15T18:43:31", "url": "https://files.pythonhosted.org/packages/c1/de/3936b54b81fbf8ad38be07673edd036a06333f32b90a3646160f41cbaf51/hfstol-1.1.3.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "485fe250725dfb64859012e5f0b65e17", "sha256": "189871d0482ddf4153812c7ba41daa4be379f11f10ac68a556ed092ec308c245" }, "downloads": -1, "filename": "hfstol-1.1.4.tar.gz", "has_sig": false, "md5_digest": "485fe250725dfb64859012e5f0b65e17", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 11683, "upload_time": "2019-08-15T20:34:36", "url": "https://files.pythonhosted.org/packages/1e/f2/79048d36d21db98ad6341e6a72b6c71d4bd751299a7eb3d53e43a9ae7ef8/hfstol-1.1.4.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "8ddae0362a7d92a1a2aea8288dd08d4f", "sha256": "95bac2bf897d154f338782ef64b50cb0eba5f5542f15961c225e59c4a02db30a" }, "downloads": -1, "filename": "hfstol-1.2.1.tar.gz", "has_sig": false, "md5_digest": "8ddae0362a7d92a1a2aea8288dd08d4f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 11778, "upload_time": "2019-08-26T23:38:52", "url": "https://files.pythonhosted.org/packages/e5/6a/e404a5d8c824d24fac06553fe36510d27d3c9c39c0acb0a578b3922a033a/hfstol-1.2.1.tar.gz" } ], "1.2.10": [ { "comment_text": "", "digests": { "md5": "cb7d72f8e7ca075fc90e3698f7878ed7", "sha256": "6d51d9b545b8bfd5fb68f41e9f803a0202e5102241286e2828645b900e200d0d" }, "downloads": -1, "filename": "hfstol-1.2.10.tar.gz", "has_sig": false, "md5_digest": "cb7d72f8e7ca075fc90e3698f7878ed7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12653, "upload_time": "2019-10-20T04:47:50", "url": "https://files.pythonhosted.org/packages/ec/1b/25c42945822e81a92bd6886490ad78282dee1d88180596b98a94a883a831/hfstol-1.2.10.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "095b62063affc9de4ed1f8873c3de4c5", "sha256": "78e6804f65d06fc7f3e6389dd995e5f2e33c7166a28e3998a77940b81fd5056f" }, "downloads": -1, "filename": "hfstol-1.2.2.tar.gz", "has_sig": false, "md5_digest": "095b62063affc9de4ed1f8873c3de4c5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 13493, "upload_time": "2019-08-27T16:54:13", "url": "https://files.pythonhosted.org/packages/2e/0b/b4e20c909a22d608d1f2f511160f8e3fb08e547831254d491a244354fffd/hfstol-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "4750c84a35d6185d31996875d43358ba", "sha256": "c645397b044fd0ebcef55cace08b7c846d4ce034f4f1a2454ac933e87c765bab" }, "downloads": -1, "filename": "hfstol-1.2.3.tar.gz", "has_sig": false, "md5_digest": "4750c84a35d6185d31996875d43358ba", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 13499, "upload_time": "2019-08-28T15:57:03", "url": "https://files.pythonhosted.org/packages/9a/8d/378c90b8c32827b05197e9b960e7d5b6de3294d4301c5547f8f693f364af/hfstol-1.2.3.tar.gz" } ], "1.2.4": [ { "comment_text": "", "digests": { "md5": "b69b18476d650d8943bcdb016d58016c", "sha256": "681357fe1bb43ceff8b044e709decc7fe7cbd6697a6d8b326a5e6598ec45a81d" }, "downloads": -1, "filename": "hfstol-1.2.4.tar.gz", "has_sig": false, "md5_digest": "b69b18476d650d8943bcdb016d58016c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 13561, "upload_time": "2019-08-28T16:04:25", "url": "https://files.pythonhosted.org/packages/90/7b/1efcc7036729aa7cef5a76537816e4bce40bb8ba840725221862c4b7e767/hfstol-1.2.4.tar.gz" } ], "1.2.5": [ { "comment_text": "", "digests": { "md5": "23e753e3f3dd36448d4f1f58a9c0489f", "sha256": "1c023592fc6da9ba0ceb303ff9510c9cc2cda94001b8e01b71a5f2b01fbcf2ec" }, "downloads": -1, "filename": "hfstol-1.2.5.tar.gz", "has_sig": false, "md5_digest": "23e753e3f3dd36448d4f1f58a9c0489f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 13952, "upload_time": "2019-08-28T21:19:33", "url": "https://files.pythonhosted.org/packages/2c/42/bdc8a4c416437691de9c5fae677d315f2a3391e5828989765ce9fb586c7e/hfstol-1.2.5.tar.gz" } ], "1.2.6": [ { "comment_text": "", "digests": { "md5": "c27845c99d406e96c28c6a980561fc13", "sha256": "c79fb9458a4a1df8f4896d43f8906bee5b5fc0e264853a9a7e766dbf5848a30e" }, "downloads": -1, "filename": "hfstol-1.2.6.tar.gz", "has_sig": false, "md5_digest": "c27845c99d406e96c28c6a980561fc13", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12306, "upload_time": "2019-10-15T21:22:46", "url": "https://files.pythonhosted.org/packages/a8/63/751232546d7733817e1a32b02dcbe31067a73f9da9e25f7fdae377a56b38/hfstol-1.2.6.tar.gz" } ], "1.2.7": [ { "comment_text": "", "digests": { "md5": "99732fe253e2c562adb6ad357aeba372", "sha256": "139ea28085a07f8e8f2af39eec5ad2d58aa58c77de78f27e497d46890bd22166" }, "downloads": -1, "filename": "hfstol-1.2.7.tar.gz", "has_sig": false, "md5_digest": "99732fe253e2c562adb6ad357aeba372", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12303, "upload_time": "2019-10-15T21:42:13", "url": "https://files.pythonhosted.org/packages/e2/07/610373b13c32b79ed1cc501452b127c1184749cf0ad0857f7f43fd145fd2/hfstol-1.2.7.tar.gz" } ], "1.2.9": [ { "comment_text": "", "digests": { "md5": "7b4f55e57662bb536792940bea64028b", "sha256": "1c4f515374cdf12919a2c3fa075fb5b829f8ca798bc09483d88ecb3ba8e5a087" }, "downloads": -1, "filename": "hfstol-1.2.9.tar.gz", "has_sig": false, "md5_digest": "7b4f55e57662bb536792940bea64028b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12621, "upload_time": "2019-10-20T00:52:32", "url": "https://files.pythonhosted.org/packages/3d/d1/e1ce0422bd4cd3220b727a71c3b35d0666a4246891bfc3e1f10ef78e7f66/hfstol-1.2.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cb7d72f8e7ca075fc90e3698f7878ed7", "sha256": "6d51d9b545b8bfd5fb68f41e9f803a0202e5102241286e2828645b900e200d0d" }, "downloads": -1, "filename": "hfstol-1.2.10.tar.gz", "has_sig": false, "md5_digest": "cb7d72f8e7ca075fc90e3698f7878ed7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12653, "upload_time": "2019-10-20T04:47:50", "url": "https://files.pythonhosted.org/packages/ec/1b/25c42945822e81a92bd6886490ad78282dee1d88180596b98a94a883a831/hfstol-1.2.10.tar.gz" } ] }