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.ng_vocabulary() == [ ("bernardo", "gomes"), ("gomes", "abreu"), ("leonardo", "gomes"), ]
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.ng_vocabulary()} schema = Gram2VocabularySchema() return schema.load(vocabulary), 200
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.ng_vocabulary() == [ ("bernardo", "gomes"), ("gomes", "abreu"), ("leonardo", "gomes"), ]
def test_if_return_list_with_ignored_case(self): text_handler = TextHandler(["bernardo GOMES; Abreu."]) assert text_handler.ng_vocabulary() == [("bernardo", "gomes"), ("gomes", "abreu")]
def test_if_return_list_with_ignored_punctuation(self): text_handler = TextHandler(["bernardo gomes; abreu."]) assert text_handler.ng_vocabulary() == [("bernardo", "gomes"), ("gomes", "abreu")]
def test_if_return_list_with_single_words_in_order(self): text_handler = TextHandler(["bernardo gomes abreu"]) assert text_handler.ng_vocabulary() == [("bernardo", "gomes"), ("gomes", "abreu")]
def test_if_return_list_with_single_words_and_unique_items(self): text_handler = TextHandler(["bufalo bufalo bufalo"]) assert text_handler.ng_vocabulary() == [("bufalo", "bufalo")]