API bindings for the Lilt REST API.
All URIs are relative to https://api.lilt.com
Method | HTTP request | Description |
---|---|---|
create_memory | POST /v2/memories | Create a Memory |
delete_memory | DELETE /v2/memories | Delete a Memory |
delete_segment_from_memory | DELETE /v2/memories/segment | Delete a segment from a memory. |
download_termbase | GET /v2/memories/termbase/download | Termbase download for a Memory |
export_termbase | POST /v2/memories/termbase/export | Termbase export for a Memory |
get_memory | GET /v2/memories | Retrieve a Memory |
import_memory_file | POST /v2/memories/import | File import for a Memory |
query_memory | GET /v2/memories/query | Query a Memory |
update_memory | PUT /v2/memories | Update the name of a Memory |
Memory create_memory(body)
Create a Memory
Create a new Memory. A Memory is a container that collects source/target sentences for a specific language pair (e.g., English>French). The data in the Memory is used to train the MT system, populate the TM, and update the lexicon. Memories are private to your account - the data is not shared across users - unless you explicitly share a Memory with your team (via web app only). <a href="https://support.lilt.com/hc/en-us/sections/360012579193-Lilt-Translate-Engine" target=_blank>Refer to our KB</a> for a more detailed description.
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) body = lilt.MemoryCreateParameters() # MemoryCreateParameters |
try:
# Create a Memory
api_response = api_instance.create_memory(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->create_memory: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) body = lilt.MemoryCreateParameters() # MemoryCreateParameters |
try:
# Create a Memory
api_response = api_instance.create_memory(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->create_memory: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
body | MemoryCreateParameters |
| Status code | Description | Response headers | |————-|————-|——————| 200 | A Memory object. | - | 401 | Unauthorized | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
MemoryDeleteResponse delete_memory(id)
Delete a Memory
Delete a Memory.
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier.
try:
# Delete a Memory
api_response = api_instance.delete_memory(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->delete_memory: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier.
try:
# Delete a Memory
api_response = api_instance.delete_memory(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->delete_memory: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
id | int | A unique Memory identifier. |
| Status code | Description | Response headers | |————-|————-|——————| 200 | A status object. | - | 401 | Unauthorized | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeleteSegmentFromMemoryResponse delete_segment_from_memory(id, segment_id)
Delete a segment from a memory.
Delete a segment from a memory. bash curl -X DELETE https://api.lilt.com/v2/memories/segment?key=API_KEY&id=ID&segment_id=$SEGMENT_ID
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier. segment_id = 56 # int | A unique Segment identifier.
try:
# Delete a segment from a memory.
api_response = api_instance.delete_segment_from_memory(id, segment_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->delete_segment_from_memory: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier. segment_id = 56 # int | A unique Segment identifier.
try:
# Delete a segment from a memory.
api_response = api_instance.delete_segment_from_memory(id, segment_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->delete_segment_from_memory: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
id | int | A unique Memory identifier. | |
segment_id | int | A unique Segment identifier. |
DeleteSegmentFromMemoryResponse
| Status code | Description | Response headers | |————-|————-|——————| 200 | A success resposne. | - | 401 | Unauthorized | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
str download_termbase(id)
Termbase download for a Memory
Downloads the termbase export for the given memory as a CSV file. Ensure you first call the /2/memories/termbase/export
endpoint to start the export process before you try to download it. bash curl -X GET https://api.lilt.com/v2/memories/termbase/download?key=API_KEY&id=ID
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier.
try:
# Termbase download for a Memory
api_response = api_instance.download_termbase(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->download_termbase: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier.
try:
# Termbase download for a Memory
api_response = api_instance.download_termbase(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->download_termbase: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
id | int | A unique Memory identifier. |
str
| Status code | Description | Response headers | |————-|————-|——————| 200 | A file. | - | 401 | Unauthorized | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TermbaseExportResponse export_termbase(id)
Termbase export for a Memory
Exports the termbase entries for the given memory into a CSV file. Calling this endpoint will begin the export process in the background. Check that the processing is complete by polling the GET /2/memories
endpoint. When the is_processing
value is 0 then call the POST /2/memories/termbase/download
endpoint. bash curl -X POST https://api.lilt.com/v2/memories/termbase/export?key=API_KEY&id=ID
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier.
try:
# Termbase export for a Memory
api_response = api_instance.export_termbase(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->export_termbase: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier.
try:
# Termbase export for a Memory
api_response = api_instance.export_termbase(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->export_termbase: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
id | int | A unique Memory identifier. |
| Status code | Description | Response headers | |————-|————-|——————| 200 | A status object. | - | 401 | Unauthorized | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[Memory] get_memory(id=id)
Retrieve a Memory
Retrieve a Memory. If you cannot access the Memory (401 error) please check permissions (e.g. in case you created the Memory via the web app with a different account you may have to explicitly share that Memory).
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | An optional Memory identifier. (optional)
try:
# Retrieve a Memory
api_response = api_instance.get_memory(id=id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->get_memory: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | An optional Memory identifier. (optional)
try:
# Retrieve a Memory
api_response = api_instance.get_memory(id=id)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->get_memory: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
id | int | An optional Memory identifier. | [optional] |
| Status code | Description | Response headers | |————-|————-|——————| 200 | A list of Memory objects. | - | 401 | Unauthorized | - | 404 | Memory not found. | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
MemoryImportResponse import_memory_file(memory_id, name, body, sdlxliff_filters=sdlxliff_filters, has_header_row=has_header_row, skip_duplicates=skip_duplicates)
File import for a Memory
Imports common translation memory or termbase file formats to a specific Lilt memory. Currently supported file formats are *.tmx
, *.sdltm
, *.sdlxliff
(With custom Filters), ‘*.xliff’, and *.tmq
for TM data; *.csv
and *.tbx
for termbase data. Request parameters should be passed as JSON object with the header field LILT-API
. Example CURL command to upload a translation memory file named my_memory.sdltm
in the current working directory: bash curl -X POST https://api.lilt.com/v2/memories/import?key=API_KEY \\ --header \"LILT-API: {\\\"name\\\": \\\"my_memory.sdltm\\\",\\\"memory_id\\\": 42}\" \\ --header \"Content-Type: application/octet-stream\" \\ --data-binary @my_memory.sdltm
Example CURL command to upload a translation memory file named my_memory.sdlxliff
in the current working directory, with Custom Filters based on SDLXLIFF fields, conf_name which maps to, percentage, and whether we should ignore unlocked segments. bash curl -X POST https://api.lilt.com/v2/memories/import?key=API_KEY \\ --header \"LILT-API: {\\\"name\\\": \\\"my_memory.sdlxliff\\\",\\\"memory_id\\\": 12,\\\"sdlxliff_filters\\\":[{\\\"conf_name\\\": \\\"Translated\\\", \\\"percentage\\\": 100, \\\"allow_unlocked\\\": false}]\"}\" \\ --header \"Content-Type: application/octet-stream\" \\ --data-binary @my_memory.sdlxliff
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client)
memory_id = 56 # int | A unique Memory identifier.
name = ‘name_example’ # str | Name of the TM or termbase file.
body = ‘/path/to/file’ # file | The file contents to be uploaded. The entire POST body will be treated as the file.
sdlxliff_filters = [lilt.SDLXLIFFFilter()] # list[SDLXLIFFFilter] | Contains Filter information Unique to SDLXLIFF (optional)
has_header_row = True # bool | A flag indicating whether an imported Termbase CSV has a header row or not (the default value is false
). (optional)
skip_duplicates = True # bool | A flag indicating whether or not to skip the import of segments which already exist in the memory. (the default value is false
). (optional)
try:
# File import for a Memory
api_response = api_instance.import_memory_file(memory_id, name, body, sdlxliff_filters=sdlxliff_filters, has_header_row=has_header_row, skip_duplicates=skip_duplicates)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->import_memory_file: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client)
memory_id = 56 # int | A unique Memory identifier.
name = ‘name_example’ # str | Name of the TM or termbase file.
body = ‘/path/to/file’ # file | The file contents to be uploaded. The entire POST body will be treated as the file.
sdlxliff_filters = [lilt.SDLXLIFFFilter()] # list[SDLXLIFFFilter] | Contains Filter information Unique to SDLXLIFF (optional)
has_header_row = True # bool | A flag indicating whether an imported Termbase CSV has a header row or not (the default value is false
). (optional)
skip_duplicates = True # bool | A flag indicating whether or not to skip the import of segments which already exist in the memory. (the default value is false
). (optional)
try:
# File import for a Memory
api_response = api_instance.import_memory_file(memory_id, name, body, sdlxliff_filters=sdlxliff_filters, has_header_row=has_header_row, skip_duplicates=skip_duplicates)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->import_memory_file: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
memory_id | int | A unique Memory identifier. | |
name | str | Name of the TM or termbase file. | |
body | file | The file contents to be uploaded. The entire POST body will be treated as the file. | |
sdlxliff_filters | list[SDLXLIFFFilter] | Contains Filter information Unique to SDLXLIFF | [optional] |
has_header_row | bool | A flag indicating whether an imported Termbase CSV has a header row or not (the default value is `false`). | [optional] |
skip_duplicates | bool | A flag indicating whether or not to skip the import of segments which already exist in the memory. (the default value is `false`). | [optional] |
| Status code | Description | Response headers | |————-|————-|——————| 200 | A status object. | - | 401 | Unauthorized | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[TranslationMemoryEntry] query_memory(id, query, n=n)
Query a Memory
Perform a translation memory query.
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier. query = ‘query_example’ # str | A source query. n = 10 # int | Maximum number of results to return. (optional) (default to 10)
try:
# Query a Memory
api_response = api_instance.query_memory(id, query, n=n)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->query_memory: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) id = 56 # int | A unique Memory identifier. query = ‘query_example’ # str | A source query. n = 10 # int | Maximum number of results to return. (optional) (default to 10)
try:
# Query a Memory
api_response = api_instance.query_memory(id, query, n=n)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->query_memory: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
id | int | A unique Memory identifier. | |
query | str | A source query. | |
n | int | Maximum number of results to return. | [optional] [default to 10] |
| Status code | Description | Response headers | |————-|————-|——————| 200 | A list of TranslationMemoryEntry objects. | - | 401 | Unauthorized | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Memory update_memory(body)
Update the name of a Memory
Update a Memory.
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) body = lilt.MemoryUpdateParameters() # MemoryUpdateParameters |
try:
# Update the name of a Memory
api_response = api_instance.update_memory(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->update_memory: %s\n" % e) ```
configuration = lilt.Configuration( host = “https://api.lilt.com” )
configuration = lilt.Configuration( host = “https://api.lilt.com”, 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.MemoriesApi(api_client) body = lilt.MemoryUpdateParameters() # MemoryUpdateParameters |
try:
# Update the name of a Memory
api_response = api_instance.update_memory(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling MemoriesApi->update_memory: %s\n" % e) ```
Name | Type | Description | Notes |
---|---|---|---|
body | MemoryUpdateParameters |
| Status code | Description | Response headers | |————-|————-|——————| 200 | A Memory object. | - | 401 | Unauthorized | - | 0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]