To detect passive voice in sentences, we can use the spacy module to tag each token in the sentence, then build a classifier to classify it as passive or active based on conventional grammatical rules, e.g.
If a clause has all of the following, then it is in the passive voice:
- A form of an auxiliary verb (usually be or get)
- The past participle of a transitive verb
- No direct object
- The subject of the verb phrase is the entity undergoing an action or having its state changed
News headlines are written differently. They don't follow conventional grammatical rules. How would one be able to use spacy to detect headlines in passive voice?
For example, if I have this headline, "Church That Defied Coronavirus Restrictions Is Burned to Ground," its part-of-speech tags are
['ROOT', 'dobj', 'compound', 'compound', 'nsubjpass', 'auxpass', 'relcl', 'prep', 'pobj']. We can classify this as passive, based on the fact that it has a nominal subject (passive) and no direct object.
However, if I have this headline, "Rayshard Brooks Fatally Shot By the Atlanta Police," its part-of-speech tags are
['compound', 'ROOT', 'advmod', 'ROOT', 'prep', 'det', 'compound', 'pobj']. We can't use any of the criteria to classify this as passive voice, because the headline has dropped the auxiliary and spacy doesn't detect a nominal subject (passive).