You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import markovify
with open("data", encoding="utf-8") as f:
text = f.read()
text_model = markovify.Text(text, state_size=7)
txt = []
while len(txt) in range(0,5):
txt.append(text_model.make_sentence(tries=100))
txt = [x for x in txt if x is not None]
print(txt)
This script just hangs on my screen. Reinstalling the library did nothing for me, trying different corpus did not work either.
The text was updated successfully, but these errors were encountered:
@8o7wer's code above seems to work fine on large corpora. E.g., the sherlock.txt test text. The hitch seems to be the specification of state_size = 7. That's a fairly large state size, and will only be able to generate new sentences with fairly large corpora. (I.e., those which contain many examples of the same seven-word sequences.)
If you reduce the state_size to a smaller number — e.g., 2 or 3 — it should work fine on most corpora.
This script just hangs on my screen. Reinstalling the library did nothing for me, trying different corpus did not work either.
The text was updated successfully, but these errors were encountered: