Пример #1
0
    def test_only_sentiments(self, sentences):
        y_true = []
        y_predicted = []
        for i in sentences:
            obj = Unsupervised(i[0])
            result = obj.classify()
            y_true.append(i[1])
            y_predicted.append(result)
            print i[0] + " " + i[1] + " " + result

        print classification_report(y_true, y_predicted)
Пример #2
0
    def __testUnsup(self, segmentos, entities):
        results = []
        for i in segmentos:
            obj = Unsupervised(i)
            result = obj.classify()

            for j in entities:
                if i.find(j[0]) != -1:
                    value = (j[0], result)
                    results.append(value)
        return results