-
Notifications
You must be signed in to change notification settings - Fork 13
complexity builtins #32
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
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5028e17
complexity
f540d17
complexity builtins
6731383
complexity builtins with tests
7fc8d01
Merge pull request #1 from jnelson16/complexity
1aabb9a
code review updates
43f4d37
option tests
d121398
added nltk requirement
a5c15c9
add pip install to .travis.yml
c1ebb76
nltk fixes
1da893e
Merge pull request #2 from jnelson16/troubleshoot
d731de1
another nltk fix
1b0e35a
last nltk fix?
b1e142e
you know the drill
41b17f8
Update .travis.yml
842204b
nltk troubles
ead81fc
Merge pull request #3 from jnelson16/nltk-troubles
3f95a98
some final cleanup
f9bd220
if it aint broke...
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,3 +126,48 @@ def test_termcount_multiple_with_label(): | |
| 'lorem', 'dolor sit', '--total_label', 'bothofem'], | ||
| ) | ||
| assert output == 'file,lorem,dolor sit,bothofem\n1,1,1,2\n2,1,0,1\n' | ||
|
|
||
|
|
||
| def test_shannon_entropy(): | ||
| output = check_output( | ||
| ['quantgov', 'corpus', 'shannon_entropy', str(PSEUDO_CORPUS_PATH)], | ||
| ) | ||
| assert output == 'file,shannon_entropy\n1,7.14\n2,8.13\n' | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get tests for the options as well? |
||
|
|
||
| def test_shannon_entropy_no_stopwords(): | ||
| output = check_output( | ||
| ['quantgov', 'corpus', 'shannon_entropy', str(PSEUDO_CORPUS_PATH), | ||
| '--stopwords', 'None'], | ||
| ) | ||
| assert output == 'file,shannon_entropy\n1,7.18\n2,8.09\n' | ||
|
|
||
|
|
||
| def test_shannon_entropy_4decimals(): | ||
| output = check_output( | ||
| ['quantgov', 'corpus', 'shannon_entropy', str(PSEUDO_CORPUS_PATH), | ||
| '--precision', '4'], | ||
| ) | ||
| assert output == 'file,shannon_entropy\n1,7.1413\n2,8.1252\n' | ||
|
|
||
|
|
||
| def test_conditionalcount(): | ||
| output = check_output( | ||
| ['quantgov', 'corpus', 'count_conditionals', str(PSEUDO_CORPUS_PATH)], | ||
| ) | ||
| assert output == 'file,conditionals\n1,0\n2,0\n' | ||
|
|
||
|
|
||
| def test_sentencelength(): | ||
| output = check_output( | ||
| ['quantgov', 'corpus', 'sentence_length', str(PSEUDO_CORPUS_PATH)], | ||
| ) | ||
| assert output == 'file,sentence_length\n1,9.54\n2,8.16\n' | ||
|
|
||
|
|
||
| def test_sentencelength_4decimals(): | ||
| output = check_output( | ||
| ['quantgov', 'corpus', 'sentence_length', str(PSEUDO_CORPUS_PATH), | ||
| '--precision', '4'], | ||
| ) | ||
| assert output == 'file,sentence_length\n1,9.5385\n2,8.1633\n' | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either we should move these requirements to install_requires or we should make it so that qg can still run without them installed (and we throw an error if they aren't installed and someone tries to use that builtin)