Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import spacy
- nlp = spacy.load('fr')
- import nltk
- text_fr = u"Je suis parti a la boulangerie. J'ai achete trois croissants. C'etait super bon."
- nltk.sent_tokenize(text_fr)
- # [u'Je suis parti a la boulangerie.',
- # u"J'ai achete trois croissants.",
- # u"C'etait super bon."
- doc = nlp(text_fr)
- for s in doc.sents: print s
- # Je suis parti
- # a la boulangerie. J'ai
- # achete trois croissants. C'
- # etait super bon.
- 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."
- 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.
- [u'I went to the library.',
- u'I did not know what book to buy, but then the lady working there helped me.',
- u'It was cool.',
- u'I discovered a lot of new things.']
Add Comment
Please, Sign In to add comment