https://github.com/gunthercox/mathparse
A Python library for evaluating natural language mathematical equations
https://github.com/gunthercox/mathparse
mathematics nlp python
Last synced: 3 months ago
JSON representation
A Python library for evaluating natural language mathematical equations
- Host: GitHub
- URL: https://github.com/gunthercox/mathparse
- Owner: gunthercox
- License: mit
- Created: 2016-11-24T17:33:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-09-06T17:44:54.000Z (almost 3 years ago)
- Last Synced: 2024-05-18T08:02:15.800Z (about 1 year ago)
- Topics: mathematics, nlp, python
- Language: Python
- Homepage: http://mathparse.readthedocs.io
- Size: 324 KB
- Stars: 50
- Watchers: 5
- Forks: 16
- Open Issues: 19
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
=========
mathparse
=========.. image:: https://travis-ci.org/gunthercox/mathparse.svg?branch=master
:target: https://travis-ci.org/gunthercox/mathparseThe mathparse library is a Python module designed to evaluate mathematical equations contained in strings.
Here are a few examples:
.. code-block:: python
from mathparse import mathparse
mathparse.parse('50 * (85 / 100)')
>>> 42.5mathparse.parse('one hundred times fifty four', mathparse.codes.ENG)
>>> 5400mathparse.parse('(seven * nine) + 8 - (45 plus two)', language='ENG')
>>> 24Installation
============.. code-block:: bash
pip install mathparse
Language support
================The language parameter must be set in order to evaluate an equation that uses word operators.
The language code should be a valid `ISO 639-2`_ language code.History
=======See `release notes`_ for changes.
.. _`ISO 639-2`: https://www.loc.gov/standards/iso639-2/php/code_list.php
.. _`release notes`: https://github.com/gunthercox/ChatterBot/releases