|
精华文章啊!!实在忍不住从口袋转载了过来:)
8 S; U' P* k0 x/ i# e9 @% }7 J) ?! |) Y) m! R/ S: ~/ T3 _
原作者:linld97044 J8 n( `% F; h: ~
内容:
* f+ A; B6 K: r2 y; g玩PDA多年,在坛子一向是潜水多贡献少,现在向坛子贡献下做mdict的方法。
$ q4 e) X- B- p! H& w; K0 ^0 A, o X- k% H% ^, G8 p
做专业字典首先的难题是字典源文件,经搜索,看来stardict是比较好的源文件,字典量多货足。可以在以下链接大量下载:
$ y" o. f1 L% H2 r( U; |" S$ F0 X9 r1)http://www.vayn.cn/sundries/files/stardict-dict.htm& T! Z1 `4 Y9 F+ V. ^& |6 B4 J0 W4 i
2)http://reciteword.sourceforge.net/stardict/babylon.php4 |$ C2 ]0 i" Z3 ~, V
3)http://stardict.sourceforge.net/Dictionaries_zh_CN.php& K) N2 Z `' p: |; T
7 M: t. y8 W' D本问题之前在http://bbs.pdafans.com/thread-608906-1-1.html(mdict自定义尝试-美国传统字典+湘雅医学词典+高级汉语词典3合1的mdict(附方法))中讨论过,现基本已解决,发帖总结下:
. o! j2 \! |7 o: f( Z+ x* X0 J$ ^" {0 {% J
1、根据mdict作者邮件,比较旧的stardict可以用convstar命令转化成txt后用MDXBuilder 2.5 编成mdict的mdx文件。这一步比较简单,之前的帖子也详细说过了。
0 z% i8 H* r, M7 ]1 e! r/ S3 d% P- f4 U4 L
2、第二种情况是stardict后期的词典,用了不同的编码格式,convstar直接转出现下面类似的错误:4 X$ g; n* [# x; A, W: E5 |3 C
* W& ^" _- q( p( q5 J“Warning unknown mark: k (0x6b), following content will be ignored.
' e$ D6 |" u8 J1 C6 CSummary of ignored marks:6 a! i2 Y6 g6 Q5 V: \- d
k (0x6b) 96281 times
7 p& s4 D7 m+ B1 `4 {5 [8 M6 m9 bDone!”
8 K2 N+ b; W6 R4 [* Q C" F/ U
2 \. q! Y$ d& S: C( m9 P+ f这种情况不能用http://www.octopus-studio.com里的convstar直接转。应做如下处理:
: W# w4 d6 Y% @$ u
1 A3 q) l/ }/ i1 u# z4 r1)先要用aisnote编写的CvtStarDict2Txt.exe转成txt
4 x3 j( |- l% d8 ]1 \6 P \# {2)txt用ultraedit编辑成mdict标准格式
# M, ^0 w7 E! [ D; V3)用MDXBuilder编成mdx文件。5 N& I- m6 {: R# P
6 R1 s# S' e8 a$ v
以stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2为例给大家示范下stardict to mdict的全过程。# b; r6 |$ A! j4 L! Z8 U
' v/ y/ c, ]" Y6 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四个文件。
& c& P9 V% E8 N; {) @0 g2 O9 H+ C: J$ {3 F1 e" X: J; @
注,用convstar,出现下列错误信息,说明convstar不能处理该文件:
0 v) @! L1 J7 {, N; P6 B% r, R& a, x5 t* E# \7 w4 ~ f
”C:\>C:\download\MdxBuilder\ConvStar\ConvStar.exe C:\download\German\stardict-bab6 v7 X9 o. L8 S* l0 K/ c# l
ylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dict* `+ r" Y) t' d) D6 c1 c: W9 m% S5 n
ionary.ifo c:\g-e.txt3 S- b5 p( C- \
bookname: Babylon German-English , wordcount 164638
S! U6 Z5 m0 d/ oTotal entries:164638: F3 S( `0 _$ x. g
Warning unknown mark: h (0x68), following content will be ignored.
8 C# w p0 |* h$ t, oSummary of ignored marks:
' _* r& `3 Z7 C( K$ U) Y$ S' th (0x68) 164638 times
6 v* N$ d) E% D% wDone!“
) e: Q2 J& ]" t4 P; z* I, q
* t4 i6 @1 n" Z4 G, }5 X二、用7-zip继续解压NEW_Babylon_German_English_dictionary.dict.dz,得到NEW_Babylon_German_English_dictionary.dict,该.dict文件应该解压在和另外几个文件在同一目录。
; P# k7 y4 {1 ?见图1
! |( N# K$ R' ]0 O% V6 g+ Y0 f2 {
三、启动CvtStarDict2Txt.exe,选择NEW_Babylon_German_English_dictionary.ifo,再点convert。成功后对话框出现:”Word Count=164638$ u) g" L! \5 \1 `3 ~% S' w9 l
=======
* Q( e" D* t) N" d0 \2 _9 YC:\download\German\stardict-babylon-NEW_Babylon_German_English_dictionary-2.4.2\NEW_Babylon_German_English_dictionary.txt
2 q0 O! e+ m1 x/ rConvert Success!!
/ k9 C! L( @- R y0 m) g0 J# H* ^======“说明转化成功!" @2 i4 E$ E6 F0 @0 Y, ? x% k2 e ]
见图2' b y+ R [( |! @+ L9 l. i
# Y0 o# @# Z' E: N7 O, I" z四、由于要做德英英德双向字典,依样画葫芦下载源转换,得到Babylon_English_German.txt和NEW_Babylon_German_English_dictionary.txt两个文件。
0 l& R6 e, D' e. v' t) w" { s4 @; D; R4 X" a
五、这2个txt文件在ultraedit打开,提示”do you want to convert to DOS format“,选是。本来想用copy命令合并这2个txt,但copy命令不知为何只拷贝了部分文件,所以这里用ultraedit全选一个txt全部文本,粘帖在另一个后面(Ctrl+End)。得到一个313468行的文件。0 O+ ~, K9 A# D6 m" j& |
/ N/ i; @) ]: \+ I# o) Y" q六、在ultraedit”Ctrl + R“把换行符”^p"替换成“^p</>^p”,如图,选replace All。就是在每一行加上换行及</>(mdict分节号)。
! T7 F. Z" L( R" L8 X2 [& L, i; i如:
- ?- Y5 N' U) e9 B0 H$ k' o- F“abhorrence <font color="blue">n.</font> Abscheu
( o% a5 w2 z0 u6 E/ H% aabhorrent <font color="blue">adj.</font> abscheulich”
9 j9 J" c2 h. ]$ G' W
r' S8 f: I: R" o将转成:
5 w1 r$ j1 `0 }( q4 i, t* U9 Q"abhorrence <font color="blue">n.</font> Abscheu" X6 h' w' C/ n
</>5 W! Y: b* X- w$ b. e
abhorrent <font color="blue">adj.</font> abscheulich: O$ H9 e3 f' z
</>"% v1 O" Q, @6 v% G
再用一次替换“Ctrl+R”把 “^t"(Tab)替换成”^p“,转换成:: y5 f4 [4 Z0 P) e
”abhorrence
; T+ t4 _6 ]8 |<font color="blue">n.</font> Abscheu! u5 R7 P9 m: D& \
</>
, o, I2 q( X& B+ o& zabhorrent
' E0 x% @! s8 X; e; B j<font color="blue">adj.</font> abscheulich% l2 o& X s% d6 e V1 N! n' E* x
</>“ k; R/ b' P6 }6 o3 Z
得到mdx标准txt!存储为DOS Terminators-CR/LF ;UTF-8文件。) y, j% I# h9 _% l% N# e
* o' N! e# O* w" e3 s3 p
见图3和图4
2 c, U2 J% Z: Z5 d4 ^5 h _, H5 ]% I! ]* W5 M; u: @( g
七、mdxbuilder出动,注意source选txt源文件,target输入生成文件路径和名称,style应选example-style.txt,original format这里选Mdict(Compact HTML),Encoding选UTF-8.
6 {8 b) T2 \5 I* O3 _) q见图57 X5 L7 H, ~( M7 e0 T
. G5 C8 ~ u9 j$ z X" k
八,完成了,就这么简单
1 X1 X w, Y* z' s+ k0 c见图6' V! t' s% Z+ c- E
& a& H/ R* I$ c* w G3 g% L附上几个必须文件:) |/ I7 P) E1 q' L
' C+ F& g1 M. s2 \* t) Y& A* x4 S
CvtStarDict2Txt.exe |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|