Markov model implementation
Project description
![](resources/markovx_banner.png)
### Intro ###
[Markov Chains](https://en.wikipedia.org/wiki/Markov_chain) implementation <br>
### Installation ###
in your terminal:
> pip install markovx
### Examples ###
Adding Chains
```python
from markovx.model import MarkovModel
mx = MarkovModel()
mx.add_one('123456')
mx.add_one('qwerty')
mx.add_many(['admin', 'root', 'user'])
```
Generating Chains
```python
mx.generate(10) # len of tokens in chain
```
```python
mx.generate(10, random_init=True)
# when True first token in chain would be assigned randomly
# when False first token would be assigned based on observed firs tokens
# default to False
```
```python
mx.generate(10, smart_ending=False)
# when False chain wouldn't be terminated before len(chain) == n even if model got to an end token
# when True if model got to an end token while len(chain) < n chain would terminate
# default to True
```
### Contact ###
[Tal Peretz](https://www.linkedin.com/in/tal-per/)
### Intro ###
[Markov Chains](https://en.wikipedia.org/wiki/Markov_chain) implementation <br>
### Installation ###
in your terminal:
> pip install markovx
### Examples ###
Adding Chains
```python
from markovx.model import MarkovModel
mx = MarkovModel()
mx.add_one('123456')
mx.add_one('qwerty')
mx.add_many(['admin', 'root', 'user'])
```
Generating Chains
```python
mx.generate(10) # len of tokens in chain
```
```python
mx.generate(10, random_init=True)
# when True first token in chain would be assigned randomly
# when False first token would be assigned based on observed firs tokens
# default to False
```
```python
mx.generate(10, smart_ending=False)
# when False chain wouldn't be terminated before len(chain) == n even if model got to an end token
# when True if model got to an end token while len(chain) < n chain would terminate
# default to True
```
### Contact ###
[Tal Peretz](https://www.linkedin.com/in/tal-per/)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
markovx-1.0.0.tar.gz
(2.8 kB
view details)
File details
Details for the file markovx-1.0.0.tar.gz
.
File metadata
- Download URL: markovx-1.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea1e807a37ccfb5b4d682f4220ec0dbc4d5c9bfc6ed5382f7e34ad11b82ed06b |
|
MD5 | af925c0c45777d5b144b2545b9486369 |
|
BLAKE2b-256 | 6a9b4e5ba38dd37122a98f5200663016f67c8d8f68922c686305fcc1414fb468 |