Skip to content

Commit

Permalink
Merge 3c82aec into efb0a44
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-bay committed Jun 23, 2019
2 parents efb0a44 + 3c82aec commit 452bdcb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ text_model = markovify.Text(text)
for i in range(5):
print(text_model.make_sentence())

# Print three randomly-generated sentences of no more than 140 characters
# Print three randomly-generated sentences of no more than 280 characters
for i in range(3):
print(text_model.make_short_sentence(140))
print(text_model.make_short_sentence(280))
```

Notes:
Expand Down Expand Up @@ -156,7 +156,7 @@ model_json = text_model.to_json()
# In theory, here you'd save the JSON to disk, and then read it back later.

reconstituted_model = markovify.Text.from_json(model_json)
reconstituted_model.make_short_sentence(140)
reconstituted_model.make_short_sentence(280)

>>> 'It cost me something in foolscap, and I had no idea that he was a man of evil reputation among women.'
```
Expand Down
2 changes: 1 addition & 1 deletion markovify/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def build(self, corpus, state_size):
def precompute_begin_state(self):
"""
Caches the summation calculation and available choices for BEGIN * state_size.
Significantly speeds up chain generation on large corpuses. Thanks, @schollz!
Significantly speeds up chain generation on large corpora. Thanks, @schollz!
"""
begin_state = tuple([ BEGIN ] * self.state_size)
choices, weights = zip(*self.model[begin_state].items())
Expand Down
2 changes: 1 addition & 1 deletion markovify/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def make_sentence(self, init_state=None, **kwargs):
def make_short_sentence(self, max_chars, min_chars=0, **kwargs):
"""
Tries making a sentence of no more than `max_chars` characters and optionally
no less than `min_chars` charcaters, passing **kwargs to `self.make_sentence`.
no less than `min_chars` characters, passing **kwargs to `self.make_sentence`.
"""
tries = kwargs.get('tries', DEFAULT_TRIES)

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
keywords="markov chain text",
author="Jeremy Singer-Vine",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py34,py35,py36
envlist = py27,py34,py35,py36,py37
toxworkdir={env:TOX_WORK_DIR:.tox}

[testenv]
Expand Down

0 comments on commit 452bdcb

Please sign in to comment.