|
精华文章啊!!实在忍不住从口袋转载了过来:)
+ R [1 N5 r1 V& n+ [
& w) r0 K1 g3 H' P* Y0 D3 I; `原作者:linld97044
4 Y0 K% N0 l6 d" m' M; H内容:" D ~# c: c+ l1 i# h
玩PDA多年,在坛子一向是潜水多贡献少,现在向坛子贡献下做mdict的方法。4 F) L3 h6 K* y$ @# i% V
7 K0 j2 j7 n9 l9 z! R! }- J做专业字典首先的难题是字典源文件,经搜索,看来stardict是比较好的源文件,字典量多货足。可以在以下链接大量下载:/ U+ ^: e0 g+ i4 _
1)http://www.vayn.cn/sundries/files/stardict-dict.htm
2 c# {" x3 V z3 F$ W/ Z% k2)http://reciteword.sourceforge.net/stardict/babylon.php9 @' i( V2 O& f' H! |3 F
3)http://stardict.sourceforge.net/Dictionaries_zh_CN.php- O, \- [+ F0 v9 x! M4 c. X1 B
/ ~' k6 }& S5 h6 ]2 G [1 I6 A. J% ]本问题之前在http://bbs.pdafans.com/thread-608906-1-1.html(mdict自定义尝试-美国传统字典+湘雅医学词典+高级汉语词典3合1的mdict(附方法))中讨论过,现基本已解决,发帖总结下:+ }8 a8 D. J# o4 r9 ? C3 N; |
! v9 O3 F" e& p( ?7 Q6 ^3 s1、根据mdict作者邮件,比较旧的stardict可以用convstar命令转化成txt后用MDXBuilder 2.5 编成mdict的mdx文件。这一步比较简单,之前的帖子也详细说过了。
4 v) u5 Y/ u* w, T* T! g' s. d/ k! J8 }. o9 q$ I
2、第二种情况是stardict后期的词典,用了不同的编码格式,convstar直接转出现下面类似的错误:
. S2 Z/ G( X' h0 R- J3 L6 S4 e: n7 f7 M6 X9 d: f
“Warning unknown mark: k (0x6b), following content will be ignored.' \& N7 a$ R9 ~
Summary of ignored marks:
+ S+ e9 K! g2 S, tk (0x6b) 96281 times9 U' ^. p. K$ A8 i, M6 k
Done!”
" f8 {7 U6 a5 G. g) S
7 |5 A& O0 }2 {3 ?/ U这种情况不能用http://www.octopus-studio.com里的convstar直接转。应做如下处理:* a$ F4 r- w' Y4 q- L
: }& _, k4 s" `: U; V2 s
1)先要用aisnote编写的CvtStarDict2Txt.exe转成txt' E8 C( t$ W1 B8 x+ ~/ ]9 ]6 r
2)txt用ultraedit编辑成mdict标准格式 G3 v* Y7 |2 D5 {: D1 N# H1 N Y
3)用MDXBuilder编成mdx文件。 |" v) x! K8 q& A4 g
8 |: `* [1 o8 o" b. I以stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2为例给大家示范下stardict to mdict的全过程。5 q/ u5 `2 Z* u! M' P$ y; J+ G- W
! O& E0 x) @! r一、下载文件包,得到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四个文件。
9 s' O2 l8 Z0 q, y& I" r% z/ u
5 s- \9 j* I+ T8 X' t9 x注,用convstar,出现下列错误信息,说明convstar不能处理该文件:/ p0 ?* @, B; s/ c* e# {, S
, u, y" x* P# [' X9 f”C:\>C:\download\MdxBuilder\ConvStar\ConvStar.exe C:\download\German\stardict-bab7 U. U' s% [) _
ylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dict
* }8 s) n1 n( F- t: N; Z2 pionary.ifo c:\g-e.txt
7 q b+ S& f+ G5 s9 Gbookname: Babylon German-English , wordcount 164638
$ W% j0 P5 l3 F/ QTotal entries:164638! J v, Z, H4 E) i4 m! B
Warning unknown mark: h (0x68), following content will be ignored.5 }) }+ p6 z' v) K! U
Summary of ignored marks:
& B4 L3 l; R6 p$ b6 S m* D' K( Fh (0x68) 164638 times& x# T* p: z7 \ X8 q8 C4 @
Done!“
7 X( f4 ?9 u6 C0 {% \- f2 X7 P5 a% E' M8 @3 M
二、用7-zip继续解压NEW_Babylon_German_English_dictionary.dict.dz,得到NEW_Babylon_German_English_dictionary.dict,该.dict文件应该解压在和另外几个文件在同一目录。0 Q. g( x* k3 F7 S% e
见图1
: X2 i8 {/ \5 h" D* F. {# I3 j& L* r0 A" [2 R" \0 t
三、启动CvtStarDict2Txt.exe,选择NEW_Babylon_German_English_dictionary.ifo,再点convert。成功后对话框出现:”Word Count=164638+ t2 i- V* W6 E$ h
=======8 l) `7 I; k9 L8 J2 u+ ^# V; b
C:\download\German\stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dictionary.txt ! [/ ?, ^. U( u1 N9 a
Convert Success!!0 \" N) ]- B! N0 Z7 h
======“说明转化成功!
- I; ?6 a: o( X+ Y9 E见图2* ?' C: |/ S3 X. w; E1 s* W
1 _- O! \$ B+ h( \" r6 P四、由于要做德英英德双向字典,依样画葫芦下载源转换,得到Babylon_English_German.txt和NEW_Babylon_German_English_dictionary.txt两个文件。
0 c5 j4 _# _0 W8 j. M/ Q+ K: D# v- o6 H% L8 _! P+ W
五、这2个txt文件在ultraedit打开,提示”do you want to convert to DOS format“,选是。本来想用copy命令合并这2个txt,但copy命令不知为何只拷贝了部分文件,所以这里用ultraedit全选一个txt全部文本,粘帖在另一个后面(Ctrl+End)。得到一个313468行的文件。' h1 @7 c- v3 ~6 t/ U% K
( L/ M' m/ [- d& L8 D六、在ultraedit”Ctrl + R“把换行符”^p"替换成“^p</>^p”,如图,选replace All。就是在每一行加上换行及</>(mdict分节号)。
1 t* A- W* e1 I+ I如:& q% D3 c6 [3 j: V
“abhorrence <font color="blue">n.</font> Abscheu, J$ ?9 k, Z" b; b, J
abhorrent <font color="blue">adj.</font> abscheulich”9 }( F: ]& }% R. V8 P* n
# {! i- N$ C, r将转成:
% [/ \+ c2 q+ Z1 y4 m, b"abhorrence <font color="blue">n.</font> Abscheu }( T L1 o! B5 Z/ N. `- M
</>1 P5 v/ s, X" [0 s8 ~- x9 \( }( ^
abhorrent <font color="blue">adj.</font> abscheulich
; x9 X, x" F0 \7 X& I</>"- K1 x' \+ ?5 P% v: k2 H o
再用一次替换“Ctrl+R”把 “^t"(Tab)替换成”^p“,转换成:
9 h: U0 H. \& B2 D1 T”abhorrence# |2 B2 N$ Q/ l& p6 u, V/ n& q# P! k5 t
<font color="blue">n.</font> Abscheu
1 Y+ a. B$ a4 I% z! m5 ]0 f</>& Y* ]# r, s. z" W c% |
abhorrent1 p# J' b0 r$ P6 T& Y5 K* V
<font color="blue">adj.</font> abscheulich# F* N7 j+ K) i4 z0 D
</>“, N+ |8 k R+ {( Q% H
得到mdx标准txt!存储为DOS Terminators-CR/LF ;UTF-8文件。8 j' W% l2 ^. @- V9 m' R& `
0 v) u5 L9 Q2 W2 x- a/ W
见图3和图4
; p" F: z3 v, b% ?! g; z9 o$ P- {1 ?( ^$ P: p; X- v
七、mdxbuilder出动,注意source选txt源文件,target输入生成文件路径和名称,style应选example-style.txt,original format这里选Mdict(Compact HTML),Encoding选UTF-8.% f' `/ ?! k0 j, ^
见图5$ I" E, I. a5 ~( b% k+ n% j( w
, E" }$ Z ]- m s \& ]0 _
八,完成了,就这么简单+ i$ H$ [, }; p+ ~2 E
见图6
3 Z1 ?; M# U- L% U: N' o0 A
) v7 j( G# ~: g6 `# t( d附上几个必须文件:; v1 ?& x% o! L5 m* f1 v! ^) W
+ M; x$ Q: h9 ~9 w' ?
CvtStarDict2Txt.exe |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|