-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
14 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,23 +1,18 @@ | ||
from check import Check | ||
from proselint.checks.garner import dates | ||
from textblob import TextBlob | ||
|
||
|
||
class TestCheck(Check): | ||
|
||
__test__ = True | ||
|
||
def test_50s_hyphenation(self): | ||
text = TextBlob( | ||
"""The 50's were swell.""" | ||
) | ||
text = """The 50's were swell.""" | ||
errors = dates.check_decade_apostrophes_short(text) | ||
assert len(errors) == 1 | ||
|
||
def test_50_Cent_hyphenation(self): | ||
text = TextBlob( | ||
"""Dr. Dre suggested to 50's manager that he look into signing | ||
Eminem to the G-Unit record label.""" | ||
) | ||
text = """Dr. Dre suggested to 50's manager that he look into signing | ||
Eminem to the G-Unit record label.""" | ||
errors = dates.check_decade_apostrophes_short(text) | ||
assert len(errors) == 0 |
This file contains 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 |
---|---|---|
@@ -1,25 +1,19 @@ | ||
from tools import topics | ||
from textblob import TextBlob | ||
|
||
|
||
class TestTopicDetector(object): | ||
|
||
def test_50_Cent_detector_on_topic(self): | ||
"""Check precision of the 50 Cent topic-detector.""" | ||
blob = TextBlob( | ||
"""With the aid of Eminem and Dr. Dre (who produced his first | ||
text = """With the aid of Eminem and Dr. Dre (who produced his first | ||
major-label album, Get Rich or Die Tryin'), Jackson became one | ||
of the world's best selling rappers and rose to prominence with | ||
East Coast hip hop group G-Unit (which he leads de facto). """ | ||
) | ||
assert("50 Cent" in topics(blob)) | ||
|
||
blob = TextBlob( | ||
"""Hip hop was started in the early 50's.""" | ||
) | ||
assert("50 Cent" not in topics(blob)) | ||
assert("50 Cent" in topics(text)) | ||
|
||
blob = TextBlob( | ||
"""Nowadays it costs 50 cents to buy a lollipop.""" | ||
) | ||
assert("50 Cent" not in topics(blob)) | ||
text = """Hip hop was started in the early 50's.""" | ||
assert("50 Cent" not in topics(text)) | ||
|
||
text = """Nowadays it costs 50 cents to buy a lollipop.""" | ||
assert("50 Cent" not in topics(text)) |