示例#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])