Skip to content

Commit

Permalink
Merged branch dev-nacho into dev-nacho
Browse files Browse the repository at this point in the history
  • Loading branch information
meliascosta committed Jun 13, 2017
2 parents abca8b9 + 87c1a14 commit e655c6b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions textar/text_classifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
u"""Módulo de clasificación de textos.
Este módulo contiene a los objetos que permiten entrenar un clasificador
Expand All @@ -10,8 +9,6 @@
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.linear_model import SGDClassifier
from sklearn.svm import LinearSVC # No se usa mas Quitar
from scipy import sparse # No se usa mas quitar
import pandas as pd
import numpy as np
import os
Expand Down Expand Up @@ -103,7 +100,7 @@ def retrain(self, name, ids, labels):
except AttributeError:
raise AttributeError("No hay ningun clasificador con ese nombre.")
indices = np.in1d(self.ids, ids)
if isinstance(labels, basestring):
if isinstance(labels, str):
labels = [labels]
classifier.partial_fit(self.tfidf_mat[indices, :], labels)

Expand Down Expand Up @@ -147,7 +144,7 @@ def _make_text_vectors(self, examples):
El tamaño de la matriz es de (N, T) donde N es la cantidad de
ejemplos y T es la cantidad de términos en el vocabulario.
"""
if isinstance(examples, basestring):
if isinstance(examples, str):
if examples in self.ids:
textvec = self.tfidf_mat[self.ids == examples, :]
else:
Expand Down

0 comments on commit e655c6b

Please sign in to comment.