예제 #1
0
def sentence_normalizer(sentence):
    standard_char_list = "abcdefghijklmnopqrstuvwsyz- "
    temp_sentence = ""
    normalized_sentence = norm_punc.normalize_text(str(sentence.lower()), fix_encoding=True, strip_emojis=True)
    for char in normalized_sentence:
        for standardChar in standard_char_list:
            if standardChar == char:
                temp_sentence += char
                break
    return temp_sentence
예제 #2
0
def processQuestion(text):
    standardText = "abcdefghijklmnopqrstuvwsyz- "
    temp = ""
    normalizedText = norm_punc.normalize_text(str(text.lower()),
                                              fix_encoding=True,
                                              strip_emojis=True)
    for char in normalizedText:
        for standardchar in standardText:
            if standardchar == char:
                temp += char
                break
    return temp