Documents

This page documents the Document type: this is an abstract base class for all files in a project that can be stored on disk and represented by a path. Subclasses include Annotation, Sound, Dataset, Concordance and Script.

Functions

class Document
load(path as String)

Imports the file at path into the current project (if not already present) and returns it as a Document. The returned object can be used as an Annotation, Sound, Dataset, etc. depending on the file type.

Example:

let ds = load("my_data.csv")
print ds.nrow

add_property(file as Document, category as String, value as Object)

Adds a property to the document. category must be a string and value can be a string, a number or a Boolean. If the file already has a property with the same category, the value will be replaced with the new one.


remove_property(file as Document, category as String)

Removes the property whose category is category from the document. If there is no such category, this method does nothing.


get_property(file as Document, category as String)

Gets the value of the property whose category is category from the document, or null if there is no such category.

Fields

path

Returns the path of the file.

label

Returns the label of the file.