Trados Studio | 利用正则表达式验证功能快速执行文风指南中的要求
文风指南(style guide,SG)是一家单位内部关于用词、行文或版式的一套约定俗成的规则。翻译工作中译员必须细读SG,将相关要求谨记于心,并在作业过程中严格遵守。
以下是一份SG中关于版式的要求:
1)数字与英文单位之间需要空格,如“10,000 IU/mL”之间的空格
2)英文或数字与数学符号之间不需要空格,如HCV RNA<25 IU/mL
3)斜线(/)前后无需空格,如0.5 mg/dL
4)双字节字符和单字节字符之间无需空格,如维生素E、第1天
5)数值与特殊符号之间无需空格,如38℃,100%
6)表示范围的符号“~”、“-”与数值之间无需空格,如1-5、1~5
一份SG少则数页,多则数十页,逐条记下所有要求并非易事。这时候将这些要求转化为Trados Studio软件内置的QA验证规则就很有必要了。具体做法如下:
打开Trados Studio,依次点击Home->Project Settings->Verification->QA Checker 3.0->Regular Expressions->Search regular expressions [勾选此项]
有五个字段可以设定:
- Description:执行QA后,若报错则显示此字段的内容;
- RegEx source:填入拟在原文句段匹配的内容;
- RegEx target:填入拟在译文句段匹配的内容;
- Condition:下拉选择匹配条件;
- Ignorecase:设置匹配时是否忽略英文字母大小写。
可以逐条设置规则,设置完一条,点击右侧Action
,选择Add item
,即可添加一条规则。
比如上述SG中关于版式的六条要求可转化为以下规则(在Trados Studio中设置好,再导出.txt或.csv文档即可):
<Setting Id="RegExRules1">
<RegExRule
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/Sdl.Verification.QAChecker.RegEx">
<Description>Spaces between numbers and alphabets</Description>
<IgnoreCase>true</IgnoreCase>
<RegExSource></RegExSource>
<RegExTarget>\d[a-z]</RegExTarget>
<RuleCondition>TargetOnly</RuleCondition>
</RegExRule>
</Setting>
<Setting Id="RegExRules2">
<RegExRule
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/Sdl.Verification.QAChecker.RegEx">
<Description>Spaces between numbers/alphabets and math operators</Description>
<IgnoreCase>true</IgnoreCase>
<RegExSource></RegExSource>
<RegExTarget>[a-z] [><+/*-=]</RegExTarget>
<RuleCondition>TargetOnly</RuleCondition>
</RegExRule>
</Setting>
<Setting Id="RegExRules3">
<RegExRule
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/Sdl.Verification.QAChecker.RegEx">
<Description>Spaces after a slash</Description>
<IgnoreCase>true</IgnoreCase>
<RegExSource></RegExSource>
<RegExTarget>(.*? /)|(/ .*?)</RegExTarget>
<RuleCondition>TargetOnly</RuleCondition>
</RegExRule>
</Setting>
<Setting Id="RegExRules4">
<RegExRule
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/Sdl.Verification.QAChecker.RegEx">
<Description>Spaces between dual bytes and single bytes</Description>
<IgnoreCase>true</IgnoreCase>
<RegExSource></RegExSource>
<RegExTarget>([一-龻!-○、-〾] [^一-龻!-○、-〾])|([^一-龻!-○、-〾] [一-龻!-○、-〾])</RegExTarget>
<RuleCondition>TargetOnly</RuleCondition>
</RegExRule>
</Setting>
<Setting Id="RegExRules5">
<RegExRule
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/Sdl.Verification.QAChecker.RegEx">
<Description>Spaces between special chars and numbers</Description>
<IgnoreCase>true</IgnoreCase>
<RegExSource></RegExSource>
<RegExTarget>\d (℃|%)</RegExTarget>
<RuleCondition>TargetOnly</RuleCondition>
</RegExRule>
</Setting>
<Setting Id="RegExRules6">
<RegExRule
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/Sdl.Verification.QAChecker.RegEx">
<Description>Spaces around dashes and tildes</Description>
<IgnoreCase>true</IgnoreCase>
<RegExSource></RegExSource>
<RegExTarget>(\d (-|~))|((-|~) \d)</RegExTarget>
<RuleCondition>TargetOnly</RuleCondition>
</RegExRule>
</Setting>
</SettingsGroup>
</SettingsBundle>
保存这些规则,以后可以在其他项目中复用。