self-attentive-parser icon indicating copy to clipboard operation
self-attentive-parser copied to clipboard

Get only the text of a span

Open sabn0 opened this issue 4 years ago • 2 comments

for example, extract "house" from the span (NN house) Is it possible?

sabn0 avatar Sep 07 '20 13:09 sabn0

@nonowar7 Look into the spaCy documentations. (on a spaCy Span or Doc object, "orth_" attribute contains the text for it)

text = "this is my sentence."
doc = nlp(text)
sent = list(doc.sents)[0]
child = list(sent._.children)[0].orth_

emadg avatar May 13 '21 22:05 emadg

This is not working

kaliaanup avatar Mar 02 '22 00:03 kaliaanup