parameters: (ind,n=3)
return_statement: return (matrix.asMatrix(), gramsdict)
docstring: Caution: Do not use 0 as label because it evaluates to False
docstring_summary: Caution: Do not use 0 as label because it evaluates to False
docstring_tokens: Caution : Do not use 0 as label because it evaluates to False
function: def training_set(ind,n=3):
      """
      
      Caution: Do not use 0 as label because it evaluates to False
      """
      pos = os.listdir("pos")
      feature_vectors = [ngrams.ngrams(n, open("pos/"+pos[i]).read()) for i in ind.get_pos_train_ind()]
      labels = [1 for i in ind.get_pos_train_ind()]
      neg = os.listdir("neg")
      feature_vectors.extend([ngrams.ngrams(n, open("neg/"+neg[i]).read()) for i in ind.get_neg_train_ind()])
      labels.extend([2 for i in ind.get_neg_train_ind()])
      (matrix, gramsdict) = ngrams.ngrams_to_matrix(feature_vectors, labels, return_gramsdict=True)
      return (matrix.asMatrix(), gramsdict)
function_tokens: def training_set ( ind , n = 3 ) : pos = os . listdir ( "pos" ) feature_vectors = [ ngrams . ngrams ( n , open ( "pos/" + pos [ i ] ) . read ( ) ) for i in ind . get_pos_train_ind ( ) ] labels = [ 1 for i in ind . get_pos_train_ind ( ) ] neg = os . listdir ( "neg" ) feature_vectors . extend ( [ ngrams . ngrams ( n , open ( "neg/" + neg [ i ] ) . read ( ) ) for i in ind . get_neg_train_ind ( ) ] ) labels . extend ( [ 2 for i in ind . get_neg_train_ind ( ) ] ) ( matrix , gramsdict ) = ngrams . ngrams_to_matrix ( feature_vectors , labels , return_gramsdict = True ) return ( matrix . asMatrix ( ) , gramsdict )