{ "info": { "author": "Marco Lagi", "author_email": "marco dot neri dot lagi at gmail dot com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Scientific/Engineering", "Topic :: Text Processing :: Linguistic" ], "description": ".. image:: https://img.shields.io/pypi/v/quantulum.svg\n :target: https://pypi.python.org/pypi/quantulum\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/l/quantulum.svg\n :target: https://pypi.python.org/pypi/quantulum\n :alt: License\n\n.. image:: https://img.shields.io/pypi/pyversions/quantulum.svg\n :target: https://pypi.python.org/pypi/quantulum\n :alt: Python Versions\n\n.. image:: https://travis-ci.org/marcolagi/quantulum.svg?branch=master\n :target: https://travis-ci.org/marcolagi/quantulum\n :alt: CI\n\n.. image:: https://coveralls.io/repos/github/marcolagi/quantulum/badge.svg?branch=master\n :target: https://coveralls.io/github/marcolagi/quantulum?branch=master\n :alt: Coverage\n\n.. image:: https://landscape.io/github/marcolagi/quantulum/master/landscape.png\n :target: https://landscape.io/github/marcolagi/quantulum/master\n :alt: Health\n\n.. image:: https://badge.waffle.io/marcolagi/quantulum.png?label=ready&title=Ready\n :target: https://waffle.io/marcolagi/quantulum\n :alt: Tasks\n\nquantulum\n=========\n\nPython library for information extraction of quantities, measurements and their units from unstructured text.\n\nDemo\n----\n\nTry it `here `_.\n\n\nInstallation\n------------\n\nFirst, install `sklearn `_. Quantulum would still work without it, but it wouldn't be able to disambiguate between units with the same name (e.g. *pound* as currency or as unit of mass).\n\nThen,\n\n.. code-block:: bash\n\n $ pip install quantulum\n\nUsage\n-----\n\n.. code-block:: python\n\n >>> from quantulum import parser\n >>> quants = parser.parse('I want 2 liters of wine')\n >>> quants\n [Quantity(2, 'litre')]\n\nThe *Quantity* class stores the surface of the original text it was extracted from, as well as the (start, end) positions of the match:\n\n.. code-block:: python\n\n >>> quants[0].surface\n u'2 liters'\n >>> quants[0].span\n (7, 15)\n\nAn inline parser that embeds the parsed quantities in the text is also available (especially useful for debugging):\n\n.. code-block:: python\n\n >>> print parser.inline_parse('I want 2 liters of wine')\n I want 2 liters {Quantity(2, \"litre\")} of wine\n\n\nUnits and entities\n------------------\n\nAll units (e.g. *litre*) and the entities they are associated to (e.g. *volume*) are reconciled against WikiPedia:\n\n.. code-block:: python\n\n >>> quants[0].unit\n Unit(name=\"litre\", entity=Entity(\"volume\"), uri=https://en.wikipedia.org/wiki/Litre)\n\n >>> quants[0].unit.entity\n Entity(name=\"volume\", uri=https://en.wikipedia.org/wiki/Volume)\n\nThis library includes more than 290 units and 75 entities. It also parses spelled-out numbers, ranges and uncertainties:\n\n.. code-block:: python\n\n >>> parser.parse('I want a gallon of beer')\n [Quantity(1, 'gallon')]\n\n >>> parser.parse('The LHC smashes proton beams at 12.8\u201313.0 TeV')\n [Quantity(12.8, \"teraelectronvolt\"), Quantity(13, \"teraelectronvolt\")]\n\n >>> quant = parser.parse('The LHC smashes proton beams at 12.9\u00b10.1 TeV')\n >>> quant[0].uncertainty\n 0.1\n\nNon-standard units usually don't have a WikiPedia page. The parser will still try to guess their underlying entity based on their dimensionality:\n\n.. code-block:: python\n\n >>> parser.parse('Sound travels at 0.34 km/s')[0].unit\n Unit(name=\"kilometre per second\", entity=Entity(\"speed\"), uri=None)\n\n\nDisambiguation\n--------------\n\nIf the parser detects an ambiguity, a classifier based on the WikiPedia pages of the ambiguous units or entities tries to guess the right one:\n\n.. code-block:: python\n\n >>> parser.parse('I spent 20 pounds on this!')\n [Quantity(20, \"pound sterling\")]\n\n >>> parser.parse('It weighs no more than 20 pounds')\n [Quantity(20, \"pound-mass\")]\n\nor:\n\n.. code-block:: python\n\n >>> text = 'The average density of the Earth is about 5.5x10-3 kg/cm\u00b3'\n >>> parser.parse(text)[0].unit.entity\n Entity(name=\"density\", uri=https://en.wikipedia.org/wiki/Density)\n\n >>> text = 'The amount of O\u2082 is 2.98e-4 kg per liter of atmosphere'\n >>> parser.parse(text)[0].unit.entity\n Entity(name=\"concentration\", uri=https://en.wikipedia.org/wiki/Concentration)\n\nManipulation\n------------\n\nWhile quantities cannot be manipulated within this library, there are many great options out there:\n\n- `pint `_\n- `natu `_\n- `quantities `_\n\nExtension\n---------\n\nSee *units.json* for the complete list of units and *entities.json* for the complete list of entities. The criteria for adding units have been:\n\n- the unit has (or is redirected to) a WikiPedia page\n- the unit is in common use (e.g. not the `premetric Swedish units of measurement `_).\n\nIt's easy to extend these two files to the units/entities of interest. Here is an example of an entry in *entities.json*:\n\n.. code-block:: python\n\n {\n \"name\": \"speed\",\n \"dimensions\": [{\"base\": \"length\", \"power\": 1}, {\"base\": \"time\", \"power\": -1}],\n \"URI\": \"https://en.wikipedia.org/wiki/Speed\"\n }\n\n- *name* and *URI* are self explanatory.\n- *dimensions* is the dimensionality, a list of dictionaries each having a *base* (the name of another entity) and a *power* (an integer, can be negative).\n\nHere is an example of an entry in *units.json*:\n\n.. code-block:: python\n\n {\n \"name\": \"metre per second\",\n \"surfaces\": [\"metre per second\", \"meter per second\"],\n \"entity\": \"speed\",\n \"URI\": \"https://en.wikipedia.org/wiki/Metre_per_second\",\n \"dimensions\": [{\"base\": \"metre\", \"power\": 1}, {\"base\": \"second\", \"power\": -1}],\n \"symbols\": [\"mps\"]\n }\n\n- *name* and *URI* are self explanatory.\n- *surfaces* is a list of strings that refer to that unit. The library takes care of plurals, no need to specify them.\n- *entity* is the name of an entity in *entities.json*\n- *dimensions* follows the same schema as in *entities.json*, but the *base* is the name of another unit, not of another entity.\n- *symbols* is a list of possible symbols and abbreviations for that unit.\n\nAll fields are case sensitive.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/marcolagi/quantulum/tarball/0.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/marcolagi/quantulum", "keywords": "information extraction,quantities,units,measurements,nlp,natural language processing,text mining,text processing", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "quantulum", "package_url": "https://pypi.org/project/quantulum/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/quantulum/", "project_urls": { "Download": "https://github.com/marcolagi/quantulum/tarball/0.1", "Homepage": "https://github.com/marcolagi/quantulum" }, "release_url": "https://pypi.org/project/quantulum/0.1.16/", "requires_dist": null, "requires_python": null, "summary": "Extract quantities from unstructured text.", "version": "0.1.16" }, "last_serial": 2280616, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "abfa12fc9081533101c6d3b042d3e45b", "sha256": "e50f2f82246ed78e7201df95ead8a61ae571f4cb05867a5103452d3decf511c4" }, "downloads": -1, "filename": "quantulum-0.1.0.tar.gz", "has_sig": false, "md5_digest": "abfa12fc9081533101c6d3b042d3e45b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16019, "upload_time": "2016-05-02T01:44:26", "url": "https://files.pythonhosted.org/packages/2b/3d/a3bfe65fe1a9c58e103eda66380b708cda4811f0e6a514fa9d27010a90c4/quantulum-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "9b9ffb05a72399b77a9d106e880a8e48", "sha256": "5b0b8ea1782dccc26dc56f7195c2f8cd57952683d9dc3a50a68b2b3d3dc20483" }, "downloads": -1, "filename": "quantulum-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9b9ffb05a72399b77a9d106e880a8e48", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15975, "upload_time": "2016-05-02T02:17:23", "url": "https://files.pythonhosted.org/packages/05/52/a1e74b984e598b3090e138d2d0b225e77b1cb215e0c79aca3bafb0775350/quantulum-0.1.1.tar.gz" } ], "0.1.10": [ { "comment_text": "", "digests": { "md5": "350d0e96c41dcdf1566bdff30289905a", "sha256": "30ac2a0b781e4ab9d134fd00a08bec780e77d4db8c6fcc3d2f7ae0d6a3e79e0e" }, "downloads": -1, "filename": "quantulum-0.1.10.tar.gz", "has_sig": false, "md5_digest": "350d0e96c41dcdf1566bdff30289905a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2168172, "upload_time": "2016-05-02T04:21:40", "url": "https://files.pythonhosted.org/packages/b0/f4/3fa15c7bc3a2682e239d854a74421e06037bc9c3a66b1d07405f6eb35299/quantulum-0.1.10.tar.gz" } ], "0.1.11": [ { "comment_text": "", "digests": { "md5": "1dee6be0c504652ba5c602810dfb560e", "sha256": "1a4118473787d74c309d49ef50a942e8cf29e8e11166d6506b5d1adeb856bb2d" }, "downloads": -1, "filename": "quantulum-0.1.11.tar.gz", "has_sig": false, "md5_digest": "1dee6be0c504652ba5c602810dfb560e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2401619, "upload_time": "2016-05-02T04:22:52", "url": "https://files.pythonhosted.org/packages/87/b9/dc34a1527929c2f290dc18defa89b645d580b4402cdab267df5700e6d51c/quantulum-0.1.11.tar.gz" } ], "0.1.12": [ { "comment_text": "", "digests": { "md5": "a842003c6bd30a3e7630554cd3e0ff58", "sha256": "57422451b9d09ed00f99438e10b9c271b5f1324b59cb5a697a05fdff2ca80d86" }, "downloads": -1, "filename": "quantulum-0.1.12.tar.gz", "has_sig": false, "md5_digest": "a842003c6bd30a3e7630554cd3e0ff58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2401757, "upload_time": "2016-05-07T02:25:11", "url": "https://files.pythonhosted.org/packages/55/e7/85c4b4346713fa1dcf158ec4a5487be64e1ddfdf2e13e1be9429ccaa567e/quantulum-0.1.12.tar.gz" } ], "0.1.13": [ { "comment_text": "", "digests": { "md5": "9f166e3066705c1358229b2b5b58be4b", "sha256": "7d31a90c47405aabc4b85425871d55cdd3426f0695e71925dd404602a580a01f" }, "downloads": -1, "filename": "quantulum-0.1.13.tar.gz", "has_sig": false, "md5_digest": "9f166e3066705c1358229b2b5b58be4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2402104, "upload_time": "2016-05-07T03:28:35", "url": "https://files.pythonhosted.org/packages/bc/59/8e1825f98a9f858c712c3e11b97a2eec3b9912a110fa3a35e7a4412b4450/quantulum-0.1.13.tar.gz" } ], "0.1.14": [], "0.1.15": [], "0.1.16": [], "0.1.2": [ { "comment_text": "", "digests": { "md5": "98f1145c51a5bd2d88ed76dd2fd21a77", "sha256": "60a2c6679734887fa4e523a4c58d4d23e58d8e80ff73b91ad3d3ae0a480ae028" }, "downloads": -1, "filename": "quantulum-0.1.2.tar.gz", "has_sig": false, "md5_digest": "98f1145c51a5bd2d88ed76dd2fd21a77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15991, "upload_time": "2016-05-02T02:36:04", "url": "https://files.pythonhosted.org/packages/21/a5/18fc5840d1aa673bb93bc7f880993fae3c99eef3120b35f8f4f9cde19699/quantulum-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "46013d8a45141e700943672eb0b41d9a", "sha256": "5f0176a043cf1e3b7ea2cadaf07ac85f9c897bb427d86a7989eb35089f4cf400" }, "downloads": -1, "filename": "quantulum-0.1.3.tar.gz", "has_sig": false, "md5_digest": "46013d8a45141e700943672eb0b41d9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15956, "upload_time": "2016-05-02T02:50:48", "url": "https://files.pythonhosted.org/packages/61/c5/d797136ad88826308f06eecb3f02d380bce184971ea05714a7b5443806c8/quantulum-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "92f9560e9b6b6a70820509cd1e579727", "sha256": "e74e2a46e4c86dde0721a11efff35fc053ac585d1d85303b5ea70ba06f955266" }, "downloads": -1, "filename": "quantulum-0.1.4.tar.gz", "has_sig": false, "md5_digest": "92f9560e9b6b6a70820509cd1e579727", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15953, "upload_time": "2016-05-02T02:53:35", "url": "https://files.pythonhosted.org/packages/99/75/9ede6e3de09d91eb44076f7e582d83f952cda779d3cda4f9614eb4b4ce25/quantulum-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "dc388618cfe45e3e489270e5af9b896f", "sha256": "b3c7b5d422b74a11ea5348cff680682b99986af82129e1306520d6f3dfd951ad" }, "downloads": -1, "filename": "quantulum-0.1.5.tar.gz", "has_sig": false, "md5_digest": "dc388618cfe45e3e489270e5af9b896f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15944, "upload_time": "2016-05-02T03:02:45", "url": "https://files.pythonhosted.org/packages/db/5d/b17fa371a99722eb5cbeb258bb3abe862e22f5f2ed324729129851512679/quantulum-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "ef6159049fa5305f88ef9b33bfb91ee6", "sha256": "238924d1b9e1522dc1175ed36c7588d3a89486b43572e206e102abe8d0b347ac" }, "downloads": -1, "filename": "quantulum-0.1.6.tar.gz", "has_sig": false, "md5_digest": "ef6159049fa5305f88ef9b33bfb91ee6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15991, "upload_time": "2016-05-02T03:13:46", "url": "https://files.pythonhosted.org/packages/dd/a6/ed19affe096b545b39ef53f703a4ad6b727ae81e8405d8453cb6464fd25a/quantulum-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "c0cd26d02ed3e0f7d3da0b1febf8204b", "sha256": "765fb5839f4ebb16effdc3227ea155c77ff60129a9cc9d3f3a43ae086619d2fd" }, "downloads": -1, "filename": "quantulum-0.1.7.tar.gz", "has_sig": false, "md5_digest": "c0cd26d02ed3e0f7d3da0b1febf8204b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15992, "upload_time": "2016-05-02T03:17:10", "url": "https://files.pythonhosted.org/packages/e5/b4/f7009ed43fd99c29b2a5d50183982fac640e6b202da8152313fa4f672b9c/quantulum-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "92015d27709d5c8f891ec8ca2c344302", "sha256": "329725c051d0480f12e99b3e70092fae934879d03b5925af4297934f830205c3" }, "downloads": -1, "filename": "quantulum-0.1.8.tar.gz", "has_sig": false, "md5_digest": "92015d27709d5c8f891ec8ca2c344302", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2168173, "upload_time": "2016-05-02T03:21:59", "url": "https://files.pythonhosted.org/packages/50/a2/005b02628a42ce4b62ffa682baa5a8c0d3c50986552014c0c09bd39d9d3d/quantulum-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "2ca15bae20d7357a9e95ac03eff40041", "sha256": "78b1627907e8f05db9704d2ab4b0a45ace3ad1d2933af979e67bc34ff63cf7cd" }, "downloads": -1, "filename": "quantulum-0.1.9.tar.gz", "has_sig": false, "md5_digest": "2ca15bae20d7357a9e95ac03eff40041", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2168184, "upload_time": "2016-05-02T03:25:14", "url": "https://files.pythonhosted.org/packages/4e/6c/10151b9a0944b9184bebee3787f8a986b9f885d1e72f2a219f0a74df5d3a/quantulum-0.1.9.tar.gz" } ] }, "urls": [] }