Почему разделитель / токенизатор предложений от Spacy плохо работает? nltk вроде работает нормально. Вот мой небольшой опыт:
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."
Я получаю с простором (после nlp=spacy.load('en')
):
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.
против этого с nltk, который выглядит хорошо:
[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.']