TextDocument constructor

TextDocument({
  1. required String sourceText,
  2. required List<Token> tokens,
  3. required List<String> paragraphs,
  4. required List<String> sentences,
  5. required List<String> terms,
  6. required List<String> nGrams,
  7. required TermCoOccurrenceGraph keywords,
  8. required int syllableCount,
  9. List<String>? zones,
})

Hydrates a const TextDocument from the document properties.

  • sourceText is all the analysed text in the document. The text from a JSON document's (analysed) fields is joined with line ending marks;
  • paragraphs is a list of strings after splitting sourceText at line ending marks;
  • sentences is a list of strings after splitting sourceText at sentence ending punctuation and line ending marks;
  • nGrams is a collection of word sequences generated from the terms;
  • terms is all the words in the sourceText;
  • keywords is the keywords in the document mapped to their RAKE keyword score in a TermCoOccurrenceGraph;
  • syllableCount is the total number of syllables in the document; and
  • tokens is all the tokens extracted from sourceText.

Implementation

factory TextDocument(
        {required String sourceText,
        required List<Token> tokens,
        required List<String> paragraphs,
        required List<String> sentences,
        required List<String> terms,
        required List<String> nGrams,
        required TermCoOccurrenceGraph keywords,
        required int syllableCount,
        List<String>? zones}) =>
    _TextDocumentImpl(sourceText, zones, tokens, paragraphs, sentences, terms,
        nGrams, syllableCount, keywords);