spacy_grammar | Language Tool style grammar handling with spaCy | Natural Language Processing library
kandi X-RAY | spacy_grammar Summary
kandi X-RAY | spacy_grammar Summary
This packages uses the spaCy 2.0 alpha which provide support for adding custom attributes to Doc, Span, and Token objects. It also leverages the Matcher API in spaCy to quickly match on spaCy tokens not dissimilar to regex. It reads a grammar.yml file to load up custom patterns and returns the results inside Doc, Span, and Token. It is extensible through adding rules to grammar.yml (though currently only the simple string matching is implemented). A lot of thanks to spacymoji and languagetool for inspiration.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Parse the grammar file
- Check pattern type
- Load grammar file
spacy_grammar Key Features
spacy_grammar Examples and Code Snippets
Community Discussions
Trending Discussions on spacy_grammar
QUESTION
I generate text via transformer models and I am looking for a way of measuring the grammatical text-quality.
Like the text: "Today is a good day. I slept well and got up good in the morning."
should be rated higher than: "Yesterday I went into bed and. got Breakfast son."
Are there any models, which can do this job which I didnt find before, or is there any other way of measuring the quality of the grammatical output of the text?
What I found out was, that spacy has the option to show whether a text has a grammatical error, but what I am more interested in is a score which included the length of the text and the amount of error it has. Also I looked into NLTK readability, but this aims at how well the text can be understood, which depends on more than the grammar only.
Thank you!
...ANSWER
Answered 2020-Oct-05 at 08:10So I found what I was looking for: In this paper the researchers tested different measures for their ability on checking grammar mistakes for text without references (what the GLEU-Score can be used for). They also tested the python-language-tool which is also used for spell checking in open-office. This tool is able to measure the amount of grammar mistakes in a text. For my purpose, I will just divide the amount of error through the amount of words in the text, which gives me an error metric.
Maybe this helps someone, who has the same issue. Here the example code, based on pypi:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spacy_grammar
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page