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