Apertium 转换引擎会在您的源文本中搜索模式。它搜索的模式是您为每条规则所定义的那些。有些模式可能是一个词,有些模式可能是多个词。转换引擎会优先尝试匹配最长的模式,然后逐渐转向更短的模式。这意味着五词模式会在三词模式之前被使用(假设一组词能同时匹配这两种模式)。当存在多个长度相同的模式时,列表中排在第一位的具有优先权。这意味着在某些情况下,您的规则顺序将很重要。
转换引擎从第一个词开始,按顺序在您的单词中搜索匹配项。它绝不会在文本的某个位置找到匹配项后,再返回到文本的更早位置。
另一个重要的概念是,转换引擎仅针对匹配到的模式对单词进行处理一次。处理完成后,这些单词不会再被检查以匹配其他任何模式。换句话说,模式不能以重叠的方式应用。例如,如果您有一条规则匹配限定词-名词,另一条规则匹配名词-形容词,当处理形式为限定词-名词-形容词的句子时。引擎会使用列表中排在第一位的规则,然后丢弃这三个词,并继续处理其他单词。第二条规则不会被应用。另一种描述方式是说引擎以独立的块来处理单词。
如果 Apertium 转换引擎找到匹配项,它会执行您规则的操作部分。如果引擎找不到某个单词的匹配项,它会根据双语词典中的内容进行默认翻译。参见“规则是如何应用的”。
The Apertium transfer engine searches for patterns in your source text. The patterns it searches for are those defined for each rule you have. Some patterns may be one word, some patterns may be multiple words. The transfer engine tries to match the longest patterns first and then progressively goes to shorter and shorter patterns. This means a five-word pattern would be used before a three-word pattern (assuming a set of words would match both patterns.) When there are multiple patterns of the same length, the first one listed gets precedence. This means in some cases the order of your rules will be important.
The transfer engine searches for matches in your words in sequential order starting with the first word. It will never find a match at some point in a text and then go back earlier in the text.
Another important concept is that the transfer engine processes words just once for whatever pattern is matched. After they are processed, the words are not examined again for any other matches. In other words, patterns cannot apply in an overlapping manner. For example, if you have a rule that matches determiner-noun and another one that matches noun-adjective, when a sentence of the form determiner-noun-adjective is processed. The engine uses the rule that is listed first and then discards the three words and continues on to other words. The second rule does not get applied. Another way to describe it is to say that the engine processes words in distinct chunks.
If the Apertium transfer engine finds a match, it runs the action part of your rule. If the engine finds no match for a word, it does default translation of it according to what is in the bilingual dictionary. Cf. “How Rules are Applied”.
机器翻译自 English