コード例 #1
0
ファイル: main.py プロジェクト: andoniVT/ESA_Final
    def __testClassifier(self, segmentos, entities, model, fileClass):
        results = []
        for j in segmentos:
            proc = TextCleaner(j)
            procesado = proc.get_processed_comment()

            vector = model.get_comment_tf_idf_vector([procesado])
            supClass = load_data_from_disk(fileClass)
            classifier = SC()
            classifier.set_classifier(supClass)
            result = classifier.classify(vector)

            polaridadSup = result[0][0]
            for i in entities:
                if j.find(i[0]) != -1:
                    value = (i[0], polaridadSup)
                    results.append(value)
        return results
コード例 #2
0
ファイル: main.py プロジェクト: andoniVT/ESA_Final
 def procesar(self, file, type):
     if type == 1:
         comentarios = []
         obj = Reader(file, 1)
         for i in obj.read():
             for j in i:
                 proc = TextCleaner(j[0])
                 value = [proc.get_processed_comment(), j[2]]
                 if value[0] != "None!":
                     comentarios.append(value)
         return comentarios
     else:
         obj = Reader(file, 4)
         comentarios = []
         for i in obj.read():
             proc = TextCleaner(i[0])
             value = [proc.get_processed_comment(), i[1]]
             if value[0] != "None!":
                 comentarios.append(value)
         return comentarios