serFile = TextFileWriter() #StringIO is an objet that kinda works like a file ofile = StringIO() print 'Creation of the file:' ofile.write(ta.createTabHeader()) db = dbConnector("test") print '\t- Manchetes...' table = db.getTable("manchete") if table != None: for element in table: try: ofile.write(ta.passTheCriterias(table[element]['titulo'],"manchete")) except: pass else: print ' --> No record in the table' print '\t- Noticia...' table = db.getTable("noticia") if table != None: for element in table: try: ofile.write(ta.passTheCriterias(table[element]['texto'],"noticia")) except: pass else: print ' --> No record in the table'
__CRITERIASFILE__ = '../DATA/criterias.xml' __EXAMPLE__ = '../DATA/data.tab' __OUTPUTFILE__ = '../DATA/dataTEST.tab' __FILE3__ = "../DATA/data2.tab" ta = TextAnalyser(__CRITERIASFILE__) serFile = TextFileWriter() #StringIO is an objet that kinda works like a file ofile = StringIO() texto = 'eu gosto do filme da lua nova porque esse filme e muito bom e tambem foi um sucesso no cinemas e tambem o que me chamou atencao nesse filme foi os personagem de como eles agia com os outros vanpiro e et' print 'Creation of the file:' ofile.write(ta.createTabHeader()) ofile.write(ta.passTheCriterias(texto,'resenha')) serFile.serializeFile(ofile.getvalue(),__OUTPUTFILE__) print 'Example table finished' example = orange.ExampleTable(__EXAMPLE__) data = orange.ExampleTable(__OUTPUTFILE__) classifier = orange.BayesLearner(example) #for i in range(len(data)): c = classifier(data[0]) p = classifier(data[0], orange.GetProbabilities) print p[1]," - original", data[0].getclass(), "classified as", c
__CRITERIASFILE__ = '../DATA/criteriasRecipies.xml' __OUTPUTFILE__ = '../DATA/dataRecipies.tab' ta = TextAnalyser(__CRITERIASFILE__) serFile = TextFileWriter() #StringIO is an objet that kinda works like a file ofile = StringIO() print 'Creation of the file:' ofile.write(ta.createTabHeader()) db = dbConnector("test") print '\t- Receita...' table = db.getTable("cronica") if table != None: for element in table: #print ' - ' + table[element]['titulo'] ofile.write(ta.passTheCriterias(table[element]['texto'],"cronica")) else: print ' --> No record in the table' serFile.serializeFile(ofile.getvalue(),__OUTPUTFILE__) print 'Example table finished'
__CRITERIASFILE__ = '../DATA/criteriasResenha.xml' __OUTPUTFILE__ = '../DATA/dataRe.tab' ta = TextAnalyser(__CRITERIASFILE__) serFile = TextFileWriter() #StringIO is an objet that kinda works like a file ofile = StringIO() print 'Creation of the file:' ofile.write(ta.createTabHeader()) db = dbConnector("test") print '\t- Receita...' table = db.getTable("resenha") if table != None: for element in table: #print ' - ' + table[element]['titulo'] ofile.write(ta.passTheCriterias(table[element]['texto'],"resenha")) else: print ' --> No record in the table' serFile.serializeFile(ofile.getvalue(),__OUTPUTFILE__) print 'Example table finished'
__CRITERIASFILE__ = '../DATA/criteriasNoticia.xml' __OUTPUTFILE__ = '../DATA/dataRe.tab' ta = TextAnalyser(__CRITERIASFILE__) serFile = TextFileWriter() #StringIO is an objet that kinda works like a file ofile = StringIO() print 'Creation of the file:' ofile.write(ta.createTabHeader()) db = dbConnector("test") print '\t- Receita...' table = db.getTable("noticia") if table != None: for element in table: #print ' - ' + table[element]['titulo'] ofile.write(ta.passTheCriterias(table[element]['texto'],"noticia")) else: print ' --> No record in the table' serFile.serializeFile(ofile.getvalue(),__OUTPUTFILE__) print 'Example table finished'
__CRITERIASFILE__ = '../../DATA/criteriasA.xml' __OUTPUTFILE__ = '../../DATA/dataRe.tab' ta = TextAnalyser(__CRITERIASFILE__) serFile = TextFileWriter() #StringIO is an objet that kinda works like a file ofile = StringIO() print 'Creation of the file:' ofile.write(ta.createTabHeader()) db = dbConnector("test") print '\t- Receita...' table = db.getTable("horoscopo") if table != None: for element in table: #print ' - ' + table[element]['titulo'] ofile.write(ta.passTheCriterias(table[element]['texto'],"horoscopo")) else: print ' --> No record in the table' serFile.serializeFile(ofile.getvalue(),__OUTPUTFILE__) print 'Example table finished'
__CRITERIASFILE__ = '../../DATA/criteriasA.xml' __OUTPUTFILE__ = '../../DATA/dataRe.tab' ta = TextAnalyser(__CRITERIASFILE__) serFile = TextFileWriter() #StringIO is an objet that kinda works like a file ofile = StringIO() print 'Creation of the file:' ofile.write(ta.createTabHeader()) db = dbConnector("test") print '\t- Receita...' table = db.getTable("manchete") if table != None: for element in table: #print ' - ' + table[element]['titulo'] ofile.write(ta.passTheCriterias(table[element]['texto'],"manchete")) else: print ' --> No record in the table' serFile.serializeFile(ofile.getvalue(),__OUTPUTFILE__) print 'Example table finished'