Dataset
weave • Docs
weave / Dataset
Class: Dataset<R>
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()
Extends
Type Parameters
• R extends DatasetRow
Constructors
new Dataset()
new Dataset<
R
>(parameters
):Dataset
<R
>
Parameters
• parameters: DatasetParameters
<R
>
Returns
Dataset
<R
>
Overrides
Defined in
Properties
__savedRef?
optional
__savedRef:ObjectRef
|Promise
<ObjectRef
>
Inherited from
Defined in
_baseParameters
protected
_baseParameters:WeaveObjectParameters
Inherited from
Defined in
rows
rows:
Table
<R
>
Defined in
Accessors
description
get
description():undefined
|string
Returns
undefined
| string
Inherited from
Defined in
id
get
id():string
Returns
string
Inherited from
Defined in
length
get
length():number
Returns
number
Defined in
Methods
[asyncIterator]()
[asyncIterator]():
AsyncIterator
<any
,any
,undefined
>
Returns
AsyncIterator
<any
, any
, undefined
>
Defined in
className()
className():
any
Returns
any
Inherited from
Defined in
getRow()
getRow(
index
):R
Parameters
• index: number
Returns
R
Defined in
save()
save():
Promise
<ObjectRef
>
Returns
Promise
<ObjectRef
>
Defined in
saveAttrs()
saveAttrs():
object
Returns
object