def testGetMainWords(self): dm = DictionnaryMaker() text = "aqui e um teste de texto, quero ver a palavra teste no resultado, vou analysar tudo" print dm.getMainWords(text)
db = dbConnector("test") print '\t- Manchetes...' table = db.getTable("manchete") if table != None: oFile.write("Manchete:\n") texts = "" nbDocs = 0 for element in table: try: nbDocs += 1 texts += "\n"+ table[element]['texto'] except: print "Error in the Manchete:" for word in dm.getMainWords(texts,nbDocs): oFile.write("\t" + word.lower() + "\n") else: print ' --> No record in the table' print '\t- Noticia...' table = db.getTable("noticia") if table != None: oFile.write("Noticia:\n") texts = "" nbDocs = 0 for element in table: try: nbDocs += 1 texts += "\n"+ table[element]['texto']