Ejemplo n.º 1
0
 def test_symbol_arroba(self):
     analyzer = TextAnalyzer()
     text = "asd@ Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 2
0
 def test_string_lower_string_capitalized(self):
     analyzer = TextAnalyzer()
     text = "asd ASD"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 3
0
 def test_symbol_double_points(self):
     analyzer = TextAnalyzer()
     text = "asd: Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 4
0
 def test_symbol_slash(self):
     analyzer = TextAnalyzer()
     text = "asd/ Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 5
0
 def test_symbol_upper_exclamation(self):
     analyzer = TextAnalyzer()
     text = "asd! Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 6
0
 def test_symbol_parenthesis(self):
     analyzer = TextAnalyzer()
     text = "asd() Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 7
0
 def test_invalid_URL(self):
     analyzer = TextAnalyzer()
     url = 345
     self.assertRaises(URLError, analyzer.get_text, url)
Ejemplo n.º 8
0
 def test_symbol_low_bar(self):
     analyzer = TextAnalyzer()
     text = "asd_ Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 11
0
 def test_semi_capitalized_strings(self):
     analyzer = TextAnalyzer()
     text = "Asd AsD"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 12
0
 def test_symbol_numbers_between_letters(self):
     analyzer = TextAnalyzer()
     text = "as1d2As3d"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asdasd"]
Ejemplo n.º 13
0
 def test_symbol_numbers(self):
     analyzer = TextAnalyzer()
     text = "asd 1234asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 14
0
 def test_symbol_almohadilla(self):
     analyzer = TextAnalyzer()
     text = "asd# Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 15
0
 def unexistent_url(self):
     analyzer = TextAnalyzer()
     url = "https://www.auhfaiguisgfa.com"
     self.assertRaises(URLError, analyzer.get_text, url)
Ejemplo n.º 16
0
 def test_string_stopword_string(self):
     analyzer = TextAnalyzer()
     text = "asd upon asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 17
0
 def test_symbol_coma(self):
     analyzer = TextAnalyzer()
     text = "asd,"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd"]
Ejemplo n.º 18
0
 def test_symbol_upper_interrogation(self):
     analyzer = TextAnalyzer()
     text = "asd? Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 19
0
 def test_symbol_doc_and_coma(self):
     analyzer = TextAnalyzer()
     text = "asd; Asd"
     text = TextAnalyzer.prepare_text(analyzer, text)
     assert text == ["asd", "asd"]
Ejemplo n.º 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])