示例#1
0
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)
示例#2
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)
示例#3
0
def sentence_length_words(sentences, punctuation):
    """Mean sentence length in words, i.e. excluding punctuation; also
    returns the standard deviation.

    """
    slw = functools.partial(_sentence_length_words, punctuation=punctuation)
    return misc.average_measure(slw, sentences)
示例#4
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)
示例#5
0
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)
示例#6
0
def sentence_length_tokens(sentences):
    """Mean sentence length in tokens, i.e. including punctuation; also
    returns the standard deviation.

    """
    return misc.average_measure(_sentence_length_tokens, sentences)
示例#7
0
def sentence_length_words(sentences):
    """Mean sentence length in words; also returns the standard
    deviation.

    """
    return misc.average_measure(_sentence_length_words, sentences)
示例#8
0
def dependents_per_word(sentence_graphs):
    return misc.average_measure(_dependents_per_word, sentence_graphs)
示例#9
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)
示例#10
0
def average_dependency_distance(sentence_graphs):
    """Oya (2011)"""
    return misc.average_measure(_average_dependency_distance, sentence_graphs)
示例#11
0
def height(trees):
    return misc.average_measure(_height, trees)
示例#12
0
def constituents_wo_leaves(trees):
    return misc.average_measure(_constituents_wo_leaves, trees)