Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure Translator in Foundry Tools containers allow you to use many of the Translator's features within your own environment, making them ideal for meeting specific security and data governance needs.
Sometimes, when operating a container with a complex ingestion process, you may encounter the need to update sentence or phrase files. Because the default sentence and phrase files are encrypted and loaded directly into memory at runtime, you need a rapid engineering solution to allow for dynamic updates. You can address this need by implementing our user-managed glossary feature:
To deploy the phrasefix solution, you need to create a phrasefix glossary file to specify that a listed phrase is translated in a specified way.
To deploy the sentfix solution, you need to create a sentfix glossary file to specify an exact target translation for a source sentence.
The phrasefix and sentfix files are then included with your translation request and read directly into memory at runtime.
Managed glossary workflow
Important
UTF-16 LE is the only accepted file format for the managed-glossary folders. For more information about encoding your files, see Encoding
To get started manually creating the folder structure, you need to create and name your folder. The managed-glossary folder is encoded in UTF-16 LE BOM format and nests phrasefix or sentfix source and target language files. Let's name our folder
customhotfix. Each folder can have phrasefix and sentfix files. You provide the source (src) and target (tgt) language codes with the following naming convention:Glossary file name format Example file name { src}.{tgt}.{container-glossary}.{phrasefix}.src.snten.es.container-glossary.phrasefix.src.snt { src}.{tgt}.{container-glossary}.{phrasefix}.tgt.snten.es.container-glossary.phrasefix.tgt.snt { src}.{tgt}.{container-glossary}.{sentfix}.src.snten.es.container-glossary.sentfix.src.snt { src}.{tgt}.{container-glossary}.{sentfix}.tgt.snten.es.container-glossary.sentfix.tgt.snt Note
- The phrasefix solution is an exact find-and-replace operation. Any word or phrase listed is translated in the way specified.
- The sentfix solution is more precise and allows you to specify an exact target translation for a source sentence. For a sentence match to occur, the entire submitted sentence must match the sentfix entry. If only a portion of the sentence matches, the entry doesn't match.
- If you're hesitant about making sweeping find-and-replace changes, we recommend, at the outset, solely using the sentfix solution.
Next, to dynamically reload glossary entry updates, create a
version.jsonfile within thecustomhotfixfolder. Theversion.jsonfile should contain the following parameters: VersionId. An integer value.Sample version.json file
{ "VersionId": 5 }Tip
Reload can be controlled by setting the following environmental variables when starting the container:
- HotfixReloadInterval=. Default value is 5 minutes.
- HotfixReloadEnabled=. Default value is true.
Use the docker run command
Docker run command required options
docker run --rm -it -p 5000:5000 \ -e eula=accept \ -e billing={ENDPOINT_URI} \ -e apikey={API_KEY} \ -e Languages={LANGUAGES_LIST} \ -e HotfixDataFolder={path to glossary folder} {image}Example docker run command
docker run -rm -it -p 5000:5000 \ -v /mnt/d/models:/usr/local/models -v /mnt/d /customerhotfix:/usr/local/customhotfix \ -e EULA=accept \ -e billing={ENDPOINT_URI} \ -e apikey={API_Key} \ -e Languages=en,es \ -e HotfixDataFolder=/usr/local/customhotfix\ mcr.microsoft.com/azure-cognitive-services/translator/text-translation:latest