コード例 #1
0
ファイル: sentence.py プロジェクト: tsproisl/textcomplexity
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
ファイル: sentence.py プロジェクト: tsproisl/textcomplexity
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
ファイル: sentence.py プロジェクト: tsproisl/textcomplexity
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
ファイル: sentence.py プロジェクト: tsproisl/textcomplexity
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
ファイル: sentence.py プロジェクト: tianfrank/textcomplexity
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)