Automatically Converting Active Voice to Passive Voice and Vice Versa

Written by on February 16, 2020 in Natural Language Processing, Programming, Prolog with 0 Comments

The iLexicon system can handle active/passive voice conversion of fairly complex English sentences. I gave examples of the underlying verb conjugation mechanism in this article and this one. Today, I am going to give examples of the conversion of complete sentences.

Here is an example of active to passive voice conversion:

Active To Passive Voice

Active To Passive Voice

The above is a snapshot of the interactive session in my Sicstus Prolog IDE. You can see that the sentence he drank milk” has been correctly converted to milk was drunk by him”.

Here are some more examples of active to passive voice conversion:

Some More Examples

Some More Examples

The last example is a special case that uses the preposition “to” instead of “by” in the passive voice.

What about passive voice to active voice? The following is based on the earlier example:

Passive To Active Voice

Passive To Active Voice

It works as expected. Here are some more conversions:

More Examples - Passive To Active

More Examples – Passive To Active

Notice how the pronouns in the first example are suitably modified while changing the voice. The last example is a special case where the subject is missing. The word “someone” is introduced in this case when converting to active voice.

Instead of converting from one voice to the other, we can give an active voice sentence and a passive voice sentence and check if they agree.

Validating Active/Passive Sentence Pairs

Validating Active/Passive Sentence Pairs

Note that the system flags the second example as incorrect. The correct conversion of the active voice sentence “he drank the sweet milk” is “the sweet milk was drunk by him“.

Here are more examples of this:

More Validation Examples

More Validation Examples

As you would have guessed, the first example shows incorrect conversion. The correct conversion is “the story book is being read by peter“.

iLexicon’s conversion engine first parses the given sentence to extract the Subject, Predicate and Object. Then it applies verb conjugation and active/passive conversion rules, and finally emits the transformed structure. Below is a snapshot of the core logic (Prolog):

The Core Conversion Logic

The Core Conversion Logic

It was challenging to work on this part but I thoroughly enjoyed it!

Have a great weekend!

Tags: , , ,

Subscribe

If you enjoyed this article, subscribe now to receive more just like it.

Subscribe via RSS Feed

Leave a Reply

Your email address will not be published. Required fields are marked *

Top