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 : singularize_plural_noun() class
Code #2 : Singularizing Plurals
[('recipe', 'NN'), ('book', 'NN')]
The code above looks for the tag NNS to look for Plural Noun. After founding it, if the next word is a noun (determined by making sure the tag starts with NN), then we depluralize the plural noun by removing ‘s’ from the right side of both the tag and the word.
Swapping Infinite Phrases
An infinitive phrase is of the form A of B, such as ‘world of movies’. On can transform this to ‘movies world’ and it still holds the same meaning.
Code #3 : Let’s understand the swap_infinitive_phrase() class
Code #4 : Let’s evaluate swap_infinitive_phrase
[('recipes', 'NNS'), ('book', 'NN')]
- NLP | Swapping Verb Phrases and Noun Cardinals
- Infinite Iterators in Python
- Remove infinite values from a given Pandas DataFrame
- NLP | Chunking and chinking with RegEx
- NLP | Training a tokenizer and filtering stopwords in a sentence
- NLP | Splitting and Merging Chunks
- NLP | Expanding and Removing Chunks with RegEx
- NLP | Leacock Chordorow (LCH) and Path similarity for Synset
- NLP | Regex and Affix tagging
- NLP | Chunk Tree to Text and Chaining Chunk Transformation
- NLP | How to score words with Execnet and Redis
- NLP | Classifier-based Chunking | Set 2
- Processing text using NLP | Basics
- Readability Index in Python(NLP)
- Feature Extraction Techniques - NLP
- Python | NLP analysis of Restaurant reviews
- Applying Multinomial Naive Bayes to NLP Problems
- NLP | Training Unigram Tagger
- NLP | Synsets for a word in WordNet
- NLP | Part of Speech - Default Tagging
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.