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 |
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 |
(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 |
(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
|
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
|
draw()
Resizes Rows and (re-)draws Links and WordClusters, without changing the positions of Words/Link handles
clear()
Removes all elements from the visualisation
resize()
Fits the SVG element and its children to the size of its container
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 |
getTaxonomyYaml()
Returns a YAML representation of the currently loaded taxonomy
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" ]
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 |
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 |
exportSvg()
Exports the current visualisation as an SVG file
setOption(option, value)
Changes the value of the given option setting (Redraw to see changes)
Parameters:
Name | Type | Description |
---|---|---|
option |
String
|
|
value |
getOption(option)
Gets the current value for the given option setting
Parameters:
Name | Type | Description |
---|---|---|
option |
String
|
getTopLinkCategories()
Returns an Array of all the categories available for the top Links (Generally, event/relation annotations)
setTopLinkCategory(category)
Shows the specified category of top Links, hiding the others
Parameters:
Name | Type | Description |
---|---|---|
category |
getBottomLinkCategories()
Returns an Array of all the categories available for the bottom Links (Generally, syntactic/dependency parses)
setBottomLinkCategory(category)
Shows the specified category of bottom Links, hiding the others
Parameters:
Name | Type | Description |
---|---|---|
category |
getTagCategories()
Returns an Array of all the categories available for top Word tags (Generally, text-bound mentions)
setTopTagCategory(category)
Shows the specified category of top Word tags
Parameters:
Name | Type | Description |
---|---|---|
category |
setBottomTagCategory(category)
Shows the specified category of bottom Word tags
Parameters:
Name | Type | Description |
---|---|---|
category |
setTopMainLabelVisibility(visible)
Shows/hides the main label on top Links
Parameters:
Name | Type | Description |
---|---|---|
visible |
Boolean
|
Show if true, hide if false |
setTopArgLabelVisibility(visible)
Shows/hides the argument labels on top Links
Parameters:
Name | Type | Description |
---|---|---|
visible |
Boolean
|
Show if true, hide if false |
setBottomMainLabelVisibility(visible)
Shows/hides the main label on bottom Links
Parameters:
Name | Type | Description |
---|---|---|
visible |
Boolean
|
Show if true, hide if false |
setBottomArgLabelVisibility(visible)
Shows/hides the argument labels on bottom Links
Parameters:
Name | Type | Description |
---|---|---|
visible |
Boolean
|
Show if true, hide if false |