A bidirectional index between words and their 'contexts' in a text.
The context of a word is usually defined to be the words that occur in a
fixed window around the word; but other definitions may also be used by
providing a custom context function.
|
|
| __init__(self,
tokens,
context_func=None,
filter=None,
key=<function <lambda> at 0x7a0070>) |
source code
|
|
list of token
|
tokens(self)
Returns:
The document that this context index was created from. |
source code
|
|
|
|
word_similarity_dict(self,
word)
Return a dictionary mapping from words to 'similarity scores,'
indicating how often these two words occur in the same context. |
source code
|
|
|
|
|
|
|
common_contexts(self,
words,
fail_on_unknown=False)
Find contexts where the specified words can all appear; and return a
frequency distribution mapping each context to the number of times
that context was used. |
source code
|
|