Let’s look at this with an example:
- Is our child exercising enough?
- Is our child being trained enough?
The verb "is" can only be used with singular nouns. For plural nouns, we use “is”. This problem is very common in the real world, and we can fix it by creating corrective verbs that are used depending on whether the fragment contains a plural or singular noun.
Code # 1: class singularize_plural_noun ()
Code # 2: Plural Singularization
[(’recipe’,’ NN’), (’book’,’ NN’)]
The code above looks for an NNS tag for plural search. Once found, if the next word is a noun (determined by making sure the tag starts with NN), we remove the plural noun by removing the "s" from the right side of the tag and the word.
Swap endless phrases
An infinitive phrase has the form A of B , for example, "movie world". It can convert it to a "movie world" and it still has the same meaning.
Code # 3: Let’s get a handle on the swap_infinitive_phrase () class
Code # 4: Let’s evaluate swap_infinitive_phrase
[(’recipes’,’ NNS’), (’book’,’ NN’)]