lilt-python

API bindings for the Lilt REST API.

View the Project on GitHub lilt/lilt-python

lilt.SegmentsApi

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

Method HTTP request Description
create_segment POST /segments Create a Segment
delete_segment DELETE /segments Delete a Segment
get_segment GET /segments Retrieve a Segment
tag_segment GET /segments/tag Tag a Segment
unlock_segments POST /segments/review/unlock Unaccept and unlock segments
update_segment PUT /segments Update a Segment

create_segment

Segment create_segment(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

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) body = lilt.SegmentCreateParameters() # SegmentCreateParameters |

try:
    # Create a Segment
    api_response = api_instance.create_segment(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->create_segment: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) body = lilt.SegmentCreateParameters() # SegmentCreateParameters |

try:
    # Create a Segment
    api_response = api_instance.create_segment(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->create_segment: %s\n" % e) ```

Parameters

Name Type Description Notes
body SegmentCreateParameters    

Return type

Segment

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 200 | A Segment object. | - | 0 | Unexpected error | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_segment

SegmentDeleteResponse delete_segment(id)

Delete a Segment

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

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) id = 56 # int | A unique Segment identifier.

try:
    # Delete a Segment
    api_response = api_instance.delete_segment(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->delete_segment: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) id = 56 # int | A unique Segment identifier.

try:
    # Delete a Segment
    api_response = api_instance.delete_segment(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->delete_segment: %s\n" % e) ```

Parameters

Name Type Description Notes
id int A unique Segment identifier.  

Return type

SegmentDeleteResponse

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 200 | A status object. | - | 0 | Unexpected error | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_segment

SegmentWithComments get_segment(id, include_comments=include_comments)

Retrieve a Segment

Retrieve a Segment.

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) id = 56 # int | A unique Segment identifier. include_comments = False # bool | Include comments in the response. (optional) (default to False)

try:
    # Retrieve a Segment
    api_response = api_instance.get_segment(id, include_comments=include_comments)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->get_segment: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) id = 56 # int | A unique Segment identifier. include_comments = False # bool | Include comments in the response. (optional) (default to False)

try:
    # Retrieve a Segment
    api_response = api_instance.get_segment(id, include_comments=include_comments)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->get_segment: %s\n" % e) ```

Parameters

Name Type Description Notes
id int A unique Segment identifier.  
include_comments bool Include comments in the response. [optional] [default to False]

Return type

SegmentWithComments

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 200 | A Segment object. | - | 0 | Unexpected error | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

tag_segment

TaggedSegment tag_segment(source_tagged, target, memory_id)

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

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) source_tagged = ‘source_tagged_example’ # str | The tagged source string. target = ‘target_example’ # str | The target string. memory_id = 56 # int | A unique Memory identifier.

try:
    # Tag a Segment
    api_response = api_instance.tag_segment(source_tagged, target, memory_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->tag_segment: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) source_tagged = ‘source_tagged_example’ # str | The tagged source string. target = ‘target_example’ # str | The target string. memory_id = 56 # int | A unique Memory identifier.

try:
    # Tag a Segment
    api_response = api_instance.tag_segment(source_tagged, target, memory_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->tag_segment: %s\n" % e) ```

Parameters

Name Type Description Notes
source_tagged str The tagged source string.  
target str The target string.  
memory_id int A unique Memory identifier.  

Return type

TaggedSegment

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 200 | A TaggedSegment object. | - | 0 | Unexpected error | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

unlock_segments

list[float] unlock_segments(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

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) body = lilt.SegmentDoneResponse() # SegmentDoneResponse |

try:
    # Unaccept and unlock segments
    api_response = api_instance.unlock_segments(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->unlock_segments: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) body = lilt.SegmentDoneResponse() # SegmentDoneResponse |

try:
    # Unaccept and unlock segments
    api_response = api_instance.unlock_segments(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->unlock_segments: %s\n" % e) ```

Parameters

Name Type Description Notes
body SegmentDoneResponse    

Return type

list[float]

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 200 | array of updated segments | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_segment

Segment update_segment(body)

Update a Segment

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

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) body = lilt.SegmentUpdateParameters() # SegmentUpdateParameters |

try:
    # Update a Segment
    api_response = api_instance.update_segment(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->update_segment: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.SegmentsApi(api_client) body = lilt.SegmentUpdateParameters() # SegmentUpdateParameters |

try:
    # Update a Segment
    api_response = api_instance.update_segment(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SegmentsApi->update_segment: %s\n" % e) ```

Parameters

Name Type Description Notes
body SegmentUpdateParameters    

Return type

Segment

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 200 | A Segment object. | - | 0 | Unexpected error | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]