File: test_topic_detector.py

package info (click to toggle)
python3-proselint 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,220 kB
  • sloc: python: 7,173; sh: 6; makefile: 3
file content (19 lines) | stat: -rw-r--r-- 706 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Test the topic detector tool."""

from proselint.tools import topics


def test_50_Cent_detector_on_topic():
    """Check precision of the 50 Cent topic-detector."""
    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(text)

    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)