## Classes
Analysis

Abstraction over a CG3 analysis. Most sentences have just one of these for each token.

BaseToken

Ancestor of Token, SubToken, SuperToken. Implements methods common to all three of them.

Comment

Abstraction over a CoNLL-U or CG3 comment, allows us to extract and then manipulate data in some useful ways across a Corpus.

Corpus

Abstraction over a collection of Sentences. NOTE: this class is out-of-date and will be replaced soon :)

Label

Allows us to extract labels from "field = value"-type comments, so that we can filter a corpus by Label and arbitrarily apply that label to multiple Sentences.

Labeler

Abstraction to hold a mapping of String => Label pairs, as well as some methods for doing work on those labels.

Sentence

Abstraction over a Sentence. Holds an array of comments and of tokens, plus some metadata.

## Typedefs
Labeler_SortReturnT
## Analysis Abstraction over a CG3 analysis. Most sentences have just one of these for each token. **Kind**: global class ## BaseToken Ancestor of Token, SubToken, SuperToken. Implements methods common to all three of them. **Kind**: global class * [BaseToken](#BaseToken) * [.addHead(head, deprel)](#BaseToken+addHead) * [.modifyHead(head, deprel)](#BaseToken+modifyHead) * [.removeHead(head)](#BaseToken+removeHead) * [.removeAllHeads()](#BaseToken+removeAllHeads) * [.mapHeads()](#BaseToken+mapHeads) * [.mapDependents()](#BaseToken+mapDependents) * [.getHead(format)](#BaseToken+getHead) ⇒ String * [.setEmpty(isEmpty)](#BaseToken+setEmpty) * [.walk(callback)](#BaseToken+walk) * [.hashFields(...fields)](#BaseToken+hashFields) ⇒ String * [.serialize()](#BaseToken+serialize) ### baseToken.addHead(head, deprel) Add a head to a token with a dependency relation. **Kind**: instance method of [BaseToken](#BaseToken) | Param | Type | | --- | --- | | head | [BaseToken](#BaseToken) | | deprel | String | ### baseToken.modifyHead(head, deprel) Change the dependency relation for a given head. **Kind**: instance method of [BaseToken](#BaseToken) | Param | Type | | --- | --- | | head | [BaseToken](#BaseToken) | | deprel | String | ### baseToken.removeHead(head) Remove a head and its dependency relation. **Kind**: instance method of [BaseToken](#BaseToken) | Param | Type | | --- | --- | | head | [BaseToken](#BaseToken) | ### baseToken.removeAllHeads() Remove all heads **Kind**: instance method of [BaseToken](#BaseToken) ### baseToken.mapHeads() Apply a callback to each of a token's heads **Kind**: instance method of [BaseToken](#BaseToken) ### baseToken.mapDependents() Apply a callback to each of token's dependents **Kind**: instance method of [BaseToken](#BaseToken) ### baseToken.getHead(format) ⇒ String Get the head index for a given format **Kind**: instance method of [BaseToken](#BaseToken) | Param | Type | | --- | --- | | format | String | ### baseToken.setEmpty(isEmpty) Mark this token as "empty" (aka "null") **Kind**: instance method of [BaseToken](#BaseToken) | Param | Type | | --- | --- | | isEmpty | boolean | ### baseToken.walk(callback) Apply a callback to each of a token's analyses and subTokens **Kind**: instance method of [BaseToken](#BaseToken) | Param | Type | | --- | --- | | callback | function | ### baseToken.hashFields(...fields) ⇒ String Hash a list of fields to a string **Kind**: instance method of [BaseToken](#BaseToken) | Param | Type | | --- | --- | | ...fields | Array.<String> | ### baseToken.serialize() Serialize a token to JSON format **Kind**: instance method of [BaseToken](#BaseToken) ## Comment Abstraction over a CoNLL-U or CG3 comment, allows us to extract and then manipulate data in some useful ways across a Corpus. **Kind**: global class ## Corpus Abstraction over a collection of Sentences. NOTE: this class is out-of-date and will be replaced soon :) **Kind**: global class ## Label Allows us to extract labels from "field = value"-type comments, so that we can filter a corpus by Label and arbitrarily apply that label to multiple Sentences. **Kind**: global class ## Labeler Abstraction to hold a mapping of String => Label pairs, as well as some methods for doing work on those labels. **Kind**: global class * [Labeler](#Labeler) * [.sort()](#Labeler+sort) ⇒ [Labeler_SortReturnT](#Labeler_SortReturnT) * [.get(name)](#Labeler+get) ⇒ [Label](#Label) * [.count(name)](#Labeler+count) ⇒ Number * [.sentenceHasLabel(sent, searching)](#Labeler+sentenceHasLabel) ⇒ Boolean * [.sentenceInFilter(sent)](#Labeler+sentenceInFilter) ⇒ Boolean * [.addToFilter(name)](#Labeler+addToFilter) * [.removeFromFilter(name)](#Labeler+removeFromFilter) * [.onAdd(sent)](#Labeler+onAdd) * [.onRemove(sent)](#Labeler+onRemove) * [.addLabel(name, [sents])](#Labeler+addLabel) * [.removeLabel(name, sents)](#Labeler+removeLabel) * [.changeLabelName(oldName, newName)](#Labeler+changeLabelName) ⇒ [Label](#Label) * [.changeLabelColor(name, color)](#Labeler+changeLabelColor) ⇒ Boolean * [.changeLabelDesc(name, desc)](#Labeler+changeLabelDesc) ⇒ Boolean ### labeler.sort() ⇒ [Labeler_SortReturnT](#Labeler_SortReturnT) Sort all labels in Corpus by number of Sentences with that label **Kind**: instance method of [Labeler](#Labeler) ### labeler.get(name) ⇒ [Label](#Label) Get a Label given its name **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | name | String | ### labeler.count(name) ⇒ Number Get the number of sentences with a given Label **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | name | String | ### labeler.sentenceHasLabel(sent, searching) ⇒ Boolean Crawl through a sentence's comments to see if it has a particular Label **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | sent | [Sentence](#Sentence) | | searching | String | ### labeler.sentenceInFilter(sent) ⇒ Boolean Checks if a given Sentence should be filtered **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | sent | [Sentence](#Sentence) | ### labeler.addToFilter(name) Adds a Label name to the filter **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | name | String | ### labeler.removeFromFilter(name) Removes a Label name from the filter **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | name | String | ### labeler.onAdd(sent) Callback to be triggered whenever we add a new Sentence to a Corpus **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | sent | [Sentence](#Sentence) | ### labeler.onRemove(sent) Callback to be triggered whenever we remove a Sentence from a Corpus **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | sent | [Sentence](#Sentence) | ### labeler.addLabel(name, [sents]) Add new Label with the given name (if it doesn't already exist) and attach it to a list of Sentences. **Kind**: instance method of [Labeler](#Labeler) | Param | Type | Default | | --- | --- | --- | | name | String | | | [sents] | [Array.<Sentence>](#Sentence) | [] | ### labeler.removeLabel(name, sents) Remove a Label by name (if it exists) from a set of Sentences (can be omitted). **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | name | String | | sents | [Array.<Sentence>](#Sentence) | ### labeler.changeLabelName(oldName, newName) ⇒ [Label](#Label) Change the name of a Label from oldName => newName **Kind**: instance method of [Labeler](#Labeler) | Param | Type | | --- | --- | | oldName | String | | newName | String | ### labeler.changeLabelColor(name, color) ⇒ Boolean Change the color of a Label to a given color **Kind**: instance method of [Labeler](#Labeler) **Returns**: Boolean - - whether the operation succeeded | Param | Type | | --- | --- | | name | String | | color | String | ### labeler.changeLabelDesc(name, desc) ⇒ Boolean Change the description of a Label to a given description **Kind**: instance method of [Labeler](#Labeler) **Returns**: Boolean - - whether the operation succeeded | Param | Type | | --- | --- | | name | String | | desc | String | ## Sentence Abstraction over a Sentence. Holds an array of comments and of tokens, plus some metadata. **Kind**: global class * [Sentence](#Sentence) * [.to(format, options)](#Sentence+to) * [.serialize()](#Sentence+serialize) * [.iterate(callback)](#Sentence+iterate) * [.query()](#Sentence+query) * [.enhance()](#Sentence+enhance) * [.unenhance()](#Sentence+unenhance) * [.getSuperToken(token)](#Sentence+getSuperToken) ⇒ [BaseToken](#BaseToken) * [.merge(src, tar)](#Sentence+merge) * [.combine(src, tar)](#Sentence+combine) * [.split(src, splitAtIndex)](#Sentence+split) ### sentence.to(format, options) Output Sentence to a given format **Kind**: instance method of [Sentence](#Sentence) | Param | Type | | --- | --- | | format | String | | options | Object | ### sentence.serialize() Output Sentence to a notatrix-serial string **Kind**: instance method of [Sentence](#Sentence) ### sentence.iterate(callback) Apply a callback function for every token in the sentence **Kind**: instance method of [Sentence](#Sentence) | Param | Type | | --- | --- | | callback | function | ### sentence.query() Return all tokens where `predicate(token)` is truth-y **Kind**: instance method of [Sentence](#Sentence) ### sentence.enhance() Tell Sentence to output in enhanced dependency format **Kind**: instance method of [Sentence](#Sentence) ### sentence.unenhance() Tell Sentence to stop outputting in enhanced dependency format **Kind**: instance method of [Sentence](#Sentence) ### sentence.getSuperToken(token) ⇒ [BaseToken](#BaseToken) Get the superToken for a given token **Kind**: instance method of [Sentence](#Sentence) | Param | Type | | --- | --- | | token | [BaseToken](#BaseToken) | ### sentence.merge(src, tar) Merge tokens into a single, regular token **Kind**: instance method of [Sentence](#Sentence) | Param | Type | | --- | --- | | src | [BaseToken](#BaseToken) | | tar | [BaseToken](#BaseToken) | ### sentence.combine(src, tar) Combine tokens into subTokens of some superToken **Kind**: instance method of [Sentence](#Sentence) | Param | Type | | --- | --- | | src | [BaseToken](#BaseToken) | | tar | [BaseToken](#BaseToken) | ### sentence.split(src, splitAtIndex) Split a given token into two tokens. If the given token is a superToken, make each of its subTokens into a regular token and delete the superToken. Otherwise, split the token at the given index. **Kind**: instance method of [Sentence](#Sentence) | Param | Type | | --- | --- | | src | [BaseToken](#BaseToken) | | splitAtIndex | Number | ## Labeler_SortReturnT **Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | name | String | Label name | | size | Number | Number of sentences with Label |