- corpustools.neighdens.neighborhood_density.neighborhood_density(corpus_context, query, tierdict, algorithm='edit_distance', max_distance=1, collapse_homophones=False, force_quadratic=False, file_type=None, tier_type=None, sequence_type=None, stop_check=None, call_back=None)¶
Calculate the neighborhood density of a particular word in the corpus.
Context manager for a corpus
The word whose neighborhood density to calculate.
The algorithm used to determine distance
- max_distancefloat, optional
Maximum edit distance from the queried word to consider a word a neighbor
Force use of the less efficient quadratic algorithm even when finding edit distance of 1 neighborhoods
- stop_checkcallable, optional
Optional function to check whether to gracefully terminate early
- call_backcallable, optional
Optional function to supply progress information during the function
- tuple(int, set)
Tuple of the number of neighbors and the set of neighbor Words.