neighborhood_density¶
-
corpustools.neighdens.neighborhood_density.
neighborhood_density
(corpus_context, query, algorithm='edit_distance', max_distance=1, stop_check=None, call_back=None)[source]¶ Calculate the neighborhood density of a particular word in the corpus.
Parameters: corpus_context : CorpusContext
Context manager for a corpus
query : Word
The word whose neighborhood density to calculate.
algorithm : str
The algorithm used to determine distance
max_distance : float, optional
Maximum edit distance from the queried word to consider a word a neighbor.
stop_check : callable, optional
Optional function to check whether to gracefully terminate early
call_back : callable, optional
Optional function to supply progress information during the function
Returns: tuple(int, set)
Tuple of the number of neighbors and the set of neighbor Words.