List of list of words by Python:
<p>Having a long list  of comments (50 by saying) such as this one:   </p>

<blockquote>
  <p>"this was the biggest disappointment of our trip. the restaurant had
  received some very good reviews, so our expectations were high. the
  service was slow even though the restaurant was not very full. I had
  the house salad which could have come out of any sizzler in the us.
  the keshi yena, although tasty reminded me of barbequed pulled
  chicken. this restaurant is very overrated".</p>
</blockquote>

<p>I want to create a list of list of words retaining sentence tokenization using python.  </p>

<p>After removing stopwords I want a result for all 50 comments in which sentence tokens are retained and word tokens are retained into each tokenized sentence. At the end I hope result being similar to:  </p>

<pre><code>list(c("disappointment", "trip"), 
     c("restaurant", "received", "good", "reviews", "expectations", "high"), 
     c("service", "slow", "even", "though", "restaurant", "full"),
     c("house", "salad", "come", "us"), 
     c("although", "tasty", "reminded", "pulled"), 
     "restaurant")  
</code></pre>

<p>How could I do that in python? Is R a good option in this case? I really will appreciate your help.</p>

<p>Not sure you want R for this or not, but based on your requirement, I think it can be done in a pure pythonic way as well. </p>

<p>You basically want a list that contains small list of important words (that are not stop words) per sentence.</p>

<p>So you can do something like</p>

<pre><code>input_reviews = """
this was the biggest disappointment of our trip. the restaurant had received some very good reviews, so our expectations were high. 
the service was slow even though the restaurant was not very full. I had the house salad which could have come out of any sizzler in the us. 
the keshi yena, although tasty reminded me of barbequed pulled chicken. this restaurant is very overrated.
"""

# load your stop words list here
stop_words_list = ['this', 'was', 'the', 'of', 'our', 'biggest', 'had', 'some', 'very', 'so', 'were', 'not']


def main():
    sentences = input_reviews.split('.')
    sentence_list = []
    for sentence in sentences:
        inner_list = []
        words_in_sentence = sentence.split(' ')
        for word in words_in_sentence:
            stripped_word = str(word).lstrip('\n')
            if stripped_word and stripped_word not in stop_words_list:
                # this is a good word
                inner_list.append(stripped_word)

        if inner_list:
            sentence_list.append(inner_list)

    print(sentence_list)



if __name__ == '__main__':
    main()
</code></pre>

<p>On my end, this outputs</p>

<pre><code>[['disappointment', 'trip'], ['restaurant', 'received', 'good', 'reviews,', 'expectations', 'high'], ['service', 'slow', 'even', 'though', 'restaurant', 'full'], ['I', 'house', 'salad', 'which', 'could', 'have', 'come', 'out', 'any', 'sizzler', 'in', 'us'], ['keshi', 'yena,', 'although', 'tasty', 'reminded', 'me', 'barbequed', 'pulled', 'chicken'], ['restaurant', 'is', 'overrated']]
</code></pre>

python word-list