|
精华文章啊!!实在忍不住从口袋转载了过来:) 3 k( g) F0 b1 Z4 i3 r9 M
: F& v; p9 E% } {# V) i/ L原作者:linld970447 | {$ E2 Q+ e+ N" u
内容:
5 M9 U, |! U, G9 b6 S4 u玩PDA多年,在坛子一向是潜水多贡献少,现在向坛子贡献下做mdict的方法。
" e' I; V' ~" z( {' X3 C. w/ P! [ W. o
做专业字典首先的难题是字典源文件,经搜索,看来stardict是比较好的源文件,字典量多货足。可以在以下链接大量下载:! |. S( F; [$ v4 g W
1)http://www.vayn.cn/sundries/files/stardict-dict.htm
* |% J* }9 @3 F% i2)http://reciteword.sourceforge.net/stardict/babylon.php0 y+ Z! _, J+ { g( o
3)http://stardict.sourceforge.net/Dictionaries_zh_CN.php
# D8 t- _! Y3 W, W. v% u! ?0 n4 s$ c3 m; e/ [# \! \4 M
本问题之前在http://bbs.pdafans.com/thread-608906-1-1.html(mdict自定义尝试-美国传统字典+湘雅医学词典+高级汉语词典3合1的mdict(附方法))中讨论过,现基本已解决,发帖总结下:
2 X) ^/ Q8 T9 s: [$ D# z* S, t, _6 m0 s
1、根据mdict作者邮件,比较旧的stardict可以用convstar命令转化成txt后用MDXBuilder 2.5 编成mdict的mdx文件。这一步比较简单,之前的帖子也详细说过了。 b6 U) X/ L/ }% `
; R. i2 c, k0 \# Y3 k
2、第二种情况是stardict后期的词典,用了不同的编码格式,convstar直接转出现下面类似的错误:
u5 D3 \, f5 j6 ^
8 ~) H! }5 Z; Y) T“Warning unknown mark: k (0x6b), following content will be ignored.
. }! W/ f5 f" r+ X5 d& |+ ESummary of ignored marks:
5 |+ }5 t4 R) b) v* L. jk (0x6b) 96281 times* K' R7 Q' S. L9 ]" J
Done!”* {, _. A" g- w, T! [" L o
7 I. M/ A1 o" A2 }! f0 r( M这种情况不能用http://www.octopus-studio.com里的convstar直接转。应做如下处理:+ G6 ?* z7 v$ p( G
( D5 Z p% |+ q$ o; Q) D9 a1)先要用aisnote编写的CvtStarDict2Txt.exe转成txt
1 R; }/ ^5 J3 l) ^2 W2 Z0 u2)txt用ultraedit编辑成mdict标准格式; Z; Q" b$ Y b
3)用MDXBuilder编成mdx文件。& R9 b9 o5 i6 l% c' H# D( C {3 p
/ ~7 A2 A9 o/ L: r# C( d以stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2为例给大家示范下stardict to mdict的全过程。
7 b4 d5 W T2 r$ n- Q1 }& S. q) F
8 b. y6 F" m* H2 w2 d一、下载文件包,得到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四个文件。% R b" @: g2 j' {( Y9 i9 S* {
) a* q- ^( l' L d9 p: V
注,用convstar,出现下列错误信息,说明convstar不能处理该文件:
f4 J; |8 \, w0 {6 \$ }0 X) ?9 w5 [2 Y
”C:\>C:\download\MdxBuilder\ConvStar\ConvStar.exe C:\download\German\stardict-bab
! q7 H& P b* ~0 gylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dict
# C5 D. U4 ?7 e9 ^" _6 I Q" Cionary.ifo c:\g-e.txt0 W. x3 S6 e% k# W3 n" g
bookname: Babylon German-English , wordcount 164638
- ^' @! c$ Z2 W% ZTotal entries:164638) V8 v3 u1 Y' k3 L0 V9 H3 Z) O
Warning unknown mark: h (0x68), following content will be ignored.2 h+ G( p% q2 d4 K& z
Summary of ignored marks:; v- h f: d) a5 u1 R' c
h (0x68) 164638 times
% s1 y/ h% z, }, ADone!“; J; w/ @- [+ v9 L+ \+ B
/ l7 |8 c- F" A' z6 Y: c$ P
二、用7-zip继续解压NEW_Babylon_German_English_dictionary.dict.dz,得到NEW_Babylon_German_English_dictionary.dict,该.dict文件应该解压在和另外几个文件在同一目录。
! I9 n) }/ o0 s2 ?2 a$ }) F见图1+ g5 K$ D: @0 V( b. J/ x
3 S, E. ^% M+ i, X
三、启动CvtStarDict2Txt.exe,选择NEW_Babylon_German_English_dictionary.ifo,再点convert。成功后对话框出现:”Word Count=164638! Q; Q2 E" V7 J k7 f1 b
=======3 t: C! ?" v) M5 x
C:\download\German\stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dictionary.txt
$ L, p5 L6 {# }/ o! OConvert Success!!, o: s \* B, z' A5 G/ |, u- f, O
======“说明转化成功!
4 k, q0 y9 I2 Q2 {( A6 v, _见图23 g# w, |2 P+ P7 e; L% h8 U
# U& @; \/ l: [/ V9 d* e四、由于要做德英英德双向字典,依样画葫芦下载源转换,得到Babylon_English_German.txt和NEW_Babylon_German_English_dictionary.txt两个文件。
0 M6 I6 u( Q' y1 g' ^! \, a+ k( u( p5 J7 Z* n: v4 h
五、这2个txt文件在ultraedit打开,提示”do you want to convert to DOS format“,选是。本来想用copy命令合并这2个txt,但copy命令不知为何只拷贝了部分文件,所以这里用ultraedit全选一个txt全部文本,粘帖在另一个后面(Ctrl+End)。得到一个313468行的文件。
5 C; W3 k7 q; i# {2 E/ U* H9 M- A+ U* ]
六、在ultraedit”Ctrl + R“把换行符”^p"替换成“^p</>^p”,如图,选replace All。就是在每一行加上换行及</>(mdict分节号)。7 u; W% H# h/ t2 v ^# K* K: t N
如:6 T1 P5 l& ^1 ^
“abhorrence <font color="blue">n.</font> Abscheu
# i) i% d6 @: L* U1 ~abhorrent <font color="blue">adj.</font> abscheulich”
6 x# {# ?& t. O; \1 C
7 |# c& i: f+ F5 Q( L将转成:
2 I. H3 Q0 l& w" J7 I"abhorrence <font color="blue">n.</font> Abscheu
' E8 h7 j3 c' A! m</>( q3 s9 X+ i! U3 g. Z
abhorrent <font color="blue">adj.</font> abscheulich
+ j; k" l- V/ a</>"
: ^! s4 G+ k6 f再用一次替换“Ctrl+R”把 “^t"(Tab)替换成”^p“,转换成:; J" \6 J0 q$ R7 P! I' }
”abhorrence
1 O4 x+ S2 V7 b R9 H# ~2 l# C<font color="blue">n.</font> Abscheu
( z9 G7 ^( U* F</>
1 F+ A% x# u/ e: _5 C# Aabhorrent& `- P6 \2 p, V$ K+ C
<font color="blue">adj.</font> abscheulich4 D& @8 E# @; y
</>“4 ^0 U2 ^9 m: }5 _6 J' f, k5 `
得到mdx标准txt!存储为DOS Terminators-CR/LF ;UTF-8文件。
5 a- \7 J$ Q, a, e' W
! ^ V% w: `4 j- h见图3和图4# C s* W# s! w1 I# \8 A
5 b* z6 L; H- H1 V+ K( [; n七、mdxbuilder出动,注意source选txt源文件,target输入生成文件路径和名称,style应选example-style.txt,original format这里选Mdict(Compact HTML),Encoding选UTF-8.
v' t) J9 J- S6 f1 c+ x2 j5 U1 v见图5
' f" X( w% e6 {6 |" q- s8 ?. ?4 x% S0 @3 _2 H
八,完成了,就这么简单1 `+ V/ o0 e h9 P* h( @
见图6
# E7 Y, \# K0 K- p/ @: T- _: H) S( z
6 W& ]/ k3 f* x- v: }) v附上几个必须文件:
: S1 Y, S8 ~3 ?3 K, k+ Y$ I6 r0 @7 T: M) ]' V
CvtStarDict2Txt.exe |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|