Tools.Trends()

Trends shows a line graph depicting the distribution of a word's occurrence across a corpus or document.

Tutorials:
Example
let config = {
    "chartType": null,
    "docId": null,
    "docIndex": null,
    "labels": null,
    "limit": null,
    "mode": null,
    "query": null,
    "stopList": null,
    "withDistributions": null
  };

  loadCorpus("austen").tool("Trends", config);

Members

bins

Properties:
Name Type Description
TODO bins

verify this:

The default value will depend on the nature of the corpus:

  • corpus has one document: the default number of bins is 10
  • corpus has multiple documents:
    • corpus has up to 100 documents: the default number is the size of the corpus
    • corpus has more than 1000 documents: the default number is 100

chartType

Properties:
Name Type Default Description
chartType String barline

The of chart to display: Options are: 'area', 'bar', 'line', 'stacked', and 'barline'.

docId

Properties:
Name Type Description
docId String | Array.<String>

The document ID(s) to restrict the results to.

docIndex

Properties:
Name Type Description
docIndex Number | Array.<Number>

The document index(es) to restrict the results to.

labels

Properties:
Name Type Default Description
labels Boolean false

Whether to show term labels.

limit

Properties:
Name Type Default Description
limit Number 5

The number of items to limit the result to.

mode

Properties:
Name Type Default Description
mode String corpus

Force the mode to be either "corpus" (distribution of terms across documents) or "document" (distribution of terms within a document); usually this is correctly set by default according to whether the corpus has one document ("document") or more than one ("corpus").

query

Properties:
Name Type Description
query String | Array.<String>

A query or array of queries (queries can be separated by a comma). For query syntax, see the search documentation.

stopList

Properties:
Name Type Default Description
stopList String auto

A comma-separated list of words, a named list or a URL to a plain text list, one word per line. By default this is set to 'auto' which auto-detects the document's language and loads an appropriate list (if available for that language). Set this to blank to not use the default stopList. For more information see the Stopwords documentation.

withDistributions

Properties:
Name Type Default Description
withDistributions String relative

Determines whether to show "raw" or "relative" frequencies (those are the two valid values). The default value is "relative" (unless there's only one document in the corpus, in which case raw frequencies are shown).