title: How to exclude prepositions and conjunctions while tokenizing with nltk?
body: <p>I have the following sentence: </p>
  
  <pre><code>sentence="The other day I met with Juan and Mary"
  </code></pre>
  
  <p>And I want to tokenize it but by keeping just the main words, that is: other, day, I, met, Juan, Mary. What I have done so far is tokenize it using <code>nltk</code> library as follows:</p>
  
  <pre><code>tokens=nltk.word_tokenize(sentence)
  </code></pre>
  
  <p>Which gives me the following: </p>
  
  <pre><code>['The', 'other', 'day', 'I', 'met', 'with', 'Juan', 'and', 'Mary']
  </code></pre>
  
  <p>I have also tried to tagged the words by using <code>nltk_pos_tag(tokens)</code> obtaining: </p>
  
  <pre><code>[('The', 'DT'), ('other', 'JJ'), ('day', 'NN'), ('I', 'PRP'), ('met', 'VBD'), ('with', 'IN'), ('Juan', 'NNP'), ('and', 'CC'), ('Mary', 'NNP')]
  </code></pre>
  
  <p>By doing this I could myself delete those words which I don't want as the ones mentioned above as simple as searching their tags and delete the tuple. However, I am wondering if there is a more direct way to do it or if there is a command in <code>nltk</code>that will do it itself. </p>
  
  <p>Any help would be appreciated! Thank you very much.</p>
  
  <p><strong>Edit:</strong> This post doesn't want to eliminate just stopwords but to see the different options one could have to do so as ilustratred above with <code>nltk_pos_tag(tokens)</code>. </p>