Пример #1
0
 def test_symbol_arroba(self):
     analyzer = TextAnalyzer()
     text = "asd@ Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #2
0
 def test_string_lower_string_capitalized(self):
     analyzer = TextAnalyzer()
     text = "asd ASD"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #3
0
 def test_symbol_double_points(self):
     analyzer = TextAnalyzer()
     text = "asd: Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #4
0
 def test_symbol_slash(self):
     analyzer = TextAnalyzer()
     text = "asd/ Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #5
0
 def test_symbol_upper_exclamation(self):
     analyzer = TextAnalyzer()
     text = "asd! Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #6
0
 def test_symbol_parenthesis(self):
     analyzer = TextAnalyzer()
     text = "asd() Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #7
0
 def test_invalid_URL(self):
     analyzer = TextAnalyzer()
     url = 345
     self.assertRaises(URLError, analyzer.get_text, url)
Пример #8
0
 def test_symbol_low_bar(self):
     analyzer = TextAnalyzer()
     text = "asd_ Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #9
0
 def test_sort_dictionary(self):
     analyzer = TextAnalyzer()
     analyzer.palabras_leidas = {"a": 1, "b": 3, "c": 2}
     analyzer.palabras_leidas = TextAnalyzer.sortDict(analyzer)
     res = [("b", 3), ("c", 2), ("a", 1)]
     assert analyzer.palabras_leidas == res
Пример #10
0
 def test_analyze(self):
     analyzer = TextAnalyzer()
     text = ["hola", "hola", "hola", "adios"]
     TextAnalyzer.analyze(analyzer, text)
     assert analyzer.palabras_leidas[
         'hola'] == 3 and analyzer.palabras_leidas['adios'] == 1
Пример #11
0
 def test_semi_capitalized_strings(self):
     analyzer = TextAnalyzer()
     text = "Asd AsD"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #12
0
 def test_symbol_numbers_between_letters(self):
     analyzer = TextAnalyzer()
     text = "as1d2As3d"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asdasd"]
Пример #13
0
 def test_symbol_numbers(self):
     analyzer = TextAnalyzer()
     text = "asd 1234asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #14
0
 def test_symbol_almohadilla(self):
     analyzer = TextAnalyzer()
     text = "asd# Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #15
0
 def unexistent_url(self):
     analyzer = TextAnalyzer()
     url = "https://www.auhfaiguisgfa.com"
     self.assertRaises(URLError, analyzer.get_text, url)
Пример #16
0
 def test_string_stopword_string(self):
     analyzer = TextAnalyzer()
     text = "asd upon asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #17
0
 def test_symbol_coma(self):
     analyzer = TextAnalyzer()
     text = "asd,"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd"]
Пример #18
0
 def test_symbol_upper_interrogation(self):
     analyzer = TextAnalyzer()
     text = "asd? Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #19
0
 def test_symbol_doc_and_coma(self):
     analyzer = TextAnalyzer()
     text = "asd; Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Пример #20
0
 def test_symbol_percentage(self):
     analyzer = TextAnalyzer()
     text = "asd% Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
import sys
from sample.text_analyzer import TextAnalyzer

if __name__ == "__main__":
    args = sys.argv[1:]
    print("Welcome to the awesome text analyzer !\nThe results are:")

    #En caso de que se quiera ejecutar desde IDE, descomentar la siguiente línea y comentar la consecutiva
    #TextAnalyzer.run('http://websitetips.com/articles/copy/lorem/ipsum.txt')
    TextAnalyzer.run(args[0])