Main

Main

new Main(container, options, parsers)

Initialises a TAG instance with the given parameters

Parameters:
Name Type Description
container String | Element | jQuery

Either a string containing the ID of the container element, or the element itself (as a native/jQuery object)

options Object

Overrides for default library options

parsers Object

Registered parsers for various annotation formats

Source:

Methods

loadData(dataObjects, format)

Loads the given annotation data onto the TAG visualisation

Parameters:
Name Type Description
dataObjects Array

The raw annotation data object(s) to load

format String

One of the supported format identifiers for the data

Source:

(async) loadUrlAsync(path, format)

Reads the given data file asynchronously and loads it onto the TAG visualisation

Parameters:
Name Type Description
path Object

The path pointing to the data

format String

One of the supported format identifiers for the data

Source:

(async) loadFilesAsync(fileList, format)

Reads the given annotation files and loads them onto the TAG visualisation

Parameters:
Name Type Description
fileList FileList

We generally expect only one file here, but some formats (e.g., Brat) involve multiple files per dataset

format String
Source:

init(parsedData)

Prepares all the Rows/Words/Links. Adds all Words/WordClusters to Rows in the visualisation, but does not draw Links or colour the various Words/WordTags

Parameters:
Name Type Description
parsedData Object
Source:

draw()

Resizes Rows and (re-)draws Links and WordClusters, without changing the positions of Words/Link handles

Source:

clear()

Removes all elements from the visualisation

Source:

resize()

Fits the SVG element and its children to the size of its container

Source:

loadTaxonomyYaml(taxonomy)

Loads a new taxonomy specification (in YAML form) into the module

Parameters:
Name Type Description
taxonomy String

A YAML string representing the taxonomy object

Source:

getTaxonomyYaml()

Returns a YAML representation of the currently loaded taxonomy

Source:

getTaxonomyTree() → {Array}

Returns the currently loaded taxonomy as an Array. Simple labels are stored as Strings in Arrays, and category labels are stored as single-key objects.

E.g., a YAML document like the following:

  • Label A
  • Category 1:
    • Label B
    • Label C
  • Label D

Parses to the following taxonomy object:

[ "Label A", { "Category 1": [ "Label B", "Label C" ] }, "Label D" ]

Source:

getColour(label)

Given some label (either for a WordTag or WordCluster), return the colour that the taxonomy manager has assigned to it

Parameters:
Name Type Description
label
Source:

setColour(label, colour)

Sets the colour for some label (either for a WordTag or WordCluster) and redraws the visualisation

Parameters:
Name Type Description
label
colour
Source:

exportSvg()

Exports the current visualisation as an SVG file

Source:

setOption(option, value)

Changes the value of the given option setting (Redraw to see changes)

Parameters:
Name Type Description
option String
value
Source:

getOption(option)

Gets the current value for the given option setting

Parameters:
Name Type Description
option String
Source:

getTopLinkCategories()

Returns an Array of all the categories available for the top Links (Generally, event/relation annotations)

Source:

setTopLinkCategory(category)

Shows the specified category of top Links, hiding the others

Parameters:
Name Type Description
category
Source:

getBottomLinkCategories()

Returns an Array of all the categories available for the bottom Links (Generally, syntactic/dependency parses)

Source:

setBottomLinkCategory(category)

Shows the specified category of bottom Links, hiding the others

Parameters:
Name Type Description
category
Source:

getTagCategories()

Returns an Array of all the categories available for top Word tags (Generally, text-bound mentions)

Source:

setTopTagCategory(category)

Shows the specified category of top Word tags

Parameters:
Name Type Description
category
Source:

setBottomTagCategory(category)

Shows the specified category of bottom Word tags

Parameters:
Name Type Description
category
Source:

setTopMainLabelVisibility(visible)

Shows/hides the main label on top Links

Parameters:
Name Type Description
visible Boolean

Show if true, hide if false

Source:

setTopArgLabelVisibility(visible)

Shows/hides the argument labels on top Links

Parameters:
Name Type Description
visible Boolean

Show if true, hide if false

Source:

setBottomMainLabelVisibility(visible)

Shows/hides the main label on bottom Links

Parameters:
Name Type Description
visible Boolean

Show if true, hide if false

Source:

setBottomArgLabelVisibility(visible)

Shows/hides the argument labels on bottom Links

Parameters:
Name Type Description
visible Boolean

Show if true, hide if false

Source: