A simple ngram-based random text generator.
A simple n-gram-based random text generator written in Python.
Requirements and Installation
This module requires Python 3.6+ due to the use of f-strings.
pip install ngramtg
Create a simple script, e.g.
from ngramtg.ngram import NgramTextGen import sys if __name__ == "__main__": my_object = NgramTextGen(sys.argv, auto=True) print(my_object.sentence())
Save it (e.g.
myscript.py) and provide a corpus file to it:
$ python myscript.py corpus.txt Compassion will make you.
- Initial release
Development and License
Developed by Paul Wicking – @DocWicking.
Distributed under the MIT license. See
LICENSE for more information.
The source code lives on GitHub.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.