Clarity of writing¶
The clarity of writing module assesses the readability, grammatical correctness and sentiment of a given body of text.
To use the module:
>>> import coast_core >>> coast_core.clarity_of_writing.function(to_use)
>>> from coast_core import clarity_of_writing >>> clarity_of_writing.function(to_use)
A collection of functions that can be used for analysing the clarity of writing within an article
Use the textstat library to report multiple readability measures.
The readability metrics analysed are: * The Flesch Reading Ease Score. A score from 100 (very easy to read) to 0 (very confusing). * The grade score using the Flesch-Kincaid Grade Formula. For example a score of 9.3 means that a ninth grader would be able to read the document. * The FOG index of the given text * The SMOG index of the given text * The ARI(Automated Readability Index) which outputs a number that approximates the grade level needed to comprehend the text. For example if the ARI is 6.5, then the grade level to comprehend the text is 6th to 7th grade * The grade level of the text using the Coleman-Liau Formula * The grade level using the Lisear Write Formula * The grade level using the New Dale-Chall Formula.
Parameters: article_text – The article text to operate on. Returns: An object containing all measures
Use the language_check library to check a body of text for grammatical issues.
Parameters: article_text – The text to be analyse. Returns: The total number of grammatical issues found. A list containing details of each grammatical issue. A list of sentences, tokenized by NLTK.
Given a body of text, will use the langdetect library to detect the text language and return.
Parameters: text – The body of text to analyse. Returns: The language code (e.g. EN for English).
Runs a complete end-to-end analysis of clarity of writing using all other functions.
Parameters: article_text – The article text to operate on. Returns: An object containing language, readability, grammar and sentiment
Run sentiment analysis over the article.
Parameters: article_text – The article text to operate on. Returns: An object that contain polarity and subjectivity. Polarity, also known as orientation is he emotion expressed in the sentence. It can be positive, neagtive or neutral. Subjectivity is when text is an explanatory article which must be analysed in context.