semvec/pypi-packages huggingface dataset:
py-mu 0.2.0
Relatively tiny library for natural language-ish math expressions
License: MIT
Requires Python: >=3.8,<4.0

# µPy

"natural" language parser for math, basically.

## Project goal

I aim this to be able to parse and evaluate both "natural" (i.e. `divide 2ft 1in x 1ft 3in by 4` => `6.25"x3.75`) and more "normalised" expressions (i.e. `5! / 2^3` => `15`)

Of course, that isn't exactly trivial, so this is what I'd be working on first:

-   [ ] Common math functions (log, cos, sin etc)
-   [ ] Complex number support
-   [ ] And, these as optional features:
    -   [ ] Numpy arrays (yeah those are cool)
    -   [ ] Units (probably `unyt` or `pint`)
    -   [ ] Uhm `sympy` stuff
    -   [ ] Some kind of proper NLP library (`spacy`?)
-   [ ] i forgor this too 💀

At some point...:

-   [ ] Actual dataset ??
-   [ ] Something something plotting data
-   [ ] World domination.

_okay, maybe "tiny" is a stretch..._

## Intended API

in _some_ future where this does work...:

```py
import mu
from mu.ast import Funcs
from mu.ast import Tree
from mu.types import Num


assert mu.parse('4 / 2') == mu.parse('divide 4 by 2')
assert mu.parse('log2(128)') == Tree(Funcs.log(Num(4), Num(2)))
assert mu.eval('32 times 9') == 288
```

But mostly, as a higher-level API: `mu.eval(...)`.