|
|
精华文章啊!!实在忍不住从口袋转载了过来:)
4 p: H# g8 W- E. q6 b4 P" f
. |3 {( \- m! l/ W原作者:linld970447 e0 j( J }( f
内容:
. z( N1 Q2 `/ f玩PDA多年,在坛子一向是潜水多贡献少,现在向坛子贡献下做mdict的方法。
( @0 Z# Q# I8 }8 p) M. L3 Z" K4 ^7 t, |' s) V
做专业字典首先的难题是字典源文件,经搜索,看来stardict是比较好的源文件,字典量多货足。可以在以下链接大量下载:5 Q) I) ]' e, R/ V4 r4 Q
1)http://www.vayn.cn/sundries/files/stardict-dict.htm
+ h" ]" V/ P4 Z. O9 T* t4 E# w2)http://reciteword.sourceforge.net/stardict/babylon.php
1 D* C: E4 e9 d# ]+ E0 W% A3)http://stardict.sourceforge.net/Dictionaries_zh_CN.php. g$ v: m; D" q* x
% G; d" O2 S* @+ F4 x本问题之前在http://bbs.pdafans.com/thread-608906-1-1.html(mdict自定义尝试-美国传统字典+湘雅医学词典+高级汉语词典3合1的mdict(附方法))中讨论过,现基本已解决,发帖总结下:
% T- m& ^. z; x1 N R* o
3 C3 H( r6 d5 n$ N+ Y S1、根据mdict作者邮件,比较旧的stardict可以用convstar命令转化成txt后用MDXBuilder 2.5 编成mdict的mdx文件。这一步比较简单,之前的帖子也详细说过了。7 {9 U2 X2 D( e* h
/ L# ^4 J6 [: t" b# d) |
2、第二种情况是stardict后期的词典,用了不同的编码格式,convstar直接转出现下面类似的错误:
- V7 y9 \0 t( t* Y0 D$ Y
" t. u+ Y* F" B) y/ r, a! E. i“Warning unknown mark: k (0x6b), following content will be ignored." @0 `8 w$ T( ^, r
Summary of ignored marks:
( O) _9 d5 L9 ]8 xk (0x6b) 96281 times" V: i( d) L0 |) U- P
Done!”
8 B0 g8 I3 Y+ t) T
5 _. V5 t" B! f( w8 }: B& S! @这种情况不能用http://www.octopus-studio.com里的convstar直接转。应做如下处理:
3 g2 j" {! y. l- J& f- u( R" C: Z8 u/ \; J+ x- z7 U
1)先要用aisnote编写的CvtStarDict2Txt.exe转成txt
7 `$ ]% V1 G7 d6 ?2)txt用ultraedit编辑成mdict标准格式! p( P$ G( H, r7 H
3)用MDXBuilder编成mdx文件。! u9 B. W2 c0 l4 f3 M
" R$ m' F! u3 y9 l以stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2为例给大家示范下stardict to mdict的全过程。
, W# t+ X) l4 B2 K) y7 p2 x0 S8 o3 h6 V# ~
一、下载文件包,得到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四个文件。4 i f, I; d ^0 c/ C
5 @4 c3 m- E( R) i" z注,用convstar,出现下列错误信息,说明convstar不能处理该文件:( |5 A! W& B/ W/ {; f
( b2 |* t4 a0 d2 [+ V0 N
”C:\>C:\download\MdxBuilder\ConvStar\ConvStar.exe C:\download\German\stardict-bab1 Z- A) K* y- t& o! k" k) m6 u
ylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dict, u, x# z0 {) |/ [' Z
ionary.ifo c:\g-e.txt
3 p+ n5 R! L( C7 ~4 }5 g8 }9 x; ibookname: Babylon German-English , wordcount 164638
) R& \. E6 l' lTotal entries:164638
7 c% U# G/ B1 W' uWarning unknown mark: h (0x68), following content will be ignored.( e! y l" s. E0 B0 s
Summary of ignored marks: K# k7 l0 m$ _8 D4 B
h (0x68) 164638 times
! R+ H- x, Y9 f, I+ L/ lDone!“
! a8 z# H; @ [" C0 Y8 Z& `0 V2 c+ ^
二、用7-zip继续解压NEW_Babylon_German_English_dictionary.dict.dz,得到NEW_Babylon_German_English_dictionary.dict,该.dict文件应该解压在和另外几个文件在同一目录。9 k' W3 G. N7 q' r) f
见图1
6 ?8 Q3 F1 d6 U/ m, G0 f* k
& u+ x5 g/ {6 f- ~& M三、启动CvtStarDict2Txt.exe,选择NEW_Babylon_German_English_dictionary.ifo,再点convert。成功后对话框出现:”Word Count=164638( ^7 o2 f: A! E6 h& M) e
=======; e, a8 n9 ]3 @6 m) ^% @' B5 F$ Z
C:\download\German\stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dictionary.txt
: v; y7 o& H9 a1 t2 I" y cConvert Success!!
( \# j7 N' \/ S( W======“说明转化成功!/ M3 P' l+ B. }& S( ^
见图27 H- w/ T: p. i
/ }' f7 E5 D( x, R! {/ {8 F四、由于要做德英英德双向字典,依样画葫芦下载源转换,得到Babylon_English_German.txt和NEW_Babylon_German_English_dictionary.txt两个文件。
: N$ ?" R% N( q3 Q" H& O+ `7 b, \2 b5 Y
五、这2个txt文件在ultraedit打开,提示”do you want to convert to DOS format“,选是。本来想用copy命令合并这2个txt,但copy命令不知为何只拷贝了部分文件,所以这里用ultraedit全选一个txt全部文本,粘帖在另一个后面(Ctrl+End)。得到一个313468行的文件。
4 c& W( n. j, v# g- ? V
3 P2 |$ P; ?" j! q六、在ultraedit”Ctrl + R“把换行符”^p"替换成“^p</>^p”,如图,选replace All。就是在每一行加上换行及</>(mdict分节号)。
% J1 S& u* h2 D. K2 }4 Z2 C如:0 Q6 u( ` y* d$ s
“abhorrence <font color="blue">n.</font> Abscheu
* o; ?' B) `3 e" B# u! R, jabhorrent <font color="blue">adj.</font> abscheulich”
4 Q+ Y) ]- Q% W3 ~0 _; d
& N: A5 I) b. i; m y, Q" a: O' X将转成:, _ ~! F. r$ {3 i1 R
"abhorrence <font color="blue">n.</font> Abscheu1 D- P6 J+ Z9 j) Y, {4 s
</>, B; S! v, v7 J- S0 P( e1 C
abhorrent <font color="blue">adj.</font> abscheulich
1 D) ?% @: `$ U/ |</>"
9 W6 c# `/ J. h4 H- _% J再用一次替换“Ctrl+R”把 “^t"(Tab)替换成”^p“,转换成:4 l) ]) \/ ~3 e/ K
”abhorrence& | Q) C, L9 |
<font color="blue">n.</font> Abscheu
- S5 P& b/ k, d& U</>
, H% D0 q5 S% Tabhorrent9 D2 ` Q2 m; ~; }" Q2 \ e
<font color="blue">adj.</font> abscheulich
' T8 i8 ^9 v$ G+ `+ b</>“; s- M3 ~* Q. Q$ m1 i# k" T
得到mdx标准txt!存储为DOS Terminators-CR/LF ;UTF-8文件。
) J3 z0 }5 @' ?" r% o& j" Z' ^) y+ K5 P7 z* j4 v2 Z
见图3和图4
2 [- I2 r; `6 }, z- w5 O" Q, B* ~- | y8 W
七、mdxbuilder出动,注意source选txt源文件,target输入生成文件路径和名称,style应选example-style.txt,original format这里选Mdict(Compact HTML),Encoding选UTF-8.7 G* y- B9 y1 w/ v
见图5
5 u2 s3 y2 h# w8 X2 ^: C0 O$ [3 ?
八,完成了,就这么简单
$ V. D) l" s7 ?; [6 @7 g- \见图6( b9 d2 e/ j( r0 c9 I R
0 G1 w! k5 G+ K! h, z
附上几个必须文件:
3 A9 W) j5 y: b" C5 L
" H1 G1 x: Y4 nCvtStarDict2Txt.exe |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|