How to extract sentences from a doc given sentence does not contain token with a specific dep_ ? #10588
-
Greetings all, I am struggling to use For instance:
sentences 1 and 2 include 'dobj', However, I would like extract sentences only if the sentence does not contain any token whose dep_ is 'dobj'. The following code return all sentences including the ones with token.dep_ == 'dobj'.
What is the correct way to negate |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Well after many attempts, I found the solution as follows;
It may be of the use for someone else. However I am not sure why simple iterating |
Beta Was this translation helpful? Give feedback.
Well after many attempts, I found the solution as follows;
It may be of the use for someone else. However I am not sure why simple iterating
if token.dep_ != 'dobj'
would not work in the original question.