Skip to main content

resources/segments/textedits

To obtain a report on text edits in all or selected languages as well as word counts adjusted by the amount of editing.

See the information that a report contains here: Text edits report

URL

(POST) /resources/segments/textedits

PARAMETERS

The message body contains a JSON object:

scope

The scope of segments. See Scope (Object).

NOTE: This method supports these scopes only: Project, Job or DocumentSet.  

Example:

CODE
"scope": { "type": "Project", "projectid": 3343 }
object, Mandatory
query

An optional query object. To filter the segments of the scope.  Example for drilling down on a single document:

CODE
{ "documents": [{ "did": 9800 }] }}
object?, Optional
groupby

Optional, default is Global.

Internally the system calculates text edits segment by segment. Instead of returning information on every single edit (which may be a lot), the individual data is grouped, i.e. aggregated. For example, with ByUser, one gets the total edits by user over the specified scope and query.

  • Global: Aggregates all edits into a single row
  • ByUser: Returns one row per editing user
  • ByLocale: Returns one row by source/target language couple
  • ByUserAndLocale: Returns one row per user and language couple
  • ByUserAndLocaleAndEditor: Returns one row per user, language couple and last editor
  • ByDocumentAndLocale: Returns one row per document and language couple
  • ByDocumentAndLocaleAndUser: Returns one row per document, language couple and user


string?, Optional
aggregationMode

Optional. default is SingleActionPerUser.

  • SingleActionPerUser: Recommended option. With each source text change, a specific user typically makes a single edit (to write or post edit the translation). If the translation is revised by a different user, the user may again do some further edits. With this mode, we will calculate s single edit per source text change and per user.
  • AllActionsPerUser: Every single user's edit is counted. See description above. 


string?, Optional
dateFrom

Optional. Count edits at or after this date only.

If set, then we only considers edits done at or after this date. This property is useful to calculate edits for periods of time, such as for a full month. This can be used for customized costing of work by user.

datetime?, Optional
dateTo

Optional. Count edits before this date only.

If set, then we only considers edits done before this date. 

datetime?, Optional
srcDefault

Optional. Usage depends on the scope:

  • With Project and Job scopes this parameter is disregarded. The system perfectly knows the source language of each segment.

With other resources, you may want to override a default selection:

  • With DocumentSet scope, the system uses this locale if specified or otherwise chooses the first source language configured in the resource.


string?, Optional
trgsOptional list of target locales for which to calculate edits. If not specified then edits are calculated for ALL locales of the scope. string[]?, Optional


RESULTS

Await creation of text edits report

This API method executes asynchronously.

  • It immediately returns a reference for the operation in trm.requestid, and an operation status in trm.status.
  • As long as the status is not Finished or Failed, you need to poll the system with the trm.requestid value. See Asynchronous operation for how to do this.
  • Ultimately upon completion the operation status includes the custom.filetoken value which lets you download the JSON result:
CODE
{
    "trm": {
		"requestid": 559,
        "status": "Finished",
		...
    },
    "custom": {
        "filetoken": "026171df25c641d0b04316a28cf3cca1"
    }
}


When the operation has terminated, download the JSON report with the filetoken and this API method:

CODE
(GET) /api/media/get/{filetoken}


Report content

The report is a JSON document, see: Text edits report


EXAMPLES

Submit request

We submit this request:

CODE
POST /api/resources/segments/textedits
BODY:
{
	"scope": { "type": "Project", "projectid": 3502 },
	"groupby" : "ByUserAndLocale"
}

Await completion of operation

We get the operation status and poll it until it is finished:

CODE
{
    "trm": {
        "requestid": 22230,
        "status": "Finished",
    },
    "custom": {
        "filetoken": "158a4bee38a943d6a2aff09859e165be"
    }
}

Until the status is not Finished or Failed, you need to poll with a second or more in between calls until operation is finished:

CODE
GET /api/trm/status?requestid=22230

Get report

We download the file token:

CODE
GET /api/media/get/158a4bee38a943d6a2aff09859e165be

And obtain the report:

CODE
{
    "counts": [
        {
            "texts": 2,
            "edits": 9,
            "editDistance": 0.34,
            "editDistanceSum": 91,
            "editDistanceSumLengths": 266,
            "editDistanceSumNormalized": 3.25,
            "words": 12.03,
            "chars": 67.10,
            "wordsTarget": 12.03,
            "charsTarget": 67.10,
            "dateMin": "2020-03-26T10:22:12.8457033Z",
            "dateMax": "2020-04-04T14:30:50.2094891Z",
            "did": 10358,
            "src": "en",
            "trg": "en",
            "uid": 505
        },
        {
            "texts": 2,
            "edits": 2,
            "editDistance": 1.0,
            "editDistanceSum": 6,
            "editDistanceSumLengths": 6,
            "editDistanceSumNormalized": 2.0,
            "words": 10.0,
            "chars": 51.0,
            "wordsTarget": 2.0,
            "charsTarget": 6.0,
            "dateMin": "2020-04-16T09:00:28.6727929Z",
            "dateMax": "2020-04-16T09:00:28.6727929Z",
            "did": 10358,
            "src": "en",
            "trg": "es",
            "uid": 505
        }
    ],
    "locales": {
        "en": "English",
        "es": "Spanish"
    },
    "users": {
        "505": {
            "uid": 505,
            "uname": "Stephan",
            "cid": 537,
            "cname": "team"
        }
    },
    "documents": {
        "10358": {
            "did": 10358,
            "dname": "WM-4458.wbflex",
            "src": "en",
            "dsid": 4163,
            "dsname": "WM-4458"
        }
    },
    "parameters": {
        "groupby": "ByDocumentAndLocaleAndUser",
        "dateFrom": null,
        "dateTo": null,
        "aggregationMode": "SingleActionPerUser",
        "src": null,
        "trgs": null
    }
}






JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.