Sometimes you may have segments in the Translation Editor that you need to join together or split apart. You can do this in a couple of ways in Lingo—automatically by using segmentation rules or manually by using the split and join features.
If you want to control segment breaks automatically, you can create segmentation rules. Lingo follows the format specified by Segmentation Rules eXchange (SRX). Therefore, after you create segmentation rules, you can export them to an SRX file. You can also import SRX files that have been generated in Lingo.
Lingo's segmentation rules are based on regular expressions. Therefore, you can use regular expressions in the Segmentation Rule Editor when creating segmentation rules. However, this is purely optional; it is not required that you enter regular expressions in your segmentation rules.
examples
Following are some examples of regular expressions:
Expression |
Description |
---|---|
[a-z] |
Matches any lowercase letter |
[A-Z] |
Matches any uppercase letter |
\d |
Matches any decimal digit |
\D |
Matches any non-digit |
\s |
Matches any white-space character |
{…} |
Explicit quantifier For example, a{3} finds "aaa" |
| |
Alternation For example, gray|grey finds "gray" or "grey" |
(…) |
Logical grouping |
? |
0 or 1 of previous expression; forces minimal matching when expression might match several strings within a search string For example, reg(ular expressions?|ex(p|es?) finds "regular expression," "regular expressions," regex, regexp, or "regexes" |
For more examples and information about regular expressions, see the following:
http://www.regular-expressions.info/
http://regexlib.com/CheatSheet.aspx
Note: When using regular expressions in segmentation rules, keep in mind that a period in a rule (e.g., "break after St."; "do not break after St. and before Augustine") may cause unexpected results. This might occur because in regular expressions a period is used to match any character. You can avoid this by always placing a period within square brackets (e.g., "break after St[.]"; "do not break after St[.] and before Augustine") to ensure only the specific character for the period is used.
Note: The following MadCap Flare project files are only segmented based on their units from Flare and not based on regular segmentation rules (periods and other punctuation rules): .liindexmap, .liconceptmap, .flaix, and .flixl files. Therefore, rules from the Segmentation Editor are not applied to these files.
To create basic segmentation rules, start by selecting the Tools ribbon and clicking Segmentation Rules. In the segmentation rules dialog, there are two sections where you can add terms. The section on the left lets you tell Lingo the cases where you do not want segments to break. The section on the right lets you tell Lingo the cases where you do want segments to break.
Segmentation rules can be especially useful for abbreviations and other terms that may contain periods (or other punctuation) that Lingo usually recognizes as the end of a sentence.
You can also create advanced segmentation rules. Advanced segmentation rules allow you to override or edit Lingo's default segmentation rules and to set segmentation rules for specific languages.
To create advanced segmentation rules, start by selecting the Tools ribbon and clicking Segmentation Rules, then click Advanced. Two new tabs appear in the editor: Rules and Languages.
This tab allows you to add, edit, or remove segmentation rules using regular expressions.
This tab allows you to select the languages for which you need to create segmentation rules.
Languages in the Current Languages list appear in a drop-down on the Rules tab.
If you want to return to the basic editor, click Basic.
Note: If you return to the basic editor, the rules you created in the advanced editor remain active but are hidden. If you create new rules in the basic editor, they are added to the user-defined rule set the next time you open the advanced editor.
Following are some additional points to keep in mind when working with segmentation rules:
You can restore Lingo's segmentation rules to their default settings (i.e., clear all custom rules). To do this, click Restore Default.
You can sort the rules by clicking the column headings.
You can resize the columns by clicking the divider between the column headings and dragging to the left or right.
Following are some examples of how you might create segmentation rules:
example—do not break
Let's say you import a Word document and the segments look like this in the Translation Editor:
Notice that the first two rows should be joined into a single segment, and the final three rows should be joined together as well.
To accomplish this with segmentation rules, you can do the following:
With these rules in place, you can update the project and the segments will look like this:
example—break
Let's say you import a Word document and the segments look like this in the Translation Editor:
This is a situation where you want the first segment to remain as it is, but you need the second segment to break after Dr. You can do this manually by splitting the segment, or you can do it automatically by creating a segmentation rule like the following:
With this rule in place, you can update the project and the segments will look like this:
example—do not break (using regular expressions)
Let's say you import a Word document and the segments look like this in the Translation Editor:
To correct these breaks, you can create a segmentation rule like this:
With this rule in place, you can update the project and the segments will look like this:
We can edit the rule so that Lingo does not break segments when Vol. or vol. is followed by a number. But if it is followed by a character, it will break. To accomplish this, we can edit the segmentation rule as shown here:
The modified rule tells Lingo to avoid breaking a segment when it finds Vol. or vol. followed by a number, including occasions when a space exists before the number. With this rule altered, you can update the project and the segments will look like this:
Note: You can use regular expressions with either basic or advanced segmentation rules. However, you may choose to use an advanced segmentation rule if you want to set a rule for a specific language rather than for all languages.
You can use buttons at the bottom of the segmentation rule dialog to import or export SRX files.
After exporting an SRX file, another Lingo user can import it into a project. Only SRX files generated from Lingo can be imported into Lingo.
Note: When you import an SRX file, it replaces your current SRX file, including any custom rules in it.