Samples of usage are located in the samples/api/ subdirectory.
A full test suite is located in the test/ subdirectory. You can run it by calling jasmine-node test/* from the main folder.
| Name | Description |
|---|---|
| listCollections | Lists all collections |
| createCollection | Creates a new collection |
| deleteCollection | Deletes an existing collection |
| createDocuments | Uploads a set of documents to a collection |
| fetchDocuments | Fetches multiple documents from a collection |
| deleteDocument | Deletes a document from a collection |
| createTask | Create a new task to start assigning labels |
| addTaskLabels | Add label possibilities to an existing task |
| createAnnotation | Add an annotation for a task to a document |
| createClassification | Generate predictions for unstored text |
This application lists all collections that are available using your API key. To Use:
cd samples/api
node listCollections.js $API_KEY
This application creates a brand new collection. To Use:
cd samples/api
node createCollection.js $API_KEY $COLLECTION $DESCRIPTION
-
$COLLECTIONshould be a String specifying the new collection's name. -
$DESCRIPTIONshould be a String, and contain a description of the new collection.
This application deletes an existing collection. To avoid accidental bulk deletes, the collection must be empty of all documents before it can be deleted. The collection is assumed to exist. To Use:
cd samples/api
node deleteCollection.js $API_KEY $COLLECTION
$COLLECTIONshould be a String specifying the doomed collection's name.
This application adds a set of new documents to a currently existing collection. It is assumed that the collection already exists. To Use:
cd samples/api
node createDocument.js $API_KEY $COLLECTION $UPLOAD_FILE
-
$COLLECTIONshould be a String specifying the name of the relevant collection. -
$UPLOAD FILEshould be a String specifying the file containing the documents to be uploaded. New lines should separate each individual document. Each line can specify thename, thecontent, and themetadata. The name is optional, if it's not provided then the API will assign an internally-generated name:
{"name": "Document name1", "content": "Document content1", "metadata": { ... } }
{"name": "Document name2", "content": "Document content2", "metadata": { ... } }
{"name": "Document name3", "content": "Document content3", "metadata": { ... } }
...
This application fetches all documents from an existing collection. To Use:
cd samples/api
node fetchDocuments.js $API_KEY $COLLECTION $TASK
-
$COLLECTIONshould be a String specifying the collection. Only documents that are a part of this collection will be returned. -
$TASKshould be a String specifying the task. Only documents associated with this task will be returned.
This application deletes a single document from a collection. To Use:
cd samples/api
node deleteDocument.js $API_KEY $COLLECTION $DOC_NAME
-
$COLLECTIONshould be a String specifying the name of the relevant collection. -
$DOC_NAMEshould be a String specifying the documents name.
This application creates a new task within a currently existing collection. The collection must already exist. To Use:
cd samples/api
node createTask.js $API_KEY $COLLECTION $TASK_NAME $DESCRIPTION $SCOPE
-
$COLLECTIONshould be a String specifying the name of the relevant collection. -
$TASK_NAMEshould be a String naming the task. -
$DESCRIPTIONshould be a String and should be a description of the task.
This application adds a possible label to an existing task. Both the relevant collection and the relevant task must already exist. To Use:
cd samples/api
node addTaskLabels.js $API_KEY $COLLECTION $TASK $LABEL_NAME $LABEL_DESCRIPTION
-
$COLLECTIONshould be a String specifying the name of the relevant collection. -
$TASKshould be a String naming the task that will contain this label. -
$LABEL_NAMEshould be a String specifying the name of the new label. -
$LABEL_DESCRIPTIONshould be a String containing the description of the new label.
This application adds an annotation to an existing document. The document and relevant collection must already exist. To Use:
cd samples/api
node createAnnotation.js $API_KEY $COLLECTION $DOCUMENT $TASK $LABEL
-
$COLLECTIONshould be a String specifying the name of the relevant collection. -
$DOCUMENTshould be a String specifying the document to which the annotation will be attached. -
$TASKshould be a String naming the task that will contain this annotation. -
$LABELshould be a String and should specify the label of the annotation.
Generates a classification for a document. This requires that the relevant task has a trained model associated with it. The task, collection, and document are assumed to exist. To Use:
cd samples/api
node createClassification.js $API_KEY $COLLECTION $TASK $DOCUMENT
-
$COLLECTIONshould be a String specifying the name of the relevant collection. -
$TASKshould be a String specifying the task used to generate the classification. -
$DOCUMENTshould be a String specifying the document on which the classification will be made.