Edit auto-translation rule set
An auto-translation rule set is a collection of algorithmic rules that help to transform parts of text into the target language. For example, you can use them to convert dates, currencies, or other units from the source language to the target language. It can even calculate unit conversions. Auto-translation rules use regular expressions to recognize the patterns they have to convert.
If you have an auto-translation rule set in your project: memoQ always checks the current segment for patterns that the auto-translation rules can recognize. If patterns are found, the converted patterns are there on the Translation results list. You can click to copy these to the translation in the translation editor.
memoQ checks auto-translation rule sets: You may get quality (QA) warnings if an auto-translation pattern is recognized, but the converted pattern is missing from the translation.
In this window, you can edit an existing auto-translation rule set.
How to get here
Open the Resource Console. Choose Auto-translation rules. Click an auto-translation rule set. Under the list, click Edit.
From a project: Open a project. In Project home, choose Settings. In the Settings pane, click the Auto-translation rules icon. (This icon has a green number 5 in it.) On the list, click an auto-translation rule set. Under the list, click Edit.
From an online project: Open an online project for management. In the memoQ online project window, choose Settings. In the Settings pane, click the Auto-translation rules icon. (This icon has a green number 5 in it.) On the list, click an auto-translation rule set. Under the list, click Edit.
What can you do?
On the Auto-translation rules tab, you can write regular expressions. memoQ uses them to scan the source text for expressions that match the regular expressions. Usually, these expressions are numbers, dates, or currencies, but they can be anything else, even variable text parts.
To learn more about regular expressions: See the topic about them.
To write up the expressions that memoQ should recognize, use the Auto-translation rules list on the left.
- To write a new rule: In the box at the bottom, type the regular expression. Click Add.
- To change an existing rule: Click the rule in the list. The regular expression appears in the box at the bottom. Make changes. Click Change.
- To delete an existing rule: Click the rule in the list. Click Delete.
Next step: Tell memoQ how to replace the expressions that the rules recognize.
On the Auto-translation rules tab, use the Replace order rules list for this (on the right).
Click an auto-translation rule on the left. On the right, exactly one rule appears. This corresponds to the auto-translation rule. For each auto-translation rule, you must write up one replace-order rule.
Together, an auto-translation rule and a replace-order rule form a very advanced "search-for" and "replace-with" pair.
A replace-order rule is about replacing variable (previously unknown) parts of the expression memoQ found:
When you auto-translate something, you don't know exactly what it will be. This is why you write up a regular expression: a single regular expression can match thousands of different character sequences. For example, [0-9]+ matches a number, or more precisely, a sequence of digits, no matter how long.
If you need to repeat this in the replace-order rule, first put it in parentheses on the left side: ([0-9]+). These are the variable groups. In the replace-order rule, you can refer to these by their number: to insert the first group, write $1, to insert the second, write $2, and so on.
To learn more: See the topic about regular expressions. Look for the Replacing and reordering section.
- To write the replace-order rule for the selected auto-translation rule: In the box at the bottom right, type the replace-order rule. This is not a regular expression. But it can contain placeholders for variable groups. Example: Page $1. Click Add. You can do this only once. If there is already a replace-order rule, you can't add another one.
- To change the existing replace-order rule: In the box at the bottom right, make changes to the replace-order rule. Click Change.
- To delete the existing replace-order rule: Click Delete.
You must write one replace-order rule for each auto-translation rule: You can't save changes from the Edit auto-translation rule set window after you delete a replace-order rule. You must write a new one, or you must delete the entire auto-translation rule.
If you just write regular expressions and replace-order rules, you're flying blind.
After you write up rules (with replacement), you can test them: At the top right, click Preview.
The Auto-translation preview window opens.
memoQ automatically includes a sample text in the Before auto-translation box. You can freely edit or replace it.
- After you edit or replace the text under Before auto-translation, click Preview.
- To delete all text from the Before auto-translation box, click Clear.
The result of the auto-translation appears in the After auto-translation box. Check this box if memoQ is replacing expressions as you expect it to.
To return to the Edit auto-translation rule set window: Click Close.
Customs lists are variable parts in a regular expression. Use them where you would need to list things.
For example, you may want to recognize names of currencies:
Without custom lists, your regular expressions would look like this (the number part is simplified):
EUR ([0-9]+)
USD ([0-9]+)
CHF ([0-9]+)
If you write a custom list of currency names, you need just one regular expression:
#currency# ([0-9]+)
To do this, use the Custom lists tab.
To add a custom list:
- In the box at the bottom left, type a name for the custom list. Make sure you enclose it in # characters.
- Click Add.
- To rename a custom list: Click it under Custom lists. The name appears In the box at the bottom left Make changes. Click Change.
- To delete a custom list: Click it under Custom lists. Click Delete. memoQ deletes the list items, too.
- Add items to the list: In the box at the bottom right, type an item (in the example, it would be the name of a currency). Click Add. Repeat this until you have all the items.
- To change a list item: Click it under List items. In the box at the bottom right, make changes. Click Change.
- To delete a list item: Click it under List items. Click Delete.
Custom list can't be empty: When you add a new custom list, the entire List items box is orange. This should warn you that you must add at least one item. You can't save the auto-translation rule set if one of the custom lists is empty.
To edit the items in an existing custom list: Click it under Custom lists. The items appear under List items. Add, edit, or delete items there.
Translation pairs are custom lists where every item has a translation, too. memoQ uses these to translate specific words automatically. Typically, these are names of months, days, names of measurement units, and similar so-called named entities.
To add a translation pair:
- In the box at the bottom left, type a name for the translation pair. Make sure you enclose it in # characters.
- Click Add.
Names of translation pairs must be different from names of custom lists: You can't reuse the name of a custom list here.
- To rename a translation pair: Click it under Custom lists. The name appears In the box at the bottom left Make changes. Click Change.
- To delete a translation pair: Click it under Custom lists. Click Delete. memoQ deletes the list items, too.
- Add items to the list: In the Source box, type a source word or expreesion. In the Destination box, type its translation. Click Add. Repeat this until you have all the items.
- To change a list item: Click it under List items. In the Source and Destination boxes, make changes. Click Change.
- To delete a list item: Click it under List items. Click Delete.
Translation pairs can't be empty: When you add a new translation pair, the entire List items box is red. This should warn you that you must add at least one item. You can't save the auto-translation rule set if one of the translation pairs is empty.
To edit the items in an existing translation pair: Click it under Custom lists. The items appear under List items. Add, edit, or delete items there.
In auto-translation rules, memoQ can convert measurements, too. memoQ uses one fixed mathematical formula to convert units of measurement from the source language to the units used in the target language. The formula is this: Destination = Source × Scale + Offset.
Two decimal places: During conversion, memoQ rounds off all measurements to two decimal places.
To write up conversions, use the Conversions tab.
The tab has two sections, a list of existing conversion rules on the top and a set of text fields below the list, used to enter a new conversion rule or modify an existing one.
To add a conversion:
- In the Source box, type measurement unit in the source language.
- in the Destination box, type the measurement unit in the target language.
- In the Scale box, type the number that memoQ needs to use to multiply the source measurement with.
- In the Offset box, type a number that memoQ needs to add. It can be a negative number.
Scale without offset: For example: To get centimeters, you simply multiply inches with 2.54.
Scale and offset: For example: To get Fahrenheit, you multiply the Celsius with 1.81, and add 32.
Ofset without scale: To get Kelvin, you subtract 273 from Celsius (use -273 for Offset). (To be exact, it's 273.15, but in physics classes, we always used 273.)
- If the unit comes before the value in the source language: Check the Source unit before value check box.
- If the unit must come before the value in the target language: Check Destination unit before value check box.
After all boxes are filled in, click Add.
- To see the conversion: Click a conversion in the list. In the Example box, memoQ displays the specific formula.
- To change a conversion rule: Click a conversion in the list. Make changes in the boxes below the list. Click Change.
- To delete a conversion rule: Click a conversion in the list. Click Delete.
When you finish
To save the changes, and return to Resource Console, to Project home, or to memoQ online project: Click OK.
To return to Resource Console, to Project home, or to memoQ online project, and not save changes: Click Cancel.