ConcordanceIndex.__init__(tokens, key=<function <lambda>>)[source]

Construct a new concordance index.

  • tokens – The document (list of tokens) that this concordance index was created from. This list can be used to access the context of a given word occurrence.
  • key – A function that maps each token to a normalized version that will be used as a key in the index. E.g., if you use key=lambda s:s.lower(), then the index will be case-insensitive.