- Defining a grammar to parse 3 phrase types.
- ChunkRule class that looks for an optional determiner followed by one or more nouns is used for noun phrases.
- To add an adjective to the front of a noun chunk, MergeRule class is used.
- Any IN word is simply chunked for the prepositional phrases.
- an optional modal word (such as should) followed by a verb is chunked for the verb phrases.
Code #1 :
Accuracy : 0.6148573545757688
treebank_chunk corpus is a special version of the treebank corpus and it provides a chunked_sents() method. Duw to its file format, the regular treebank corpus cannot provide that method.
Code #2 : Using treebank_chunk
Accuracy : 0.49033970276008493
Chunk Score Metrices
It provides metrics other than accuracy. Of the chunks
Precision means how many were correct.
Recall means how well the chunker did at finding correct chunks compared to how many total chunks there were.
Code #3 : Chunk Score Metrices
Precision : 0.60201948127375 Recall : 0.606072502505847 Length for missed one : 47161 Length for incorrect one : 47967 Length for correct one : 119720 Length for guessed one : 120526
- Partial Functions in Python
- XML parsing in Python
- Parsing XML with DOM APIs in Python
- Pandas | Parsing JSON Dataset
- Command-Line Option and Argument Parsing using argparse in Python
- Argparse VS Docopt VS Click - Comparing Python Command-Line Parsing Libraries
- Verbose in Python Regex
- NLP | Regex and Affix tagging
- NLP | Chunking and chinking with RegEx
- Python Regex: re.search() VS re.findall()
- Pattern matching in Python with Regex
- Name validation using IGNORECASE in Python Regex
- NLP | Expanding and Removing Chunks with RegEx
- Python - Substituting patterns in text using regex
- Find all the patterns of “1(0+)1” in a given string using Python Regex
- Python | Parse a website with regex and urllib
- The most occurring number in a string using Regex in python
- Replace values in Pandas dataframe using regex
- Python | Program that matches a word containing 'g' followed by one or more e's using regex
- Python | Check if string matches regex list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.