|
精华文章啊!!实在忍不住从口袋转载了过来:)
( o( J: k5 E" G) Z6 A, b
* ]2 \0 o) _4 w8 v原作者:linld97044
- s0 l- R: Q; r1 ?6 \. j L内容:2 L! p; ]0 k# ^ U
玩PDA多年,在坛子一向是潜水多贡献少,现在向坛子贡献下做mdict的方法。( G7 [* C- c3 r( O; j+ S; W% n
% k8 H/ V. j1 Y, [做专业字典首先的难题是字典源文件,经搜索,看来stardict是比较好的源文件,字典量多货足。可以在以下链接大量下载:
" R5 \* S, ~; y9 i+ G1)http://www.vayn.cn/sundries/files/stardict-dict.htm/ i: c# \9 A" h% _! N# }
2)http://reciteword.sourceforge.net/stardict/babylon.php
: j& h' h) }+ j; e0 L5 T3)http://stardict.sourceforge.net/Dictionaries_zh_CN.php8 b- C% d7 ^: S1 b& u
3 i* ~! v# c% z* c& q2 m6 ^本问题之前在http://bbs.pdafans.com/thread-608906-1-1.html(mdict自定义尝试-美国传统字典+湘雅医学词典+高级汉语词典3合1的mdict(附方法))中讨论过,现基本已解决,发帖总结下:. Q( P6 s8 w! M" i9 p# c
7 M+ A7 v( _; V- ?' q
1、根据mdict作者邮件,比较旧的stardict可以用convstar命令转化成txt后用MDXBuilder 2.5 编成mdict的mdx文件。这一步比较简单,之前的帖子也详细说过了。
+ R$ ?# I2 b! W7 g$ H8 H0 {8 |3 |( @' m* b# U
2、第二种情况是stardict后期的词典,用了不同的编码格式,convstar直接转出现下面类似的错误:' m% J# K0 s& }. i1 s
6 i: I1 S" o$ q6 q. P9 t' b4 Y c
“Warning unknown mark: k (0x6b), following content will be ignored.
1 Z( y+ x2 E' n4 E9 T. ~6 NSummary of ignored marks:1 \4 ]" N2 }) t. u( t& Q9 q
k (0x6b) 96281 times
8 V0 g( i' ~+ `. F$ qDone!”
) ^5 u# Y8 _' G, T- }4 _ ]7 M& u( D+ } ]9 f" {
这种情况不能用http://www.octopus-studio.com里的convstar直接转。应做如下处理:
" @3 z& X: ` R+ p) [8 [1 v* ]) G8 m* A
1)先要用aisnote编写的CvtStarDict2Txt.exe转成txt
0 n( O, I* ?0 w" b2)txt用ultraedit编辑成mdict标准格式" I# ]# [% v" h' `$ H8 y
3)用MDXBuilder编成mdx文件。
. c5 Y( h6 `7 _. x$ M6 M6 `
: g# [9 K! r% M以stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2为例给大家示范下stardict to mdict的全过程。
4 c! _$ d( G6 G0 f: k# M. ^% _: f
' F/ z7 @: z) ]: \一、下载文件包,得到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四个文件。
' K( ?! ]: B7 h% y' L9 i
d2 L& ]2 L6 ?# d8 O5 i注,用convstar,出现下列错误信息,说明convstar不能处理该文件:
0 r h: D" {* w. x; i0 \( d/ U
8 w- Q+ L) V2 d”C:\>C:\download\MdxBuilder\ConvStar\ConvStar.exe C:\download\German\stardict-bab
4 y$ ]. P+ p* W2 I; wylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dict' P7 Y. M% t4 P9 ]
ionary.ifo c:\g-e.txt4 O2 Y) S) A+ T5 D2 |7 ~/ r
bookname: Babylon German-English , wordcount 164638
/ ?: X. Y- \9 [$ ]& p. n7 aTotal entries:1646381 }4 d& G' C2 I/ {
Warning unknown mark: h (0x68), following content will be ignored.
5 a2 G! S2 t4 @5 C" MSummary of ignored marks:6 {# ^* H& y" B4 L+ w) @
h (0x68) 164638 times
( }; Y2 v5 H7 c1 t" ` O' XDone!“+ b6 t2 u$ H% M6 M* T
6 N$ w* G0 {0 Q3 E
二、用7-zip继续解压NEW_Babylon_German_English_dictionary.dict.dz,得到NEW_Babylon_German_English_dictionary.dict,该.dict文件应该解压在和另外几个文件在同一目录。
& y' |! [- x8 F5 G见图1
2 M/ o1 [3 s: q: Y9 P$ R' J2 k. i' I" ]4 X" p. o9 Z# q% t0 p
三、启动CvtStarDict2Txt.exe,选择NEW_Babylon_German_English_dictionary.ifo,再点convert。成功后对话框出现:”Word Count=164638
% v8 [0 L; a. U8 y======= E5 T9 C" j0 |
C:\download\German\stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dictionary.txt
' U. H5 b& I6 h2 _0 {# dConvert Success!!
7 ~. ~4 x7 Y) k! E0 h. x, @# x1 d7 }6 K" K======“说明转化成功!
2 w' G c( z1 x+ Q$ I) C, j! [见图26 B d" q V, C9 J
2 Z+ L/ x' n4 t; V& i* G
四、由于要做德英英德双向字典,依样画葫芦下载源转换,得到Babylon_English_German.txt和NEW_Babylon_German_English_dictionary.txt两个文件。+ J8 S6 i4 `" c7 g6 a
) G0 i: X# x; Q4 }( z6 L+ w五、这2个txt文件在ultraedit打开,提示”do you want to convert to DOS format“,选是。本来想用copy命令合并这2个txt,但copy命令不知为何只拷贝了部分文件,所以这里用ultraedit全选一个txt全部文本,粘帖在另一个后面(Ctrl+End)。得到一个313468行的文件。
- M" b3 ^% V1 T/ z$ E
( Q& u2 F& S1 t8 N8 `; n六、在ultraedit”Ctrl + R“把换行符”^p"替换成“^p</>^p”,如图,选replace All。就是在每一行加上换行及</>(mdict分节号)。6 A* i7 |: x8 E |. B# }
如:; U+ [8 c D) j$ K
“abhorrence <font color="blue">n.</font> Abscheu
( N2 [/ \0 Q( |9 k3 }abhorrent <font color="blue">adj.</font> abscheulich”% c" p& x' d% ?5 R; }: m! V, ^/ i
' L, D: Y2 b M
将转成:% O, _; a% A g) P: J
"abhorrence <font color="blue">n.</font> Abscheu$ p' T# G: S K
</>
2 M4 }. j' U& ?$ A6 xabhorrent <font color="blue">adj.</font> abscheulich6 N4 |. d$ z) ?
</>"
1 L$ ]# h% a. Z& C再用一次替换“Ctrl+R”把 “^t"(Tab)替换成”^p“,转换成:$ \6 ~5 ]6 E+ Q& h! r0 w& b. T
”abhorrence
( T3 l, u6 p4 l4 I0 n<font color="blue">n.</font> Abscheu
5 B" Z6 T T1 W, q; U</># A3 k+ }+ Z# W0 m3 R
abhorrent
8 X9 |) G7 m$ z4 c8 l' f<font color="blue">adj.</font> abscheulich; K, p9 @% [9 J3 \% K
</>“
" o7 R$ _1 [" m( W+ t得到mdx标准txt!存储为DOS Terminators-CR/LF ;UTF-8文件。
( ?) t' X- I1 A, ^
- H& q( T8 y& \# k& Y |( K见图3和图4
* H7 Z6 n# ]/ M/ ?4 g. A0 N. ^$ e. p2 L9 A0 {% n9 C
七、mdxbuilder出动,注意source选txt源文件,target输入生成文件路径和名称,style应选example-style.txt,original format这里选Mdict(Compact HTML),Encoding选UTF-8.
5 A& o' y8 u S n k见图5
6 k8 u# u: D' M5 p' O' {
% |! L2 C* f. Q2 `4 y八,完成了,就这么简单
4 |- g( t! T" z! R4 t见图6& q& {8 V2 N6 Z( E8 l2 ]& c) |: }+ I
9 k/ _& i+ z8 ?$ D. @6 Q: C4 G/ r, U
附上几个必须文件:) G+ h) [1 q* g; O: H& ` g
- w4 O3 ~, q: y1 x
CvtStarDict2Txt.exe |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|