universalturtles / Lisibilite

Repo for maintaining the code base for hybrid readability index application called Lisibilite
MIT License
4 stars 3 forks source link

#17 readability metrics first pass #26

Closed ats0stv closed 4 years ago

ats0stv commented 4 years ago

Added calculator for calculating the following readability metrics

The following is not implemented.

Defined the output model as follows.

class OutputDataModel:
    def __init__(self):
        LOG.debug(f"{__name__} init")
        self.coreMetrics = CoreMetrics()
        self.readabilityMetrics = ReadabilityMetrics()
        self.category = ""
        self.description = ""

The output object can be accessed as follows.

from lisibilite.Lisibilite import Lisibilite
    def sample():
        readabilityWithFile = Lisibilite("./resources/sample_text.txt")
        output = readabilityWithFile.getReadabilityMetrics()
        print(output)

Sample Output

*** Core Metrics
Total Sentences = 11
Total Words = 54
Total Hard Words = 51
Total Easy Words = 3
Total Syllables = 82
Total Characters = 260

*** Readability Metrics
Automated Readability Index  = 3.7023232323232307
Coleman-Liau Index  = 6.481481481481481
Flesch-Kincaid Grade Level  = 4.243063973063972
Flesch Reading Ease Score  = 73.38560606060608
Fry Readability Formula  = 0.0
Gunning Fog Index  = 39.74141414141414
Linsear Write Score  = 6.09090909090909
Simple Measure of Gobbledygook  = 15.429909175157395
Category = 
Description =