semvec/pypi-packages huggingface dataset:
nangram 0.0.6
Small little context-free expression generator and parser using user provided EBNF-like source.
Requires Python: >=3.8

# NanGram

Negative Nancy's expression generator & parser! XD

Write grammars, generate random expressions, parse expressions.

## Installation

```bash
pip install nangram
```

## Usage

First write yourself a nice little grammar like this!:

`grammar.bnf`:
```
determiner = "the " | "a " .
noun = "cat " | "dog " | "chair " .
verb = "runs " | "snacks " | "plays " .
adverb = "quickly" | "ferociously" | "sneakily" .

noun_phrase = determiner noun .
verb_phrase = verb adverb .
sentence = noun_phrase verb_phrase .

main = sentence .
```

Then import `nangram` and load the grammar source:

```python
import nangram

grammar = nangram.Grammar.load_bnf('grammar.bnf')
```

Then generate some expressions!:

```python
for expression in grammar.generate():
    print(expression)
```

And you get...

```
the cat plays ferociously
the dog plays ferociously
the chair snacks quickly
a cat snacks quickly
a dog runs quickly
a dog snacks ferociously
a dog plays quickly
a chair plays ferociously
```

Then try parsing something:

```python
for parse_tree in grammar.parse('a cat snacks sneakily'):
    print(parse_tree)
```

And you get...

```
sentence = 'a cat snacks sneakily'
├ noun_phrase = 'a cat '
│ ├ determiner = 'a '
│ └ noun = 'cat '
└ verb_phrase = 'snacks sneakily'
  ├ verb = 'snacks '
  └ adverb = 'sneakily'
```

(The parser will yield as many parse trees as are valid, so if you have an ambiguous grammar, for example, you can parse all variations. If the expression is not in the language, you won't get any parse trees.)

See `examples/english.bnf` and `examples/english.py` for another example.
tdextensions 1.0.0rc1
Teradata Consulting Python Client Extensions
Requires Python: >=3.6.0

# Teradata ML Extensions

Extensions to the core teradataml library by Teradata Consulting to aid in field development work around BYOM, STO, RTO and AnalyticOps solutions.

## Installation

You can install via pip.

```
pip install tdextension
```

## Usage

You must use the same version of python on your client side as is used in Teradata (3.6+ at the time of writing). The reason for this is due to differences in serialization between versions of python (e.g. between 3.5 and 3.6). 


```python
from teradataml.dataframe.dataframe import DataFrame
from tdextensions.distributed import DistDataFrame, DistMode
from teradataml import create_context
import pandas as pd
import numpy as np

pd.options.display.max_colwidth = 250

engine = create_context(host="localhost", username="ivsm_user", password="ivsm_user")
```

*A simple map row example where we multiple the value of two columns on a row by row basis*

```python
def my_fun(row):
    return np.array([row.idx, row.sepal_length * row.sepal_width])

df = DistDataFrame("iris_train", dist_mode=DistMode.STO, sto_id="my_dumb_map")
df = df.map(lambda row: my_fun(row), 
            returns=[["idx", "INTEGER"], ["my_derived_col", "INTEGER"]])

df.head()
```

*A more advanced example where we train a different model for each partition of a dataset*

```python
from sklearn.ensemble import RandomForestClassifier
import base64
import dill

def train(partition):
    X = partition[['sepal_length', 'sepal_width', 'petal_length', 'petal_width']]
    y = partition[['species']]
    
    clf = RandomForestClassifier()
    clf.fit(X, y.values.ravel())
    
    return np.array([[partition.species.iloc[0], "my_model_id", base64.b64encode(dill.dumps(clf))]])

df = DistDataFrame("iris_train", dist_mode=DistMode.STO, sto_id="my_model_train")
df = df.map_partition(lambda partition: train(partition), 
                      partition_by="species", 
                      returns=[["partition_id", "VARCHAR(255)"], 
                               ["model_id", "VARCHAR(255)"],
                               ["model_artefact", "CLOB"]])
df.to_pandas().head()

```

## Permissions

    SET SESSION SEARCHUIFDBPATH = <database>;
    GRANT EXECUTE procedure on <db> to <user>;
    GRANT EXECUTE procedure on SYSUIF to <user>;
    GRANT CREATE external procedure on <db> to <user>;
    GRANT EXECUTE FUNCTION ON TD_SYSFNLIB.SCRIPT to <user>;
    GRANT EXECUTE ON  SYSUIF.DEFAULT_AUTH TO <user>;
lazyRecursion 0.1.1
lazy RecursiveSequence with optional caching
Requires Python: >=3.8

# lazyRecursion

Usage Example:

```python
>>> from lazyRecursion import RecursiveSequence
>>> 
>>> fibonacci = RecursiveSequence(
...     induction_start={0: 1, 1:1},
...     relative_indices=[-2,-1],
...     recursion_function=lambda x1,x2: x1+x2,
...     cache_file='fib_cache.json' # (optional) deactivates caching if missing
... )
>>> fibonacci[:10]
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
```

```python
>>> linear = RecursiveSequence(
...     induction_start={0:0},
...     relative_indices=[-1],
...     recursion_function=lambda x: x+5,
... )
>>> linear[:5]
[0, 5, 10, 15, 20]
```