|
精华文章啊!!实在忍不住从口袋转载了过来:)
% ]& ~$ q( x6 a% @0 g2 t
2 Z8 C: f* Q) ?' g4 _; k原作者:linld970446 d1 Y; f" n/ `+ B6 X H1 u
内容:! @6 F1 [+ H. ^8 Y" G
玩PDA多年,在坛子一向是潜水多贡献少,现在向坛子贡献下做mdict的方法。
, ?- W# ~- U" X5 M
2 f1 x7 w9 N) c& w$ ]) P做专业字典首先的难题是字典源文件,经搜索,看来stardict是比较好的源文件,字典量多货足。可以在以下链接大量下载:
7 ]8 q( b9 j4 {, n l! d% x, U1)http://www.vayn.cn/sundries/files/stardict-dict.htm
& v. ^4 r* \5 E, n$ `$ Z2)http://reciteword.sourceforge.net/stardict/babylon.php( ]' ^5 g/ T8 c" H4 Z3 y
3)http://stardict.sourceforge.net/Dictionaries_zh_CN.php
Z% S9 r7 ~3 {4 o/ W, t4 v9 \ n' U. a: N( w, f: }6 J1 t
本问题之前在http://bbs.pdafans.com/thread-608906-1-1.html(mdict自定义尝试-美国传统字典+湘雅医学词典+高级汉语词典3合1的mdict(附方法))中讨论过,现基本已解决,发帖总结下:2 x' ^/ H* [8 X: g& ^+ d1 [
& R5 b4 M a! i }+ r) u
1、根据mdict作者邮件,比较旧的stardict可以用convstar命令转化成txt后用MDXBuilder 2.5 编成mdict的mdx文件。这一步比较简单,之前的帖子也详细说过了。# U$ O6 D# R* w7 t8 B- ]
4 m1 \5 {; x! C( ?# X8 ~ k2、第二种情况是stardict后期的词典,用了不同的编码格式,convstar直接转出现下面类似的错误:
) j5 W. \( ]1 O
5 s1 B6 P& v0 @6 _, v4 U7 D" c# K“Warning unknown mark: k (0x6b), following content will be ignored.( I: j* W# }; H+ Z# i
Summary of ignored marks:
) Y. H* U) d, L( k5 Gk (0x6b) 96281 times z/ x& J4 Q6 E. j* q
Done!”: i( X; w* p( v: ?
! M( Q0 S. w4 q% d; D5 p* u
这种情况不能用http://www.octopus-studio.com里的convstar直接转。应做如下处理:, ^2 I% C8 `) t. ?9 T
/ x: N" O5 Q& G% C% x9 K5 o! o1)先要用aisnote编写的CvtStarDict2Txt.exe转成txt; a b* ]' E& e- b
2)txt用ultraedit编辑成mdict标准格式+ H& Z8 G7 l) |/ P' Q
3)用MDXBuilder编成mdx文件。1 t( E) j. \/ g- s! q( K
+ p4 x5 Q/ G. u
以stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2为例给大家示范下stardict to mdict的全过程。
; f" d; Z/ I* s: K/ Y2 u0 K P4 q+ j# n4 a
一、下载文件包,得到stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2.tar.bz2,该文件可以用winrar解压,得到NEW_Babylon_German_English_dictionary.dict.dz;NEW_Babylon_German_English_dictionary.idx;NEW_Babylon_German_English_dictionary.ifo;NEW_Babylon_German_English_dictionary.syn四个文件。( F# k/ I/ ?6 O
7 T7 s% z- u8 Z& }0 w& U# T v( p& ~
注,用convstar,出现下列错误信息,说明convstar不能处理该文件:4 C/ T( G3 ~& `- r
0 {0 I5 B/ v5 k4 Z5 `0 ?: ]7 n
”C:\>C:\download\MdxBuilder\ConvStar\ConvStar.exe C:\download\German\stardict-bab
F- Y8 [( S0 `8 i7 u7 X$ i! tylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dict# N& n+ Q' M1 m7 }
ionary.ifo c:\g-e.txt
2 S2 a" @# A" u( p+ k vbookname: Babylon German-English , wordcount 164638
. X, h0 r9 P) M1 l" D1 F4 t) QTotal entries:164638
( @) q1 _6 ^5 r; J/ UWarning unknown mark: h (0x68), following content will be ignored.
. C. Q7 C( T! u" Y9 {! ]0 k; }4 u3 wSummary of ignored marks:+ W- U/ P5 G; P" M
h (0x68) 164638 times8 d6 z0 H2 v+ n8 G W
Done!“
, Q# C9 n! C/ [5 ~+ H; i
, b5 R' y: s- x3 V' f二、用7-zip继续解压NEW_Babylon_German_English_dictionary.dict.dz,得到NEW_Babylon_German_English_dictionary.dict,该.dict文件应该解压在和另外几个文件在同一目录。* S( G" q9 G, s- x# j; T3 R' d
见图1
3 M! z2 D$ |3 f8 g* S. D, k: F1 x N4 k( {
三、启动CvtStarDict2Txt.exe,选择NEW_Babylon_German_English_dictionary.ifo,再点convert。成功后对话框出现:”Word Count=1646387 N" l6 U" Z( W% i. s0 G5 l* n- v) e
=======
: D5 e; L% |: e: p. d2 o$ s4 r0 cC:\download\German\stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dictionary.txt 3 E$ i7 d* T% L
Convert Success!!" |1 ?7 k7 q# s5 [
======“说明转化成功!
1 G# P/ m/ f6 N' k) F: S6 R见图2
" @# @! B7 t' s" n6 [7 Y4 S6 Z. t6 h. N6 P8 S7 l; I' B" p* [2 p
四、由于要做德英英德双向字典,依样画葫芦下载源转换,得到Babylon_English_German.txt和NEW_Babylon_German_English_dictionary.txt两个文件。
/ g( e" O( T, ?' ^7 K5 P7 ^" A0 D2 R8 ~% {! t# ^
五、这2个txt文件在ultraedit打开,提示”do you want to convert to DOS format“,选是。本来想用copy命令合并这2个txt,但copy命令不知为何只拷贝了部分文件,所以这里用ultraedit全选一个txt全部文本,粘帖在另一个后面(Ctrl+End)。得到一个313468行的文件。
- l( r, B% y$ P# Q* O9 B) q$ u: a' C# |3 `* Z+ h
六、在ultraedit”Ctrl + R“把换行符”^p"替换成“^p</>^p”,如图,选replace All。就是在每一行加上换行及</>(mdict分节号)。0 `+ }( \5 N, M9 b9 l1 Y6 I4 V5 p
如:5 }/ l) ?; }) N3 d& v5 z/ g |$ s' F
“abhorrence <font color="blue">n.</font> Abscheu
% q1 }( P6 r; Y8 c9 k, Qabhorrent <font color="blue">adj.</font> abscheulich”
4 V9 ~! Y2 q2 f% @$ V5 N" ?4 c/ ]
将转成:; i0 n- G. t! x0 c7 y
"abhorrence <font color="blue">n.</font> Abscheu1 R: A1 m P) \2 ]
</>/ }- s! s5 N' t
abhorrent <font color="blue">adj.</font> abscheulich. Q6 \3 [" O+ p3 }
</>"0 v7 @. T+ ]4 A# M7 I
再用一次替换“Ctrl+R”把 “^t"(Tab)替换成”^p“,转换成:
. I* q# [9 b" I7 v6 o”abhorrence/ Y) \' m: ?3 S0 ?+ s1 j0 ]# J% Z
<font color="blue">n.</font> Abscheu
7 a/ [$ p9 c S! d" @& c$ B" y</>
+ a( k; d/ {- k; ~6 mabhorrent+ X8 k6 k& E# f& A
<font color="blue">adj.</font> abscheulich
) S2 W# f4 k. W; d( M</>“
1 q3 i) O6 u `7 D4 O0 D6 B2 K' P得到mdx标准txt!存储为DOS Terminators-CR/LF ;UTF-8文件。8 L# v: m5 ~# D
) K% R" |: B% q$ B
见图3和图4) L- t4 P- ?- x" `' V" L
% v3 x# W6 {% \1 ~! m! Q" C七、mdxbuilder出动,注意source选txt源文件,target输入生成文件路径和名称,style应选example-style.txt,original format这里选Mdict(Compact HTML),Encoding选UTF-8.( S! A* G9 Z$ d+ w I% N
见图5
/ {# y! _) i2 \4 w" x, a( f/ q" D
2 U2 [. ~# } V) K八,完成了,就这么简单, e; y$ V9 a, |/ ?+ \6 D
见图6
9 {9 J$ u% P& R: X- ]+ D$ z8 \9 q: A$ t; F
附上几个必须文件:" [$ U6 L0 D# f& g/ X" r/ b: P1 g* k
, I. }$ N! O+ B* w
CvtStarDict2Txt.exe |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|