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

Fixed test file, added alternative sentence maker #2

Merged
merged 2 commits into from
Jan 17, 2014

Conversation

TadLeonard
Copy link
Contributor

  1. Fixed usage of number in tests (it takes one arg, not two)
  2. Added sentence_actual, which returns an actual sentence from the Sherlock text.
  3. Added _picka._Book class to hold the text and split sentences read from Sherlock.
    Users can call sentence() without reading the entire file again and again.
  4. Added test of sentence_actual to picka.tests

The sentence_actual function has some nice features:

  1. You're much less likely to get a sentence fragment
  2. You can specify a minimum and maximum number of words
  3. It should be relatively efficient, because the split sentences are
    cached by the _Book class.

The sentences aren't always perfect, but I think that has to do with the source. A book other than Sherlock Holmes, preferably one with less dialog, would give more "normal" sentences.

1) Fixed usage of `number` in tests (it takes one arg, not two)
2) Added `sentence_actual`, which returns an actual sentence from the Sherlock text.
3) Added `_picka._Book` class to hold the text and split sentences read from Sherlock.
   Users can call sentence() without reading the entire file again and again.
4) Added test of `sentence_actual` to `picka.tests`
@ghost ghost assigned antlong Jan 16, 2014
1) General cleanup of supporting stuff around `sentence` and `sentence_actual`
2) Improved the way sentences are split into words and filtered
3) No longer using `random.shuffle` to yield a random sentence. `random.randint` + list indexing is many times faster.
4) Added docstrings for `sentence` and `sentence_actual`
antlong added a commit that referenced this pull request Jan 17, 2014
Fixed test file, added alternative sentence maker
@antlong antlong merged commit 7057456 into antlong:master Jan 17, 2014
@antlong
Copy link
Owner

antlong commented Jan 17, 2014

Thank you for contributing to picka. I appreciate it very much.

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

Successfully merging this pull request may close these issues.

2 participants