communications-mining
latest
false
Communications Mining Developer Guide
Last updated Nov 7, 2024

Batch download

The CLI allows you to download comments and predictions in batch. This is most useful to script import into analytics tools that don't require a live connection.

Note: This section assumes you have already installed and configured the CLI.

Downloading comments with predictions

The command below will download all the comments and predictions in the specified source and dataset. Note that the dataset name and source name have to be prefixed by the name of the project they are in. If the dataset contains multiple sources, you need to issue this command for every source to download all comments in the dataset.

re get comments project/source-name --dataset project/dataset-name --predictions=true -f output.jsonlre get comments project/source-name --dataset project/dataset-name --predictions=true -f output.jsonl

Which model version does the CLI use to get predictions?

The CLI will download the latest available computed predictions. These are the same predictions shown in the UI.

Important: CAN I PASS A SPECIFIC MODEL VERSION TO THE CLI?

If you need predictions from a specific model version, consider using the or the predict API routes.

Processing Data

Note: Same as the API, the CLI returns predicted labels with confidence scores. In order to correctly process the confidence scores, be sure to check the Using Labels in Automation and Using Labels in Analytics sections of the Labels documentation.

The CLI returns data in JSONL format (also called newline-delimited JSON), where each line is a JSON value. Many tools will be able to process JSONL files out-of-the-box. Please contact support if you have any questions.

Each line in the JSONL file will have the following format:

{
  "comment": {...},
  "annotating": {
    "assigned": [...]
    "predicted": [...]
  },
  "entities": {
    "assigned": [...]
    "predicted": [...]
  }
}{
  "comment": {...},
  "annotating": {
    "assigned": [...]
    "predicted": [...]
  },
  "entities": {
    "assigned": [...]
    "predicted": [...]
  }
}
FIELD NAMEDESCRIPTION
commentComment object in the format described here.
annotating.assignedList of assigned labels, in the format described here.
entities.assignedList of assigned entities, in the format described here.
annotating.predictedList of predicted labels, in the format described here.
entities.predictedList of predicted entities, in the format described here.
Note that the annotating or entities field may be absent completely if the comment has neither assigned nor predicted labels or entities.

Below is an example comment with predictions downloaded from a real-life dataset.

{
  "comment": {
    "id": "1234abcd",
    "uid": "5678ef.1234abdc",
    "timestamp": "2021-02-01T00:00:00Z",
    "messages": [
      {
        "body": {
          "text": "The hot chocolate biscuit on arrival raised my expectations"
        }
      }
    ],
    "user_properties": {
      "string:Question": "What did you like about your stay",
      "number:Reviewer Score": 5.4,
      "number:Average Score": 8.4,
      "number:Reviewer Total Number Of Reviews": 1,
      "string:Hotel Name": "DoubleTree by Hilton London Victoria"
    },
    "created_at": "2021-02-01T00:00:00Z"
  },
  "annotating": {
    "predicted": [
      {
        "name": "Refreshments",
        "sentiment": 0.3598046874571062,
        "probability": 0.54764723591506481
      },
      {
        "name": "Property",
        "sentiment": 0.6684685489411859,
        "probability": 0.417815982922911644
      }
    ]
  }
}{
  "comment": {
    "id": "1234abcd",
    "uid": "5678ef.1234abdc",
    "timestamp": "2021-02-01T00:00:00Z",
    "messages": [
      {
        "body": {
          "text": "The hot chocolate biscuit on arrival raised my expectations"
        }
      }
    ],
    "user_properties": {
      "string:Question": "What did you like about your stay",
      "number:Reviewer Score": 5.4,
      "number:Average Score": 8.4,
      "number:Reviewer Total Number Of Reviews": 1,
      "string:Hotel Name": "DoubleTree by Hilton London Victoria"
    },
    "created_at": "2021-02-01T00:00:00Z"
  },
  "annotating": {
    "predicted": [
      {
        "name": "Refreshments",
        "sentiment": 0.3598046874571062,
        "probability": 0.54764723591506481
      },
      {
        "name": "Property",
        "sentiment": 0.6684685489411859,
        "probability": 0.417815982922911644
      }
    ]
  }
}
  • Downloading comments with predictions
  • Processing Data

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.