markovipy
She tries striking conversations with you with her cohesive sentences after you have given her fill of text to her. And no she won’t complain about how big your corpus is. Also, don’t ask her if she can pass the turing test. She might not talk to you again.
I wrote a blog post explaining the motivation and what is there behind the scenes if you are interested
Installation
To install markovipy, run this command in your terminal:
$ pip install markovipy
This is the preferred method to install markovipy, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
Usage
To use markovipy in a project:
>>> from markovipy import MarkoviPy
>>>
>>> # create MarkoviPy object
>>> obj = MarkoviPy("/Users/tasrahma/development/projects/markovipy/corpus/ts_eliot/Gerontion_utf8.txt", 3)
>>>
>>>
>>> # arguments passed, is the initial corpus file and the markov chain length(defaults to 2 if nothing passed)
>>> obj.generate_sentence()
'Cammel, whirled Beyond the circuit of the shuddering Bear In fractured atoms.'
>>>
>>> obj.generate_sentence()
'After such knowledge, what forgiveness? Think now History has many cunning passages, contrived corridors And issues, deceives with whispering ambitions, Guides us by vanities.'
>>>
>>> obj.generate_sentence()
'Gull against the wind, in the windy straits Of Belle Isle, or running on the Horn, White feathers in the snow, the Gulf claims, And an old man, a dull head among windy spaces.'
>>>
>>> obj.generate_sentence()
'Silvero With caressing hands, at Limoges Who walked all night in the field overhead; Rocks, moss, stonecrop, iron, merds.'
>>>
>>> obj.generate_sentence()
"Gives too soon Into weak hands, what's thought can be dispensed with Till the refusal propagates a fear."
Free software: GNU General Public License v3
Documentation: https://markovipy.readthedocs.io.
Features
More tests to be added. As of now, some minimal tests have been written. Contributions more than welcome.
Create a web-interface with some fancy buttons/UI which would give you random quotes.
Links
History
0.3.0(2017-05-30)
exposed the Markovipy class in the markovipy module. API changed from
from markovipy.markovipy import MarkoviPy
to
from markovipy import MarkoviPy
0.2.0 (2017-04-29)
self.middle_value mapping becomes a defaultdict
list_to_tuple() was removed to use just the tuple()
moved self.words_list = get_word_list(self.filename) to __init__()
0.1.1 (2017-04-14)
fixes UnicodeDecodeError while reading files instead of using the normal open()
0.1.0 (2017-04-11)
First release on PyPI.
Metadata
Release files for markovipy 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| markovipy-0.3.0.tar.gz | 20.9 kB | Without provenance | Details |
Release files / markovipy-0.3.0.tar.gz
| Download URL | markovipy-0.3.0.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
078f6344abe424b4880d1ee1510da3dd4caba87bea0d5c3d42e59af68d0054be
|
|
BLAKE2b-256 checksum How to use checksums |
4a8b2cb3c8ed5d46c803529c196889ac8add94ecc671ce139d5111898bcfaa5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for markovipy 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.