Guest User

Untitled

a guest
Dec 13th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import spacy
  2. nlp = spacy.load('fr')
  3. import nltk
  4.  
  5. text_fr = u"Je suis parti a la boulangerie. J'ai achete trois croissants. C'etait super bon."
  6.  
  7.  
  8. nltk.sent_tokenize(text_fr)
  9. # [u'Je suis parti a la boulangerie.',
  10. # u"J'ai achete trois croissants.",
  11. # u"C'etait super bon."
  12.  
  13.  
  14. doc = nlp(text_fr)
  15. for s in doc.sents: print s
  16. # Je suis parti
  17. # a la boulangerie. J'ai
  18. # achete trois croissants. C'
  19. # etait super bon.
  20.  
  21. text = u"I went to the library. I did not know what book to buy, but then the lady working there helped me. It was cool. I discovered a lot of new things."
  22.  
  23. I
  24. went to the library. I
  25. did not know what book to buy, but
  26. then the lady working there helped me. It was cool. I discovered a
  27. lot of new things.
  28.  
  29. [u'I went to the library.',
  30. u'I did not know what book to buy, but then the lady working there helped me.',
  31. u'It was cool.',
  32. u'I discovered a lot of new things.']
Add Comment
Please, Sign In to add comment