Skip to main content
weave / Dataset Dataset object with easy saving and automatic versioning Example
// Create a dataset
const dataset = new Dataset({
  id: 'grammar-dataset',
  rows: [
    { id: '0', sentence: "He no likes ice cream.", correction: "He doesn't like ice cream." },
    { id: '1', sentence: "She goed to the store.", correction: "She went to the store." },
    { id: '2', sentence: "They plays video games all day.", correction: "They play video games all day." }
  ]
})

// Access a specific example
const exampleLabel = dataset.getRow(2).sentence;

// Save the dataset
const ref = await dataset.save()

Type parameters

NameType
Rextends DatasetRow

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Dataset<R>(parameters): Dataset<R>

Type parameters

NameType
Rextends DatasetRow

Parameters

NameType
parametersDatasetParameters<R>

Returns

Dataset<R>

Overrides

WeaveObject.constructor

Defined in

dataset.ts:51

Properties

__savedRef

Optional __savedRef: ObjectRef | Promise<ObjectRef>

Inherited from

WeaveObject.__savedRef

Defined in

weaveObject.ts:49

rows

rows: Table<R>

Defined in

dataset.ts:49

Accessors

description

get description(): undefined | string

Returns

undefined | string

Inherited from

WeaveObject.description

Defined in

weaveObject.ts:76

length

get length(): number

Returns

number

Defined in

dataset.ts:64

name

get name(): string

Returns

string

Inherited from

WeaveObject.name

Defined in

weaveObject.ts:72

Methods

[asyncIterator]

[asyncIterator](): AsyncIterator<any, any, undefined>

Returns

AsyncIterator<any, any, undefined>

Defined in

dataset.ts:68

getRow

getRow(index): R

Parameters

NameType
indexnumber

Returns

R

Defined in

dataset.ts:74

save

save(): Promise<ObjectRef>

Returns

Promise<ObjectRef>

Defined in

dataset.ts:60

saveAttrs

saveAttrs(): Object

Returns

Object

Inherited from

WeaveObject.saveAttrs

Defined in

weaveObject.ts:53
I