Build a checker that blacklists certain words.
496275
def existence_check(text, list, err, msg, ignore_case=True,
                    str=False, max_errors=float("inf"), offset=0,
                    require_padding=True, dotall=False,
                    excluded_topics=None, join=False):
    """"""
    flags = 0

    msg = " ".join(msg.split())

    if ignore_case:
        flags = flags | re.IGNORECASE

    if str:
        flags = flags | re.UNICODE

    if dotall:
        flags = flags | re.DOTALL

    if require_padding:
        regex = u"(?:^|\W){}[\W$]"
    else:
        regex = u"{}"

    errors = []

    # If the topic of the text is in the excluded list, return immediately.
    if excluded_topics:
        tps = topics(text)
        if any([t in excluded_topics for t in tps]):
            return errors

    rx = "|".join(regex.format(w) for w in list)
    for m in re.finditer(rx, text, flags=flags):
        txt = m.group(0).strip()
        errors.append((
            m.start() + 1 + offset,
            m.end() + offset,
            err,
            msg.format(txt),
            None))

    errors = truncate_to_max(errors, max_errors)

    return errors
1000916
def candidates(word): 
    ""
    return (known([word]) or known(edits1(word)) or known(edits2(word)) or [word])
91502
def check(text):
    """"""
    err = "glaad.offensive_terms"
    msg = "Offensive term. Remove it or consider the context."

    list = [
        "fag",
        "faggot",
        "dyke",
        "sodomite",
        "homosexual agenda",
        "gay agenda",
        "transvestite",
        "homosexual lifestyle",
        "gay lifestyle"
        # homo - may create false positives without additional context
        # FIXME use topic detetor to decide whether "homo" is offensive
    ]

    return existence_check(text, list, err, msg, join=True, ignore_case=False)
478313
def sanitize_words(self, words):
    
    _words = []
    for w in words:
      if isinstance(w, string_types) and not isinstance(w, unicode):
        _words.append(unicode(w, encoding="utf-8"))
      else:
        _words.append(w)
    return _words
446813
def Filter(self):
    """"""
    if not self.desc:
      self.short_desc = ''
      return

    for i in range(len(self.desc)):   # replace full path with name
      if self.desc[i].find(self.executable) >= 0:
        self.desc[i] = self.desc[i].replace(self.executable, self.name)

    self.short_desc = self.desc[0]
    word_list = self.short_desc.split(' ')
    all_names = [ self.name, self.short_name, ]
    # Since the short_desc is always listed right after the name,
    #  trim it from the short_desc
    while word_list and (word_list[0] in all_names
                         or word_list[0].lower() in all_names):
      del word_list[0]
      self.short_desc = ''              # signal need to reconstruct
    if not self.short_desc and word_list:
      self.short_desc = ' '.join(word_list)
597268
function wordmap(input) {
    var ignore = "a an and on in it of if for the i is i'm i'd it's or to me be not was do so at are what bin bins".split(' ');

    var endings = 'ing ly lies s';
    var endingRe = new RegExp('(' + endings.split(' ').join('|') + ')$');

    return (input||'')
      //- strip html
      .replace(/(<([^>]+)>)/ig,'')
      //- strip non-letters
      .replace(/\W/g, ' ').replace(/["'\.,]/g, '')
      //- turn in to array of lower case words
      .toLowerCase().split(' ')
      //- filter out ignored words
      .filter(function (word) {
        return ignore.indexOf(word.trim()) === -1;
      }).filter(function (e, i, words) {
        //- return unique
        return words.lastIndexOf(e) === i;
      }).filter(function (word) {
        //- return words 3 chars or longer
        return word.length > 2;
      }).map(function (word) {
        return word.trim().replace(endingRe, '');
      }).sort();
  }
393413
def _backward_kill_word(text, pos):
    "
    text, new_pos = _backward_word(text, pos)
    return text[:new_pos] + text[pos:], new_pos
858499
def check(text):
    """"""
    err = "pinker.latin"
    msg = "Use English. '{}' is the preferred form."

    list = [
        ["other things being equal",          ["ceteris paribus"]],
        ["among other things",                ["inter alia"]],
        ["in and of itself",                  ["simpliciter"]],
        ["having made the necessary changes", ["mutatis mutandis"]],
    ]

    return preferred_forms_check(text, list, err, msg)
162841
def get_black(self):
        """"""
        blacklist = []
        for read in self.black_conf.splitlines():
            read = read.lstrip()
            if not read.startswith("#"):
                blacklist.append(read.replace("\n", ""))
        return blacklist
862029
def __get_words_to_ignore(self):
        
        # Stop words in English.
        english_stopwords = stopwords.words("english")

        here = path.abspath(path.dirname(__file__))

        # Languages in git repositories.
        git_languages = []
        with open(path.join(here, "gitlang/languages.txt"), "r") as langauges:
            git_languages = [line.strip() for line in langauges]

        # Other words to avoid in git repositories.
        words_to_avoid = []
        with open(path.join(here, "gitlang/others.txt"), "r") as languages:
            words_to_avoid = [line.strip() for line in languages]

        return set(
            itertools.chain(english_stopwords, git_languages, words_to_avoid)
        )
335076
def check(text):
    """"""
    err = "sexism.misc"
    msg = "Gender bias. Use '{}' instead of '{}'."

    sexism = [
        ["anchor",           ["anchorman", "anchorwoman"]],
        ["chair",            ["chairman", "chairwoman"]],
        ["drafter",          ["draftman", "draftwoman"]],
        ["ombuds",           ["ombudsman", "ombudswoman"]],
        ["tribe member",     ["tribesman", "tribeswoman"]],
        ["police officer",   ["policeman", "policewoman"]],
        ["firefighter",      ["fireman", "firewoman"]],
        ["mail carrier",     ["mailman", "mailwoman"]],
        ["history",          ["herstory"]],
        ["women",            ["womyn"]],
        ["poet",             ["poetess"]],
        ["author",           ["authoress"]],
        ["waiter",           ["waitress"]],
        ["lawyer",           ["lady lawyer"]],
        ["doctor",           ["woman doctor"]],
        ["bookseller",       ["female booksalesman"]],
        ["air pilot",        ["female airman"]],
        ["executor",         ["executrix"]],
        ["prosecutor",       ["prosecutrix"]],
        ["testator",         ["testatrix"]],
        ["husband and wife", ["man and wife"]],
        ["chairs",           ["chairmen and chairs"]],
        ["men and women",    ["men and girls"]],
        ["comedian",         ["comedienne"]],
        ["confidant",        ["confidante"]],
        ["scientist",        ["woman scientist"]],
        ["scientists",       ["women scientists"]]
        # ["hero",             ["heroine"]]
    ]

    errors = preferred_forms_check(text, sexism, err, msg, ignore_case=False)

    msg = "Not a preferred form. Use '{}' instead of '{}'."
    pref = [
            ["anchor",           ["anchorperson"]],
            ["chair",            ["chairperson"]],
            ["drafter",          ["draftperson"]],
            ["ombuds",           ["ombudsperson"]],
            ["tribe member",     ["tribesperson"]],
            ["police officer",   ["policeperson"]],
            ["firefighter",      ["fireperson"]],
            ["mail carrier",     ["mailperson"]],
    ]
    for x in preferred_forms_check(text, pref, err, msg, ignore_case=False):
        errors.append(x)

    return errors
847749
def check(text):
    """"""
    err = "glaad.terms"
    msg = "Possibly offensive term. Consider using '{}' instead of '{}'."

    list = [
        ["gay man",            ["homosexual man"]],
        ["gay men",            ["homosexual men"]],
        ["lesbian",            ["homosexual woman"]],
        ["lesbians",           ["homosexual women"]],
        ["gay people",         ["homosexual people"]],
        ["gay couple",         ["homosexual couple"]],
        ["sexual orientation", ["sexual preference"]],
        ["openly gay",         ["admitted homosexual", "avowed homosexual"]],
        ["equal rights",       ["special rights"]]
        ]

    return preferred_forms_check(text, list, err, msg, ignore_case=False)
797968
def check(self, text):
        
        for word, pos in self.tokenizer(text):
            correct = self.dictionary.check(word)
            if correct:
                continue
            yield word, self.dictionary.suggest(word) if self.suggest else []
        return
469644
def check(definition, data, *args, **kwargs):
    """"""
    checker = checker_factory(definition)
    return checker(data, *args, **kwargs)
823307
def generate_words(numberofwords, wordlist, secure=None):
    """"""
    if not secure:
        chooser = random.choice
    else:
        chooser = random.SystemRandom().choice
    return [chooser(wordlist) for _ in range(numberofwords)]
1286267
def call_spellchecker(cmd, input_text=None, encoding=None):
    """"""

    process = get_process(cmd)

    # A buffer has been provided
    if input_text is not None:
        for line in input_text.splitlines():
            # Hunspell truncates lines at `0x1fff` (at least on Windows this has been observed)
            # Avoid truncation by chunking the line on white space and inserting a new line to break it.
            offset = 0
            end = len(line)
            while True:
                chunk_end = offset + 0x1fff
                m = None if chunk_end >= end else RE_LAST_SPACE_IN_CHUNK.search(line, offset, chunk_end)
                if m:
                    chunk_end = m.start(1)
                    chunk = line[offset:m.start(1)]
                    offset = m.end(1)
                else:
                    chunk = line[offset:chunk_end]
                    offset = chunk_end
                # Avoid wasted calls to empty strings
                if chunk and not chunk.isspace():
                    process.stdin.write(chunk + b'\n')
                if offset >= end:
                    break

    return get_process_output(process, encoding)
1230486
def consistency_check(text, word_pairs, err, msg, offset=0):
    """"""
    errors = []

    msg = " ".join(msg.split())

    for w in word_pairs:
        matches = [
            [m for m in re.finditer(w[0], text)],
            [m for m in re.finditer(w[1], text)]
        ]

        if len(matches[0]) > 0 and len(matches[1]) > 0:

            idx_minority = len(matches[0]) > len(matches[1])

            for m in matches[idx_minority]:
                errors.append((
                    m.start() + offset,
                    m.end() + offset,
                    err,
                    msg.format(w[~idx_minority], m.group(0)),
                    w[~idx_minority]))

    return errors