Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from keras.preprocessing.text import text_to_word_sequence
  2. # define
  3. text = """Founded in 2002, SpaceX’s mission is to enable humans to become a spacefaring civilization and a multi-planet
  4. species by building a self-sustaining city on Mars. In 2008, SpaceX’s Falcon 1 became the first privately developed
  5. liquid-fuel launch vehicle to orbit the Earth."""
  6.  
  7. # tokenize
  8. result = text_to_word_sequence(text)
  9.  
  10. #removing stopwords
  11. new_sent = [word for word in result if word not in stopwords.words("english")]
  12. result1 = ' '.join(new_sent)
  13.  
  14. print(result1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement