chartbeat-labs / textacy

NLP, before and after spaCy
https://textacy.readthedocs.io
Other
2.22k stars 250 forks source link

An example of direct_quotations #200

Open ghost opened 6 years ago

ghost commented 6 years ago

Hello, I am trying to use this function but it seems that it does not consider these kind of examples:

from textacy import extract as ex
doc=nlp(" Kurds are pitted against Kurds , Iraqis against Kurds , Turks against Kurds -- and the American planes just circle overhead without intervening , " the minister said)
ex.direct_quotations(doc)

Is there any example to show how this function works?

thanks

danieljue commented 5 years ago

Hi, I just discovered this feature and tried to use it too. With some additional string formatting I got this to work:

from textacy import extract as ex
doc=nlp(" \"Kurds are pitted against Kurds , Iraqis against Kurds , Turks against Kurds -- and the American planes just circle overhead without intervening , \" the minister said")
a=ex.direct_quotations(doc)
for item in a: print (item)

(minister, said, "Kurds are pitted against Kurds , Iraqis against Kurds , Turks against Kurds -- and the American planes just circle overhead without intervening , ")