#NEWLINE# def create_ngram_model( params = None ) : #NEWLINE# #INDENT# tfidf_ngrams = TfidfVectorizer ( ngram_range = ( 1 , 3 ) , analyzer = 'word' , binary = False ) #NEWLINE# clf = MultinomialNB ( ) #NEWLINE# pipeline = Pipeline ( [ ( 'vect' , tfidf_ngrams ) , ( 'clf' , clf ) ] ) #NEWLINE# if params : #NEWLINE# #INDENT# pipeline . set_params ( ** params ) #NEWLINE# #UNINDENT# return pipeline