예제 #1
0
 def test_if_return_list_with_ignored_punctuation(self):
     text_handler = TextHandler([
         "bernardo gomes; abreu. yasmine! yasmine# yasmine% yasmine$ yasmine' yasmine& yasmine) yasmine( yasmine, yasmine; yasmine: yasmine< yasmine? yasmine> yasmine@ yasmine[ yasmine] yasmine` yasmine{ yasmine} "
     ])
     assert text_handler.sw_vocabulary() == [
         "bernardo", "gomes", "abreu", "yasmine"
     ]
예제 #2
0
    def get(self):
        list_of_texts = [
            text
            for text, in db.session.query(Text.text).order_by(Text.id).all()
        ]
        text_handler = TextHandler(list_of_texts)

        vocabulary = {"vocabulary": text_handler.sw_vocabulary()}
        schema = IsolatedVocabularySchema()

        return schema.load(vocabulary), 200
예제 #3
0
 def test_if_return_list_when_the_params_is_multiple_texts(self):
     text_handler = TextHandler([
         "bernardo GOMES; Abreu.", "YASMINE", "Melo", "Costa",
         "Leonardo Gomes Abreu"
     ])
     assert text_handler.sw_vocabulary() == [
         "bernardo",
         "gomes",
         "abreu",
         "yasmine",
         "melo",
         "costa",
         "leonardo",
     ]
예제 #4
0
 def test_if_return_list_without_stop_words(self):
     text_handler = TextHandler([
         "bernardo GOMES; de Abreu.",
         "YASMINE",
         "de",
         "Melo",
         "Costa",
         "Leonardo Gomes de Abreu",
     ])
     assert text_handler.sw_vocabulary() == [
         "bernardo",
         "gomes",
         "abreu",
         "yasmine",
         "melo",
         "costa",
         "leonardo",
     ]
예제 #5
0
 def test_if_has_17_words_and_the_vocabulary_has_11(self):
     text_handler = TextHandler([
         "Falar é fácil. Mostre-me o código.",
         "É fácil escrever código. Difícil é escrever código que funcione.",
     ])
     assert text_handler.sw_vocabulary() == [
         "falar",
         # "é",
         "fácil",
         "mostre",
         # "me",
         # "o",
         "código",
         "escrever",
         "difícil",
         # "que",
         "funcione",
     ]
예제 #6
0
 def test_if_return_list_with_ignored_case(self):
     text_handler = TextHandler(["bernardo GOMES; Abreu."])
     assert text_handler.sw_vocabulary() == ["bernardo", "gomes", "abreu"]
예제 #7
0
 def test_if_return_list_with_single_words_in_order(self):
     text_handler = TextHandler(["bernardo gomes abreu"])
     assert text_handler.sw_vocabulary() == ["bernardo", "gomes", "abreu"]
예제 #8
0
 def test_if_return_list_with_single_words_and_unique_items(self):
     text_handler = TextHandler(["bufalo bufalo bufalo"])
     assert text_handler.sw_vocabulary() == ["bufalo"]
예제 #9
0
 def test_if_return_list_with_of_empty_text(self):
     text_handler = TextHandler([""])
     assert text_handler.sw_vocabulary() == []