better_profanity/utils.py
def any_next_words_form_swear_word(cur_word, text, words_indices, censor_words):
    """
    Return True, and the end index of the word in the text, if any word formed in words_indices is in `CENSOR_WORDSET`.
    """
    full_word = cur_word.lower()
    full_word_with_separators = cur_word.lower()

    # Check both words in the pairs
    for index in iter(range(0, len(words_indices), 2)):
        single_word, end_index = words_indices[index]
        word_with_separators, _ = words_indices[index + 1]
        if single_word == "":
            continue

        full_word = "%s%s" % (full_word, single_word.lower())
        full_word_with_separators = "%s%s" % (
            full_word_with_separators,
            word_with_separators.lower(),
        )
        if full_word in censor_words or full_word_with_separators in censor_words:
            return True, end_index
    return False, -1

    Return True, and the end index of the word in the text, if any word formed in words_indices is in `CENSOR_WORDSET`.
    
Return True, and the end index of the word in the text, if any word formed in words_indices is in `CENSOR_WORDSET`.
Return True and the end index of the word in the text if any word formed in words_indices is in ` CENSOR_WORDSET ` .
def any_next_words_form_swear_word(cur_word, text, words_indices, censor_words):
    full_word = cur_word.lower()
    full_word_with_separators = cur_word.lower()
    for index in iter(range(0, len(words_indices), 2)):
        single_word, end_index = words_indices[index]
        word_with_separators, _ = words_indices[index + 1]
        if single_word == "":
            continue
        full_word = "%s%s" % (full_word, single_word.lower())
        full_word_with_separators = "%s%s" % (
            full_word_with_separators,
            word_with_separators.lower(),
        )
        if full_word in censor_words or full_word_with_separators in censor_words:
            return True, end_index
    return False, -1
def any_next_words_form_swear_word ( cur_word , text , words_indices , censor_words ) : full_word = cur_word . lower ( ) full_word_with_separators = cur_word . lower ( ) for index in iter ( range ( 0 , len ( words_indices ) , 2 ) ) : single_word , end_index = words_indices [ index ] word_with_separators , _ = words_indices [ index + 1 ] if single_word == "" : continue full_word = "%s%s" % ( full_word , single_word . lower ( ) ) full_word_with_separators = "%s%s" % ( full_word_with_separators , word_with_separators . lower ( ) , ) if full_word in censor_words or full_word_with_separators in censor_words : return True , end_index return False , - 1
Return True, and the end index of the word in the text, if any word formed in words_indices is in `CENSOR_WORDSET`.
Return True and the end index of the word in the text if any word formed in words_indices is in ` CENSOR_WORDSET ` .
"""
    Return True, and the end index of the word in the text, if any word formed in words_indices is in `CENSOR_WORDSET`.
    """ # Check both words in the pairs
cur_word
text
words_indices
censor_words