@@ -34,6 +34,11 @@ msgid ""
3434"context and unified diffs -- formats produced by tools like :manpage:`diff "
3535"<diff(1)>` and :manpage:`git diff <git-diff(1)>`."
3636msgstr ""
37+ "此模組提供用於比較序列的類別和函式。它們大多是比較文字行的序列(例如字串串"
38+ "列,或\\ :term:`檔案物件 <file object>`),並產生\\ :dfn:`diff`\\ —— 也就是差"
39+ "異的報告。diff 可以以多種格式產生,包括 HTML,以及 :manpage:`diff <diff(1)>` "
40+ "和 :manpage:`git diff <git-diff(1)>` 這類工具所產生的 context diff 與 "
41+ "unified diff 格式。"
3742
3843#: ../../library/difflib.rst:28
3944msgid ""
@@ -42,17 +47,23 @@ msgid ""
4247"any type, not just text, so long as the sequence elements are :term:"
4348"`hashable`."
4449msgstr ""
50+ "比較是使用實作於 :class:`SequenceMatcher` 中的匹配演算法來完成的——這是一個靈"
51+ "活的類別,可用於比較任何型別的序列,而不僅限於文字,只要序列中的元素是\\ :"
52+ "term:`可雜湊 <hashable>`\\ 即可。"
4553
4654#: ../../library/difflib.rst:37
4755msgid "Junk heuristic"
48- msgstr ""
56+ msgstr "雜訊啟發式 "
4957
5058#: ../../library/difflib.rst:39
5159msgid ""
5260":mod:`!difflib` uses a :dfn:`junk` heuristic: some items are deemed to be :"
5361"dfn:`junk`, and ignored when searching for similarities. Ideally, these are "
5462"uninteresting or common items, such as blank lines or whitespace."
5563msgstr ""
64+ ":mod:`!difflib` 使用\\ :dfn:`雜訊`\\ 啟發式:某些項目會被判定為\\ :dfn:`雜訊"
65+ "`,並在搜尋相似之處時被忽略。理想情況下,這些是不重要或常見的項目,例如空白行"
66+ "或空白字元。"
5667
5768#: ../../library/difflib.rst:44
5869msgid ""
@@ -61,25 +72,33 @@ msgid ""
6172"understandable for humans (typically breaking on whitespace). But it can "
6273"also cause pathological cases:"
6374msgstr ""
75+ "這個啟發式方法可以加速演算法的執行(因為它減少了可能組合的數量),並且可以產"
76+ "生對人類來說更容易理解的結果(通常會在空白字元處斷開)。但它也可能導致病態情"
77+ "況:"
6478
6579#: ../../library/difflib.rst:49
6680msgid ""
6781"Inappropriately chosen junk items can cause an unexpectedly **large** (but "
6882"still correct) result."
69- msgstr ""
83+ msgstr "選擇不當的雜訊項目可能導致結果出乎意料地 \\ **龐大** \\ (但仍然正確)。 "
7084
7185#: ../../library/difflib.rst:51
7286msgid ""
7387"The default heuristic is **asymmetric**: only the second sequence is "
7488"inspected when determining what is considered junk, so comparing A to B can "
7589"give different results than comparing B to A and reversing the result."
7690msgstr ""
91+ "預設的啟發式方法是\\ **不對稱**\\ 的:在判斷哪些項目算是雜訊時,只會檢查第二"
92+ "個序列,因此將 A 與 B 比較,可能會與將 B 與 A 比較後再反轉結果得到不同的結"
93+ "果。"
7794
7895#: ../../library/difflib.rst:55
7996msgid ""
8097"By default, if the second input sequence is at least 200 items long, items "
8198"that account for more than 1% it are considered *junk*."
8299msgstr ""
100+ "在預設情況下,如果第二個輸入序列的長度至少有 200 個項目,則佔比超過 1% 的項目"
101+ "會被視為\\ *雜訊*\\ 。"
83102
84103#: ../../library/difflib.rst:58
85104msgid ""
@@ -88,10 +107,14 @@ msgid ""
88107"``False``) or tuning it (using the *isjunk* argument, perhaps to one of the :"
89108"ref:`predefined functions <difflib-isjunk-functions>`)."
90109msgstr ""
110+ "根據你的資料情況,你可能需要考慮關閉這個啟發式方法(將 :class:`~difflib."
111+ "SequenceMatcher` 的 *autojunk* 引數設為 ``False``),或是調整它(使用 "
112+ "*isjunk* 引數,也許可以用\\ :ref:`預先定義的函式 <difflib-isjunk-"
113+ "functions>`\\ 之一)。"
91114
92115#: ../../library/difflib.rst:65
93116msgid "The :mod:`!difflib` algorithm"
94- msgstr ""
117+ msgstr ":mod:`!difflib` 的演算法 "
95118
96119#: ../../library/difflib.rst:67
97120msgid ""
@@ -102,29 +125,39 @@ msgid ""
102125"recursively handle the pieces of the sequences to the left and to the right "
103126"of the matching subsequence."
104127msgstr ""
128+ ":class:`SequenceMatcher` 中使用的演算法比 Ratcliff 和 Obershelp 在 1980 年代"
129+ "末以「格式塔模式匹配 (gestalt pattern matching)」這個誇張名稱發表的演算法要更"
130+ "早出現,且稍微精巧一些。其想法是找出兩個輸入中最長的共同連續子序列,然後遞迴"
131+ "地處理該匹配子序列左右兩側的部分。"
105132
106133#: ../../library/difflib.rst:76
107134msgid ""
108135"`Pattern Matching: The Gestalt Approach <https://jacobfilipp.com/DrDobbs/"
109136"articles/DDJ/1988/8807/8807c/8807c.htm>`_"
110137msgstr ""
138+ "`Pattern Matching: The Gestalt Approach <https://jacobfilipp.com/DrDobbs/"
139+ "articles/DDJ/1988/8807/8807c/8807c.htm>`_"
111140
112141#: ../../library/difflib.rst:77
113142msgid ""
114143"Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. "
115144"This was published in Dr. Dobb's Journal in July, 1988."
116145msgstr ""
146+ "由 John W. Ratcliff 和 D. E. Metzener 討論一個類似的演算法。此文章發表於 "
147+ "1988 年 7 月的 Dr. Dobb's Journal。"
117148
118149#: ../../library/difflib.rst:80
119150msgid ""
120151"As an extension to the Ratcliff and Obershelp algorithm, :mod:`!difflib` "
121152"searches for the longest *junk-free* contiguous subsequence. See the :ref:"
122153"`difflib-junk` section for details."
123154msgstr ""
155+ "作為 Ratcliff 和 Obershelp 演算法的延伸,:mod:`!difflib` 會搜尋最長的\\ *無雜"
156+ "訊*\\ 連續子序列。詳情請參閱\\ :ref:`difflib-junk`\\ 一節。"
124157
125158#: ../../library/difflib.rst:84
126159msgid "Timing"
127- msgstr ""
160+ msgstr "耗時 "
128161
129162#: ../../library/difflib.rst:86
130163msgid ""
@@ -134,10 +167,13 @@ msgid ""
134167"complicated way on how many elements the sequences have in common; best case "
135168"time is linear."
136169msgstr ""
170+ "基本的 Ratcliff-Obershelp 演算法在最差情況下為三次方時間,在預期情況下為二次"
171+ "方時間。:mod:`difflib` 的演算法在最差情況下為二次方時間,其預期情況下的行為則"
172+ "以複雜的方式取決於這些序列共有多少元素;最佳情況下的時間則為線性。"
137173
138174#: ../../library/difflib.rst:97
139175msgid "Diff generation"
140- msgstr ""
176+ msgstr "產生 diff "
141177
142178#: ../../library/difflib.rst:103
143179msgid ""
@@ -522,7 +558,7 @@ msgstr ""
522558
523559#: ../../library/difflib.rst:430
524560msgid "Junk definition functions"
525- msgstr ""
561+ msgstr "雜訊定義函式 "
526562
527563#: ../../library/difflib.rst:434
528564msgid ""
@@ -823,9 +859,8 @@ msgid ""
823859msgstr ""
824860
825861#: ../../library/difflib.rst:662
826- #, fuzzy
827862msgid "Examples"
828- msgstr "範例: "
863+ msgstr "範例"
829864
830865#: ../../library/difflib.rst:667
831866msgid "SequenceMatcher examples"
0 commit comments