Skip to content

Latest commit

 

History

History
346 lines (234 loc) · 10.2 KB

SegmentsApi.md

File metadata and controls

346 lines (234 loc) · 10.2 KB

LiltNode.SegmentsApi

All URIs are relative to https://lilt.com/2

Method HTTP request Description
createSegment POST /segments Create a Segment
deleteSegment DELETE /segments Delete a Segment
getSegment GET /segments Retrieve a Segment
tagSegment GET /segments/tag Tag a Segment
unlockSegments POST /segments/review/unlock Unaccept and unlock segments
updateSegment PUT /segments Update a Segment

createSegment

Segment createSegment(body)

Create a Segment

Create a Segment and add it to a Memory. A Segment is a source/target pair that is used to train the machine translation system and populate the translation memory. This is not intended to be used on documents and will throw an error. The maximum source length is 5,000 characters.

Example

import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';

let apiInstance = new LiltNode.SegmentsApi();
let body = new LiltNode.SegmentCreateParameters(); // SegmentCreateParameters | 
apiInstance.createSegment(body).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
body SegmentCreateParameters

Return type

Segment

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteSegment

SegmentDeleteResponse deleteSegment(id)

Delete a Segment

Delete a Segment from memory. This will not delete a segment from a document.

Example

import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';

let apiInstance = new LiltNode.SegmentsApi();
let id = 56; // Number | A unique Segment identifier.
apiInstance.deleteSegment(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number A unique Segment identifier.

Return type

SegmentDeleteResponse

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getSegment

SegmentWithComments getSegment(id, opts)

Retrieve a Segment

Retrieve a Segment.

Example

import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';

let apiInstance = new LiltNode.SegmentsApi();
let id = 56; // Number | A unique Segment identifier.
let opts = {
  'includeComments': false // Boolean | Include comments in the response.
};
apiInstance.getSegment(id, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number A unique Segment identifier.
includeComments Boolean Include comments in the response. [optional] [default to false]

Return type

SegmentWithComments

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

tagSegment

TaggedSegment tagSegment(sourceTagged, target, memoryId)

Tag a Segment

Project tags for a segment. The `source_tagged` string contains one or more SGML tags. The `target` string is untagged. This endpoint will automatically place the source tags in the target. Usage charges apply to this endpoint for production REST API keys.

Example

import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';

let apiInstance = new LiltNode.SegmentsApi();
let sourceTagged = "sourceTagged_example"; // String | The tagged source string.
let target = "target_example"; // String | The target string.
let memoryId = 56; // Number | A unique Memory identifier.
apiInstance.tagSegment(sourceTagged, target, memoryId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
sourceTagged String The tagged source string.
target String The target string.
memoryId Number A unique Memory identifier.

Return type

TaggedSegment

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

unlockSegments

[Number] unlockSegments(body)

Unaccept and unlock segments

Unaccept and unlock segments. Sets individual segments' "Review Done" to false. Confirmed segments will remain confirmed. Example curl: ``` curl --X --request POST 'https://lilt.com/2/segments/review/unlock?key=API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{ "segmentIds": [23921, 23922] }' ```

Example

import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';

let apiInstance = new LiltNode.SegmentsApi();
let body = new LiltNode.SegmentDoneResponse(); // SegmentDoneResponse | 
apiInstance.unlockSegments(body).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
body SegmentDoneResponse

Return type

[Number]

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateSegment

Segment updateSegment(body)

Update a Segment

Update a Segment in memory. The Memory will be updated with the new target string.

Example

import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';

let apiInstance = new LiltNode.SegmentsApi();
let body = new LiltNode.SegmentUpdateParameters(); // SegmentUpdateParameters | 
apiInstance.updateSegment(body).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
body SegmentUpdateParameters

Return type

Segment

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json