{ "info": { "author": "Jeremy Orme", "author_email": "me@jeremyorme.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# pyfathom\nText comprehension library for python\n\n## Blog\nFollow the development of this project at http://jeremyorme.com\n\n## Example\nGiven a collection of input strings with varying syntax:\n\n```\nfrom pyfathom import *\n\nin_strs = [\n '180g | 1 cup uncooked brown rice',\n '\u00bd small butternut squash , cubed',\n '5\u00bd tablespoons tahini (you can sub cashew butter)',\n 'pecans 125g',\n 'flat-leaf parsley a bunch, roughly chopped',\n 'rocket 70g',\n 'leftover marinade from the mushrooms',\n '15 oz (425 g) black beans, drained (reserve \u00bc cup (60 ml) of the juice) and rinsed well',\n '1/4 teaspoon Garam Masala, for garnish',\n '2 tablespoons chopped cilantro, for garnish'\n]\n```\n\nand a set of \"knowledge\" rules defining what is known about the inputs, e.g.:\n```\nknowledge = '''\n/pinch/ is unit\n/mls?|mL|cc|millilitres?|milliliters?/ is unit\n/tsps?|t|teaspoons?/ is unit\n/tbsps?|Tbsps?|T|tbl|tbs|tablespoons?/ is unit\n/floz/ is unit\n/fl/,/oz/ is unit\n/fluid/,/ounces?/ is unit\n/p|pts?|pints?/ is unit\n/ls?|L|litres?|liters?/ is unit\n/gals?|gallons?/ is unit\n/dls?|dL|decilitre|deciliter/ is unit\n/gs?|grams?|grammes?/ is unit\n/oz|ounces?/ is unit\n/lbs?|#|pounds?/ is unit\n/kgs?|kilos?|kilograms?/ is unit\n/\\d+/?,/\\d+\\/\\d+/ is number\n/\\d+(\\.\\d+)?/ is number\n/\\d*[\u00bd\u2153\u2154\u00bc\u00be\u2155\u2156\u2157\u2158\u2159\u215a\u215b\u215c\u215d\u215e]/ is number\n/a/ is number-word\nnumber,/-|\u2013/,number is range\n/cups?/ is unit\nrange|number|number-word,/\\-/?,unit?,/\\./?,/of/? is amount\namount?,/plus/?,amount?,/[a-zA-Z\\-]+/+,amount? is ,,,ingredient,\n'''\n```\n\nPyFathom attempts to label each part of the string with a type name:\n```\ncls = classifier(knowledge)\nfor in_str in in_strs:\n print(cls.classify(in_str))\n```\n\nOutput:\n```\n180g|1cupuncooked brown rice\n\u00bdsmall butternut squash,cubed\n5\u00bdtablespoonstahini(you can sub cashew butter)\npecans125g\nflat-leaf parsleyabunch,roughly chopped\nrocket70g\nleftover marinade from the mushrooms\n15oz(425g)black beans,drained(reserve\u00bccup(60ml)of the juice)and rinsed well\n1/4teaspoonGaram Masala,for garnish\n2tablespoonschopped cilantro,for garnish\n```\n\nand can extract the parts of a particular type, e.g. ingredient:\n```\nfor in_str in in_strs:\n print(cls.classify(in_str).extract_typed('ingredient')[0])\n```\n\nOutput:\n```\nuncooked brown rice\nsmall butternut squash\ntahini\npecans\nflat-leaf parsley a bunch\nrocket\nleftover marinade from the mushrooms\nblack beans\nGaram Masala\nchopped cilantro\n```\n\n## Release notes\n\n### 0.0.2\n\n* Lazy matcher\n* Bug fixes\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/jeremyorme/pyfathom", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pyfathom", "package_url": "https://pypi.org/project/pyfathom/", "platform": "", "project_url": "https://pypi.org/project/pyfathom/", "project_urls": { "Homepage": "https://github.com/jeremyorme/pyfathom" }, "release_url": "https://pypi.org/project/pyfathom/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "Text comprehension library for Python", "version": "0.0.2" }, "last_serial": 5868152, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "9f61de729f7b174349b3a1509d2cdb30", "sha256": "d4f2854fdca1b466fed97d2dae6abe32bee77c41cd8a087b3f45301c65242f0b" }, "downloads": -1, "filename": "pyfathom-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9f61de729f7b174349b3a1509d2cdb30", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6798, "upload_time": "2019-08-26T09:08:30", "url": "https://files.pythonhosted.org/packages/db/1f/1d06cf031dbe7d8939cbc214ff6c4578041eed96e01d855e0a20dfa46fb0/pyfathom-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "53efec0c7b47be289826fcfa180318a1", "sha256": "6bfd555990f22c158073cf31588dbc4ca3c9e0c4590f3a0fc0696a85e3f17225" }, "downloads": -1, "filename": "pyfathom-0.0.1.tar.gz", "has_sig": false, "md5_digest": "53efec0c7b47be289826fcfa180318a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4613, "upload_time": "2019-08-26T09:08:32", "url": "https://files.pythonhosted.org/packages/55/29/e4a0486279eb2fee262f65fb553e9b99a963f8897ca88b11ef5fb1901b9b/pyfathom-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "1101779d5cb9ae0d79454d85fe55b0ae", "sha256": "5068c607c85f2b002fed744fdbb835788637e46e4b100e7589ef8e49e5be6add" }, "downloads": -1, "filename": "pyfathom-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "1101779d5cb9ae0d79454d85fe55b0ae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7535, "upload_time": "2019-09-22T07:19:40", "url": "https://files.pythonhosted.org/packages/13/2b/786c410b81f38a3566c17d97f233d4828955ae0087c23f3c0f3b8111dcb8/pyfathom-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e51ecd803d41738d9e0e6a911f3f871c", "sha256": "8d95824ab7a23a38735690cf402bd2a19ed5c9cbf6af50382beb7b01dc0ac6d5" }, "downloads": -1, "filename": "pyfathom-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e51ecd803d41738d9e0e6a911f3f871c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5406, "upload_time": "2019-09-22T07:19:43", "url": "https://files.pythonhosted.org/packages/79/85/c19f08beff7f5bf69fc0a969faf3926eebc1935e63c51cb48673a8c68530/pyfathom-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1101779d5cb9ae0d79454d85fe55b0ae", "sha256": "5068c607c85f2b002fed744fdbb835788637e46e4b100e7589ef8e49e5be6add" }, "downloads": -1, "filename": "pyfathom-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "1101779d5cb9ae0d79454d85fe55b0ae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7535, "upload_time": "2019-09-22T07:19:40", "url": "https://files.pythonhosted.org/packages/13/2b/786c410b81f38a3566c17d97f233d4828955ae0087c23f3c0f3b8111dcb8/pyfathom-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e51ecd803d41738d9e0e6a911f3f871c", "sha256": "8d95824ab7a23a38735690cf402bd2a19ed5c9cbf6af50382beb7b01dc0ac6d5" }, "downloads": -1, "filename": "pyfathom-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e51ecd803d41738d9e0e6a911f3f871c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5406, "upload_time": "2019-09-22T07:19:43", "url": "https://files.pythonhosted.org/packages/79/85/c19f08beff7f5bf69fc0a969faf3926eebc1935e63c51cb48673a8c68530/pyfathom-0.0.2.tar.gz" } ] }