我認為問題在於 Paratext 的 XML 規定了什麼以及沒有規定什麼。它規定了文本塊、gloss-id(交叉引用 Lexicon.xml 檔案)以及原始文本在輸入流某種表示中的位置。它不保留出現順序。節也不是按順序排列的。
給定的單詞或短語可能被註釋為單詞或詞根和形態素(當然有不同的註釋),而區分哪個同形異義詞是哪個或用戶期望哪種層級的註釋的唯一方法是通過定位數據。註釋檔案似乎忽略大小寫、標點符號和 SFM 標記,可能還忽略其他內容。
因此,如果註釋檔案與輸入匹配,那麼假設 Martin 已經理解了 Paratext 在其檔案內部表示中計算字符的未記錄方式,那麼正確的做法是通過位置切出單詞/短語單元並替換為註釋,可能根據需要進行一些大小寫轉換。
如果節已更改,則這不起作用。如果檔案的內部表示錯誤,則這不起作用。
任何不受約束的搜索和替換都會在同形異義詞上產生錯誤匹配,因此不能將其用作通用方法。可以進行一些猜測,例如查找模糊匹配,在字間斷點處斷開,加上或減去幾個字符。這將花費相當大的編程人員時間投資,但可能會出現問題。如果因為有人重新排列了節中的單詞順序而導致間距發生變化,偏移 3 個字符的同形異義詞可能不是同一個單詞。例如,Romani 具有相當自由的詞序:
O Del te del tut haro
(the) God SUBJ give you grace
"May God give you grace"
對比
Te del o Del tut haro
SUBJ give (the) God you grace
"May God give you grace"
PTXprint 無法進入語言的語言學規則。甚至 Paratext 也不記得/詢問事物是什麼詞性。獲得可靠直排數據的唯一可靠方式是讓用戶批准註釋。
The problem is, I believe, what Paratext’s XML specifies and what it doesn’t. It specifies chunk of text, gloss-id (cross-referencing the Lexicon.xml file) and the position of the original text in some representatoin of the input stream. It does not preserve the order of occurrence. The verses are not in sequence, either.
A given word or phrase may be glossed as word(s) or stem and morphemes, (of course with different glosses) and the only way to tell which homograph is which or which level of glossing the user expects is via the positioning data. The glossing file seems to ignore case, punctuation and SFM marks, and probably other things too.
Thus if the glossing file matches the input, then assuming that Martin has understood the undocumented way in which Paratext counts characters in its internal representation of the file, then the right thing to do is cut out the word/phrase unit by position and replace with the gloss, possibly doing some case transposition as appropriate.
If the verse has changed, then that doesn’t work. If the internal representation of the file is wrong, then it doesn’t work.
Any unconstrained search and replace is going to get false matches on homographs, so that can’t be used as a general approach. There could be some guessing done, looking for fuzzy-matches plus or minus a few characters, breaking at word-gaps, for instance. That would cost a fairly large investment of programmer time, but there could be problems. If the spacing has changed because someone has reordered the words in the verse, the homograph offset by 3 characters might not be the same word. E.g. Romani has fairly free word order:
O Del te del tut haro
(the) God SUBJ give you grace
"May God give you grace"
vs
Te del o Del tut haro
SUBJ give (the) God you grace
"May God give you grace"
PTXprint can’t go into the linguistics rules of the language. Not even Paratext remembers / asks what parts of speech things are. The only reliable way to get trustworthy interlinear data is for the user to approve glosses.
機器翻譯自 English