Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pboyd/randtxt
Random text generator
https://github.com/pboyd/randtxt
golang markov random-text
Last synced: about 1 month ago
JSON representation
Random text generator
- Host: GitHub
- URL: https://github.com/pboyd/randtxt
- Owner: pboyd
- License: apache-2.0
- Created: 2018-09-25T01:59:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2018-11-10T12:10:35.000Z (over 5 years ago)
- Last Synced: 2024-02-11T12:07:44.589Z (4 months ago)
- Topics: golang, markov, random-text
- Language: Go
- Size: 157 KB
- Stars: 69
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Lists
- awesome-stars - randtxt
README
# randtxt [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/pboyd/randtxt)
Generates random text from Markov chains of tagged source text.
An example chain is included which was derived from [Plato's
Ion](https://www.gutenberg.org/ebooks/1635):```sh
$ go get github.com/pboyd/randtxt
$ go run github.com/pboyd/randtxt/cmd/gentext -chain $GOPATH/src/github.com/pboyd/randtxt/testfiles/ion/trigram.mkv
```> Have you already forgotten what you were saying? A rhapsode ought to
> interpret the mind of the poet. For the rhapsode ought to interpret the mind
> of the poet. For the poet is a light and winged and holy thing, and there is
> Phanosthenes of Andros, and Heraclides of Clazomenae, whom they have also
> appointed to the command of their armies and to other offices, although
> aliens, after they had shown their merit. And will they not choose Ion the
> Ephesian to be their general, and honour him, if he prove himself worthy?To build a chain, use the [Stanford POS
Tagger](https://nlp.stanford.edu/software/tagger.shtml) to generate tagged
text, then run `cmd/readtsv`. For example:```sh
go run github.com/pboyd/randtxt/cmd/readtsv -chain output.mkv $GOPATH/src/github.com/pboyd/randtxt/testfiles/ion/tagged.tsv
```I wrote about the design [here](https://pboyd.io/posts/random-text/).
# License
This package is released under the terms of the Apache 2.0 license. See LICENSE.TXT.