Let’s understand this with an example :
- Is our child training enough?
- Is are our child training enough?
The verb ‘is’ can only be used with singular nouns. For plural nouns we use ‘are’. This problem is very common in the real world and we can correct this mistake by creating verb correction mappings that are used depending on whether there’s plural or singular noun in the chunk.
Code #1 : Defining the verb correction mappings
We are searching the chunk for the position of the first tagged word using the first_chunk_index() method. This method had a parameter ‘pred’ that takes a (word, tag) tuple and returns True or False.
Code #2 : first_chunk_index()
The predicate function in the code below returns True if the tag in the (word, tag) argument starts with a given tag prefix. Else, false.
Code #3 :
Code #4 : Let’s correct the verb forms
Corrected verb forms : [('are', 'VBP'), ('our', 'PRP$'), ('children', 'NNS'), ('learning', 'VBG')]
- NLP | Swapping Verb Phrases and Noun Cardinals
- Spelling Correction using K-Gram Overlap
- Multitape Nondeterministic Turing Machine simulator
- Python | sympy RGS method
- Python | sympy Partition() method
- Python | sympy Relational() method
- Python | sympy from_rgs() method
- Difference Between Go and Python Programming Language
- Python | sympy.StrictGreaterThan() method
- Python | sympy.LessThan() method
- Python | sympy.StrictLessThan() method
- Python | sympy.GreaterThan() method
- Python OpenCV | cv2.circle() method
- Python OpenCV | cv2.rectangle() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.