Complexity Analyzer
Bases: Enum
The heuristic according to which the complexity of a sentence is to be
quantified. GLOBAL uses an algorithm that evaluates a sentence as a
monolith; AGGREGATED_LOCAL uses an algorithm that calculates phrasal
complexity for each phrase in a given sentence, and then aggregates these
values.
Source code in src/limes/models.py
Bases: ABC
Class for calculating language complexity.
Source code in src/limes/analyzers/interfaces.py
get_global_complexity(sentence, heuristic)
abstractmethod
Calculate the complexity of the entire sentence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sentence
|
DocumentProtocol
|
The sentence for which the complexity is to be calculated. Please note that this function is designed to perform only on single sentences but won't complain if you pass a DocumentProtocol instance that constitutes a complete text. In that case, the values returned may be nonsensical. |
required |
heuristic
|
ComplexityAlgorithm
|
Determines which heuristic to use to calculate the complexity. |
required |
Source code in src/limes/analyzers/interfaces.py
get_local_complexities(sentence)
abstractmethod
Get a list of syntactically coherent phrases that constitute the given text, as well as their respective calculated syntactic complexities. You can sum the local complexities to get a sound heuristic for the complexity of the complete sentence.