dipanjanS/practical-machine-learning-with-python

word.lemma_ will lowercase the token

HuaizhengZhang opened this issue · 5 comments

text = ' '.join([word.lemma_ if word.lemma_ != '-PRON-' else word.text for word in text])

In the latest Spacy, after I run the code, the text will be lowercased. Actually, I do not want to do this at this stage. I think this is an issue.

That would be more of a spacy issue I think, as far as I know typically any lemmatizer returns text in lower case. You might consider checking nltk but I am pretty sure they do the same.

Only option for you is to check the case of each word beforehand and then manually convert the case of the lemma after lemmatization if needed. Otherwise would need to send this request upstream to the spacy or nltk devs.

Do we need to add some comments to explain this in your practical-machine-learning-with-python?

People may be confused to see their results because no matter how they set the do_lowercase, they always get the lowercased text.

yes definitely, that would be a good point to mention I think