Skip to content

Commit

Permalink
hotfix of surface proxies dictionary dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalmasan committed Apr 11, 2020
1 parent 7407f90 commit 44e73c2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/TRUNAJOD/surface_proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def add_periphrasis(doc, periphrasis_type, periphrasis_list):
return doc


def average_clause_length(doc):
def average_clause_length(doc, infinitive_map):
"""Return average clause length (heuristic).
This measurement is computed as the ratio of # of words / # of clauses.
Expand All @@ -88,10 +88,12 @@ def average_clause_length(doc):
:param doc: Text to be processed
:type doc: Spacy Doc
:param infinitve_map: Lexicon containing maps from conjugate to infinitive.
:type infinitive_map: dict
:return: Average clause length
:rtype: float
"""
return word_count(doc) / clause_count(doc)
return word_count(doc) / clause_count(doc, infinitive_map)


def average_sentence_length(doc):
Expand Down Expand Up @@ -579,18 +581,20 @@ def syllable_word_ratio(doc):
return syllable_count(doc) / word_count(doc)


def subordination(doc):
def subordination(doc, infinitive_map):
"""Return subordination, defined as the clause density.
The subordination is defined as the ratio between # of clauses and
the # of sentences. To compute number of clauses, a heuristic is used.
:param doc: Text to be processed.
:type doc: Spacy Doc
:param infinitve_map: Lexicon containing maps from conjugate to infinitive.
:type infinitive_map: dict
:return: Subordination index
:rtype: float
"""
return clause_count(doc) / sentence_count(doc)
return clause_count(doc, infinitive_map) / sentence_count(doc)


def verb_noun_ratio(doc):
Expand Down

0 comments on commit 44e73c2

Please sign in to comment.