def punctuation_per_sentence(sentences, punctuation):
    """Number of punctuation tokens per sentence (according to
    `punctuation`, a set of part-of-speech tags).

    """
    pps = functools.partial(_punctuation_per_sentence, punctuation=punctuation)
    return misc.average_measure(pps, sentences)
Esempio n. 2
0
def closeness_centralization(sentence_graphs):
    """Closeness centralization of the graph (Freeman, 1978). Return
    values range between 0 and 1. 1 means all other vertices are
    dependent on the root vertex. Used by Oya (2012).

    """
    return misc.average_measure(_closeness_centralization, sentence_graphs)
Esempio n. 3
0
def closeness_centrality(sentence_graphs):
    """Closeness centrality of the root vertex, i.e. the inverse of the
    average length of the shortest paths from the root to all other
    vertices. Used by Oya (2012).

    """
    return misc.average_measure(_closeness_centrality, sentence_graphs)
def sentence_length_characters(sentences):
    """Mean sentence length in characters; also returns the standard
    deviation. Sentence length in characters is the sum of token
    lengths plus number of token boundaries, i.e. we assume a space
    between all tokens.

    """
    return misc.average_measure(_sentence_length_characters, sentences)
def sentence_length_words(sentences):
    """Mean sentence length in words; also returns the standard
    deviation.

    """
    return misc.average_measure(_sentence_length_words, sentences)
Esempio n. 6
0
def dependents_per_word(sentence_graphs):
    return misc.average_measure(_dependents_per_word, sentence_graphs)
Esempio n. 7
0
def average_dependency_distance(sentence_graphs):
    """Oya (2011)"""
    return misc.average_measure(_average_dependency_distance, sentence_graphs)
Esempio n. 8
0
def longest_shortest_path(sentence_graphs):
    """Longest shortest path from the root vertex, i.e. depth of the
    tree.

    """
    return misc.average_measure(_longest_shortest_path, sentence_graphs)