skfasttext/FastTextClassifier.py
def predict(self,test_file,csvflag=True,k_best=1):
                '''
                Input: Takes input test finle in format
                return results object
                to do: add unit tests using sentiment analysis dataset 
                to do: Add K best labels options for csvflag = False 
                
                '''
                try:
                    if csvflag==False and type(test_file) == 'list':
                        self.result=self.classifier.predict(test_file,k=k_best)
                    if csvflag:
                            lines=open(test_file,"r").readlines()
                            sentences=[line.split(" , ")[1] for line in lines]
                            self.result=self.classifier.predict(sentences,k_best)
                except:
                    print("Error in input dataset.. please see if the file/list of sentences is of correct format")
                    sys.exit(-1)
                self.result=[int(labels[0]) for labels in self.result]
                return(self.result)

                Input: Takes input test finle in format
                return results object
                to do: add unit tests using sentiment analysis dataset 
                to do: Add K best labels options for csvflag = False 
                
                
Takes input test finle in format
return results object
to do: add unit tests using sentiment analysis dataset
to do: Add K best labels options for csvflag = False
Takes input test finle in format return results object to do : add unit tests using sentiment analysis dataset to do : Add K best labels options for csvflag = False
def predict(self,test_file,csvflag=True,k_best=1):
                try:
                    if csvflag==False and type(test_file) == 'list':
                        self.result=self.classifier.predict(test_file,k=k_best)
                    if csvflag:
                            lines=open(test_file,"r").readlines()
                            sentences=[line.split(" , ")[1] for line in lines]
                            self.result=self.classifier.predict(sentences,k_best)
                except:
                    print("Error in input dataset.. please see if the file/list of sentences is of correct format")
                    sys.exit(-1)
                self.result=[int(labels[0]) for labels in self.result]
                return(self.result)
def predict ( self , test_file , csvflag = True , k_best = 1 ) : try : if csvflag == False and type ( test_file ) == 'list' : self . result = self . classifier . predict ( test_file , k = k_best ) if csvflag : lines = open ( test_file , "r" ) . readlines ( ) sentences = [ line . split ( " , " ) [ 1 ] for line in lines ] self . result = self . classifier . predict ( sentences , k_best ) except : print ( "Error in input dataset.. please see if the file/list of sentences is of correct format" ) sys . exit ( - 1 ) self . result = [ int ( labels [ 0 ] ) for labels in self . result ] return ( self . result )
Input: Takes input test finle in format
return results object
to do: add unit tests using sentiment analysis dataset
to do: Add K best labels options for csvflag = False
Input : Takes input test finle in format return results object to do : add unit tests using sentiment analysis dataset to do : Add K best labels options for csvflag = False
'''
                Input: Takes input test finle in format
                return results object
                to do: add unit tests using sentiment analysis dataset 
                to do: Add K best labels options for csvflag = False 
                
                '''
self
test_file
csvflag
k_best