title: Train two features instead of one
body: <p>I have this code. I have two features. How do I train the two features together?</p>
  
  <pre><code>from textblob import TextBlob, Word, Blobber
  from textblob.classifiers import NaiveBayesClassifier
  from textblob.taggers import NLTKTagger
  import re
  import nltk
  
  
  
  def get_word_before_you_feature(mystring):
      keyword = 'you'
      before_keyword, keyword, after_keyword = mystring.partition(keyword)
      before_keyword = before_keyword.rsplit(None, 1)[-1]
      return {'word_after_you': before_keyword}
  
  
  def get_word_after_you_feature(mystring):
      keyword = 'you'
      before_keyword, keyword, after_keyword = mystring.partition(keyword)
      after_keyword = after_keyword.split(None, 1)[0]
      return {'word_after_you': after_keyword}
      classifier = nltk.NaiveBayesClassifier.train(train)
  
  
  
  lang_detector = NaiveBayesClassifier(train, feature_extractor=get_word_after_you_feature)
  lang_detector = NaiveBayesClassifier(train, feature_extractor=get_word_before_you_feature)
  
  
  print(lang_detector.accuracy(test))
  print(lang_detector.show_informative_features(5))
  </code></pre>
  
  <p>This is the output I get.</p>
  
  <blockquote>
    <p>word_before_you = 'do'           refere : generi =      2.2 : 1.0
    <br />
       word_before_you = 'when'         generi : refere =      1.1 : 1.0</p>
  </blockquote>
  
  <p>It only seems to get the last feature. How do I get the classifier to train both features instead of one.</p>