Debian Codegraph @

proselint/checks/lgbtq/offensive_terms.py

raw
1 """GLAAD.
2
3 ---
4 layout: post
5 source: GLAAD Media Reference Guide - 9th Edition
6 source_url: http://www.glaad.org/reference
7 title: GLAAD Guidelines
8 date: 2016-07-06
9 categories: writing
10 ---
11
12 This check looks for offensive terms related to LGBTQ issues and
13 raises an error marking them as offensive. The New York Times and
14 Associated Press have also adopted this style guide.
15
16 """
17 from proselint.tools import existence_check, memoize
18
19
20 @memoize
21 def check(text):
22 """Flag offensive words based on the GLAAD reference guide."""
23 err = "glaad.offensive_terms"
24 msg = "Offensive term. Remove it or consider the context."
25
26 list = [
27 "fag",
28 "faggot",
29 "dyke",
30 "sodomite",
31 "homosexual agenda",
32 "gay agenda",
33 "transvestite",
34 "homosexual lifestyle",
35 "gay lifestyle"
36 # homo - may create false positives without additional context
37 # FIXME use topic detetor to decide whether "homo" is offensive
38 ]
39
40 return existence_check(text, list, err, msg, join=True, ignore_case=False)