API bindings for the Lilt REST API.
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 |
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.
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
Name | Type | Description | Notes |
---|---|---|---|
body | SegmentCreateParameters |
| 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]
SegmentDeleteResponse delete_segment(id)
Delete a Segment
Delete a Segment from memory. This will not delete a segment from a document.
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
Name | Type | Description | Notes |
---|---|---|---|
id | int | A unique Segment identifier. |
| 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]
SegmentWithComments get_segment(id, include_comments=include_comments)
Retrieve a Segment
Retrieve a Segment.
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
Name | Type | Description | Notes |
---|---|---|---|
id | int | A unique Segment identifier. | |
include_comments | bool | Include comments in the response. | [optional] [default to False] |
| 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]
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.
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
Name | Type | Description | Notes |
---|---|---|---|
source_tagged | str | The tagged source string. | |
target | str | The target string. | |
memory_id | int | A unique Memory identifier. |
| 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]
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] }'
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
Name | Type | Description | Notes |
---|---|---|---|
body | SegmentDoneResponse |
list[float]
| Status code | Description | Response headers | |————-|————-|——————| 200 | array of updated segments | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Segment update_segment(body)
Update a Segment
Update a Segment in memory. The Memory will be updated with the new target string.
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
configuration = lilt.Configuration( host = “https://lilt.com/2” )
configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )
configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )
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) ```
Name | Type | Description | Notes |
---|---|---|---|
body | SegmentUpdateParameters |
| 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]