|
精华文章啊!!实在忍不住从口袋转载了过来:) ) B- B% F: b e" x
, L/ G" B; S9 B# S' z( Z- p
原作者:linld97044, f/ h/ [( O, F- \; k n( ?; H
内容:+ }* ~7 y# }6 g7 H. N, n
玩PDA多年,在坛子一向是潜水多贡献少,现在向坛子贡献下做mdict的方法。
1 z4 B; q1 N5 f
% [, x+ s+ z- d! f% \0 E/ H: U做专业字典首先的难题是字典源文件,经搜索,看来stardict是比较好的源文件,字典量多货足。可以在以下链接大量下载:
( g4 ~" k1 ~$ Y, ~0 `! }% K% O. N1)http://www.vayn.cn/sundries/files/stardict-dict.htm2 T% t3 R+ t, ]' a2 D
2)http://reciteword.sourceforge.net/stardict/babylon.php
, h4 A( x! V' Z$ z3)http://stardict.sourceforge.net/Dictionaries_zh_CN.php
$ @. g( i; U& ]4 \$ h
+ p+ S% a9 `- K0 ^本问题之前在http://bbs.pdafans.com/thread-608906-1-1.html(mdict自定义尝试-美国传统字典+湘雅医学词典+高级汉语词典3合1的mdict(附方法))中讨论过,现基本已解决,发帖总结下:' `8 j4 N' G! y& d
+ H* q) y6 R- x3 Q$ i! l. w: u. {+ `1、根据mdict作者邮件,比较旧的stardict可以用convstar命令转化成txt后用MDXBuilder 2.5 编成mdict的mdx文件。这一步比较简单,之前的帖子也详细说过了。
! e" w9 K' i2 f) T( n0 L) m1 w. l2 n" U1 R& L
2、第二种情况是stardict后期的词典,用了不同的编码格式,convstar直接转出现下面类似的错误:: x; y C3 e$ ?' y
9 \0 W3 z% w! g# Q8 F“Warning unknown mark: k (0x6b), following content will be ignored.; Z# W: d; }' Y: H2 v) U
Summary of ignored marks:
1 } P0 V0 G9 s/ Y7 o; P6 U) Zk (0x6b) 96281 times
$ d2 \: Q! O9 W5 I$ q) D6 { zDone!”
6 p) E8 {5 x6 R$ Z) s
% c9 a& C+ `( `1 k8 T3 `这种情况不能用http://www.octopus-studio.com里的convstar直接转。应做如下处理:, u6 X* v$ @/ f. N- R. G4 B3 |
2 q1 [( d% {! q- E( I. z. Z6 w1)先要用aisnote编写的CvtStarDict2Txt.exe转成txt0 n! x- t2 r" ]" A5 C: p
2)txt用ultraedit编辑成mdict标准格式
. p' A+ N8 Z, C, i3)用MDXBuilder编成mdx文件。
4 I3 X- k) _; d8 Q# ?, \) @$ V' g- Z) Q5 @" F( |( A6 e/ n
以stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2为例给大家示范下stardict to mdict的全过程。: B% p) y' `0 F `- J
& I9 B; }+ W! O0 x3 a8 `: ]- S& 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四个文件。+ J* W8 O% J7 ]% T% N4 Z
/ i" k: L% V! X1 P) M* P, Q( W注,用convstar,出现下列错误信息,说明convstar不能处理该文件:* V2 r- K) d M' X
0 b" E% X3 T3 m& R. `( s”C:\>C:\download\MdxBuilder\ConvStar\ConvStar.exe C:\download\German\stardict-bab& I4 g4 y# K, M% ?' w5 l: y" F8 U |
ylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dict6 C- _0 O6 O& ^ m6 v
ionary.ifo c:\g-e.txt7 N/ |- x) s5 |# x- `
bookname: Babylon German-English , wordcount 164638
$ N) d! D7 p& A. e' g, STotal entries:164638
+ `% h% Y5 y/ Y4 k% x4 MWarning unknown mark: h (0x68), following content will be ignored.
8 C1 s9 p/ L/ Y+ x8 vSummary of ignored marks:
' N' U1 l: I0 ]! n0 Ph (0x68) 164638 times; C, |# ^( t5 v3 [ e' t
Done!“
2 N5 v9 Y2 k6 g# C5 A- R# {- Z3 n: v ?& [& I( X7 e4 Q4 p
二、用7-zip继续解压NEW_Babylon_German_English_dictionary.dict.dz,得到NEW_Babylon_German_English_dictionary.dict,该.dict文件应该解压在和另外几个文件在同一目录。
# a" z0 B) @* D7 q+ g1 \见图1
; T# ?, X& u" e$ o$ D9 l; R: }- _3 H9 Q3 ?
三、启动CvtStarDict2Txt.exe,选择NEW_Babylon_German_English_dictionary.ifo,再点convert。成功后对话框出现:”Word Count=164638! g( u. W/ B8 ~4 a5 x
=======. D$ P( b6 `* a( n5 J' h0 o# f
C:\download\German\stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dictionary.txt 1 k, c( N# O, G3 o* n" Y
Convert Success!!
2 s( c3 }" h- h======“说明转化成功!6 B6 @6 W, u( o- y* v3 z
见图2
" d7 l1 b& O1 E$ R& ^% l- \7 R
3 f# M, u1 @$ a: i) n, Q四、由于要做德英英德双向字典,依样画葫芦下载源转换,得到Babylon_English_German.txt和NEW_Babylon_German_English_dictionary.txt两个文件。9 R6 _: h2 C0 Z
) k4 g1 v! m6 _" c. y9 t$ f8 s9 s
五、这2个txt文件在ultraedit打开,提示”do you want to convert to DOS format“,选是。本来想用copy命令合并这2个txt,但copy命令不知为何只拷贝了部分文件,所以这里用ultraedit全选一个txt全部文本,粘帖在另一个后面(Ctrl+End)。得到一个313468行的文件。4 @2 U, j0 l+ e8 R1 X
" F* `, w5 k. N# d A
六、在ultraedit”Ctrl + R“把换行符”^p"替换成“^p</>^p”,如图,选replace All。就是在每一行加上换行及</>(mdict分节号)。
% S3 [* u6 Q+ F$ |" h1 I: u" C2 y如:
4 o' A L& A/ O& s“abhorrence <font color="blue">n.</font> Abscheu1 J+ g- r/ n" h6 _( u6 G
abhorrent <font color="blue">adj.</font> abscheulich”
2 m* h! Q# W% k; L
' I+ j9 `1 Z; _; k将转成:7 a- R/ S; i; j. n" d7 K. [( l
"abhorrence <font color="blue">n.</font> Abscheu
7 l( M0 \" Q: U) a" o& J</>
6 g: z: d/ |# W' Habhorrent <font color="blue">adj.</font> abscheulich6 K. d# b/ ]( i
</>"
5 i1 ?8 o3 ~8 z5 _9 d再用一次替换“Ctrl+R”把 “^t"(Tab)替换成”^p“,转换成:- u0 s8 c- C9 _2 _( i
”abhorrence0 ] h4 s0 p2 F
<font color="blue">n.</font> Abscheu2 S8 c$ N6 i% ?. R
</>+ ~' w }( g2 ]5 ^$ I
abhorrent+ U7 R6 l4 E3 d. F$ t
<font color="blue">adj.</font> abscheulich" C I9 ]% p4 U' F9 R
</>“
4 C; ^6 y" n) T/ E得到mdx标准txt!存储为DOS Terminators-CR/LF ;UTF-8文件。
m! D8 h4 O6 ^! F+ n- z5 U8 T0 M8 n. V
见图3和图47 [- x9 C, G+ n+ C9 g
! x Y7 _: P0 A: v1 m
七、mdxbuilder出动,注意source选txt源文件,target输入生成文件路径和名称,style应选example-style.txt,original format这里选Mdict(Compact HTML),Encoding选UTF-8.# R8 d, D9 p) T2 Y' o: X
见图59 r+ H, C$ e/ K; h8 K; Z2 I2 T5 \
# k# E! Z/ Q* [7 [% u八,完成了,就这么简单% u$ Y# E/ w2 {1 ?4 S
见图6( y; r& X8 u3 \2 K% r" |0 A
! |# _/ K5 |1 V" x
附上几个必须文件:& h4 q* v# O% A+ O# b! L
3 k2 K$ O3 \8 b( J }9 K* M7 ]CvtStarDict2Txt.exe |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|