|
|
精华文章啊!!实在忍不住从口袋转载了过来:) . t' M8 m. ]! p' k5 A0 K
: i& a7 E p2 @6 E& X# k* V I3 V
原作者:linld97044
& d9 ]) {% R! Q5 j; N" i" r3 H内容:. X O" j9 H2 A! d9 e
玩PDA多年,在坛子一向是潜水多贡献少,现在向坛子贡献下做mdict的方法。
( ~4 k) U/ }1 f# ?
. `, r- K2 X; Z: U7 J8 P做专业字典首先的难题是字典源文件,经搜索,看来stardict是比较好的源文件,字典量多货足。可以在以下链接大量下载:% j# Y" l/ s2 \0 m* n
1)http://www.vayn.cn/sundries/files/stardict-dict.htm/ n5 t" d" E: o
2)http://reciteword.sourceforge.net/stardict/babylon.php
$ Q( I/ y0 M: t) F1 E1 m$ L9 F3)http://stardict.sourceforge.net/Dictionaries_zh_CN.php8 E( P1 w: z$ l+ N# Y3 ^
# H4 o A# V) d+ K' }* @
本问题之前在http://bbs.pdafans.com/thread-608906-1-1.html(mdict自定义尝试-美国传统字典+湘雅医学词典+高级汉语词典3合1的mdict(附方法))中讨论过,现基本已解决,发帖总结下:
1 I/ Z6 X* g+ d' W/ n( E
' C! v5 m$ Q3 K& @+ K1、根据mdict作者邮件,比较旧的stardict可以用convstar命令转化成txt后用MDXBuilder 2.5 编成mdict的mdx文件。这一步比较简单,之前的帖子也详细说过了。4 |8 b. l( t& H6 r( Y/ f) | s X
! U2 _; d' L& v, X8 m$ \2、第二种情况是stardict后期的词典,用了不同的编码格式,convstar直接转出现下面类似的错误:
: r/ Q |% O2 n. P! p$ n+ K# Q7 Z* d3 e" ]! {7 b9 a9 _
“Warning unknown mark: k (0x6b), following content will be ignored.6 M3 {: U1 O& j! Z
Summary of ignored marks:
' O' F4 X5 z8 S/ n" Lk (0x6b) 96281 times7 p: I4 j( c$ Q/ S
Done!”
+ s+ n$ K2 R/ I4 L! r4 y' {9 W6 { j% ]' O, h+ [
这种情况不能用http://www.octopus-studio.com里的convstar直接转。应做如下处理:
/ j& e" ~6 g0 V% V% w8 i' x0 b* K% S
1)先要用aisnote编写的CvtStarDict2Txt.exe转成txt# r% O" H8 N f
2)txt用ultraedit编辑成mdict标准格式
9 K8 M# c1 L! _# t3)用MDXBuilder编成mdx文件。& c4 V$ @ m" p; [4 Z
, P3 ~ |. J$ G2 e以stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2为例给大家示范下stardict to mdict的全过程。
/ U/ {) q! w: Q; ^" l
$ b5 `0 w5 l6 c一、下载文件包,得到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, x `& k1 m) f: c; A8 M
% n$ r: L! l* o, l/ O& ?1 |- G注,用convstar,出现下列错误信息,说明convstar不能处理该文件:
, [7 u$ z6 n# | `# f6 W, P! V$ L# x
6 v9 {9 k& a, J”C:\>C:\download\MdxBuilder\ConvStar\ConvStar.exe C:\download\German\stardict-bab1 Q M, O' c( W' n6 U* v
ylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dict( K. l, S1 S9 {) f. {& G. \& z
ionary.ifo c:\g-e.txt
* ~7 v+ N: H6 [/ Sbookname: Babylon German-English , wordcount 164638
/ I: A- O0 B) k' d4 c, d! FTotal entries:164638( z% W& ?! Q+ I' D
Warning unknown mark: h (0x68), following content will be ignored.
. v# y% }9 _- {& w' P3 VSummary of ignored marks:
4 L: c0 A6 P( z1 {# @6 mh (0x68) 164638 times
5 I# [- I6 f: J: Y6 e C1 WDone!“6 Y0 x: I8 G, g2 K% [( Z# g
4 j, [0 @7 ~( s6 V
二、用7-zip继续解压NEW_Babylon_German_English_dictionary.dict.dz,得到NEW_Babylon_German_English_dictionary.dict,该.dict文件应该解压在和另外几个文件在同一目录。
& G6 p+ g, P. Q2 o' n见图1
- z* Q9 j7 l3 C* K! u$ {& j: ~
: T8 a$ q: i1 v, T) L三、启动CvtStarDict2Txt.exe,选择NEW_Babylon_German_English_dictionary.ifo,再点convert。成功后对话框出现:”Word Count=164638' i& f. C/ A0 ]( t: F8 D$ l
=======5 I. T- l% ?1 K7 ]1 W/ f7 L. r9 i
C:\download\German\stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dictionary.txt
& r3 d0 D. {) o# Y; P# J1 HConvert Success!!
" d2 ?! h0 m3 P4 J/ z, W======“说明转化成功!
# U5 g" ^! q) N) m% U7 T( r见图20 X8 |8 r/ P' i' Z7 |/ z/ b
- f, f- M, u% B% v5 Z3 g四、由于要做德英英德双向字典,依样画葫芦下载源转换,得到Babylon_English_German.txt和NEW_Babylon_German_English_dictionary.txt两个文件。
0 k) P; l4 d4 q$ C
) q9 S2 i1 O3 a; k# b6 ]) j五、这2个txt文件在ultraedit打开,提示”do you want to convert to DOS format“,选是。本来想用copy命令合并这2个txt,但copy命令不知为何只拷贝了部分文件,所以这里用ultraedit全选一个txt全部文本,粘帖在另一个后面(Ctrl+End)。得到一个313468行的文件。
6 V0 O+ G1 h. m/ b
( H; A6 Q, D2 m) V" ]: N六、在ultraedit”Ctrl + R“把换行符”^p"替换成“^p</>^p”,如图,选replace All。就是在每一行加上换行及</>(mdict分节号)。2 g+ M- G; X6 L: h' U
如:
: g+ h* n! K: U* ^- n5 i“abhorrence <font color="blue">n.</font> Abscheu
. Z6 S# v, v6 z# `2 xabhorrent <font color="blue">adj.</font> abscheulich”7 S& d7 n- }! B+ V$ q2 h
$ L, [0 v/ v; D0 \! B, H
将转成:
/ g8 \0 u7 q9 i- U6 V0 `5 l"abhorrence <font color="blue">n.</font> Abscheu9 H/ B/ P% Y. R3 a1 @
</>
+ o0 U# C" y$ J0 W( rabhorrent <font color="blue">adj.</font> abscheulich
; o# b: W' l0 m4 D2 w% i</>"
7 q& H, q, l& h ^$ t再用一次替换“Ctrl+R”把 “^t"(Tab)替换成”^p“,转换成:
% k8 A7 R5 F% i% v9 m" t, t”abhorrence
8 y" L1 j8 U4 }0 W9 E<font color="blue">n.</font> Abscheu
& [5 @; s. ?- T% o4 Y b</>
' S: z0 y9 H" F/ w. t, [/ S+ |abhorrent) R2 b$ R( N3 p; p
<font color="blue">adj.</font> abscheulich9 ?1 R9 Q$ `6 ^5 R2 @" J0 T8 @
</>“: A. e* r5 S2 E' i- V; e- V
得到mdx标准txt!存储为DOS Terminators-CR/LF ;UTF-8文件。
% K" s* P R, e: ^; z# X/ R$ V& D- c0 u
见图3和图4( k7 e( {+ q: ]- g" ?/ U! L
@, W2 ^2 c6 n- W七、mdxbuilder出动,注意source选txt源文件,target输入生成文件路径和名称,style应选example-style.txt,original format这里选Mdict(Compact HTML),Encoding选UTF-8.; v Y/ c/ @2 I( S" X& `
见图5
5 h) O' l; [, n# E( @1 b+ p3 e% P
8 }: W) m$ ~7 V; ? }8 f% e八,完成了,就这么简单7 |* j% _' h% k2 e U5 v, a
见图6% p5 C2 N! w% v; ^! r. d1 t* F
7 _" A! O2 F/ T. q7 B附上几个必须文件:$ ]% t( X/ g* k5 j/ a
( U6 r1 n$ y1 m0 o6 s2 p! X& }* N
CvtStarDict2Txt.exe |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|