Metadata-Version: 2.1
Name: ngram_ml
Version: 0.0.1
Summary: Basic python package for creating n-gram language models from text files
Home-page: https://github.com/anil-gurbuz/ngram_ml
Author: Anil Gurbuz
Author-email: anlgrbz91@gmail.com
License: MIT
Keywords: NLP,ngram,MLE,Simple Language Model
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown

# Maximum Likelihood fit for N-grams 
A small library for quickly deriving the Maximum Likelihood estimates for N-grams.

## Installation
```bash
pip install ngram-ml
```

## Usage
```python
from ngram_ml import NGramMLEstimator
```

## Example
```python
mle = NGramMLEstimator(sentences=tokens, n_grams=2, label_smoothing=1)
mle.calculate_cross_entropy(tokens)
mle.calculate_cross_entropy([['<S>', 'the', 'cat', 'sat', 'on', 'the', 'mat', '</S>']])

mle.generate_sentence(30, initial_pre_seq= tuple([mle.word_to_idx['pencil']]))
mle.generate_most_probable_sentence(30, initial_pre_seq= tuple([mle.word_to_idx['book']]))

```





