Class SentencesIndex
source code
object --+
|
SentencesIndex
Class implementing an index of a collection of sentences.
Given a list of sentences, where each sentence is a list of words,
this class generates an index of the list. Each word should be a (word,
POS tag) pair. The index is stored as a dictionary, with the hashable
items as keys and a list of (sentence number, word number) tuples as
values. This class also generates a list of sentence lengths.
Constructor. Takes the list of sentences to index.
- Parameters:
sentences (list) - List of sentences to index. Sentences should be lists of (string,
string) pairs.
- Overrides:
object.__init__
|
Returns the index dictionary.
- Returns: dictionary
- The dictionary containing the index.
|
Returns the list of sentence lengths.
Element 0 is the length of the first sentence, element 1 the second,
etc.
- Returns: list
- List of lengths of sentences.
|