Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLP Example doesn't work #68

Closed
jcampbell05 opened this issue May 17, 2017 · 5 comments
Closed

NLP Example doesn't work #68

jcampbell05 opened this issue May 17, 2017 · 5 comments

Comments

@jcampbell05
Copy link

The NLP example provided in the README currently causes markovify to spit out aload of Nones instead of sentances.

@jsvine
Copy link
Owner

jsvine commented May 17, 2017

Thanks for flagging, James. Could you provide the exact code, and any associated text files, that trigger this problem?

@jcampbell05
Copy link
Author

jcampbell05 commented May 18, 2017

Brexiteer.zip

Yeah here is the whole code, it just is using tweets as a source.

@jsvine
Copy link
Owner

jsvine commented May 18, 2017

Strange: When I click the "Uploading Brexiteer.zip..." link in your comment, I just get redirected back to this thread, but with no attachment.

@jcampbell05
Copy link
Author

@jsvine I've fixed it try now :)

@jsvine
Copy link
Owner

jsvine commented May 19, 2017

Thanks, James. Here's what's happening:

  • markovify.Text expects the sentences in a corpus to be separated by periods.
  • In your strip_all_entities function, you're removing all periods.
  • Hence, markovify.Text thinks you've just fed it one giant sentence and, hence, has trouble producing a novel new sentence.

Fortunately, fixing is easy and simply involves using markovify.NewlineText instead. Just change this line in your script:

class POSifiedText(markovify.Text):

... to this:

class POSifiedText(markovify.NewlineText):

@jsvine jsvine closed this as completed May 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants