|
|
发表于 2005-5-7 19:30:10
|
显示全部楼层
自制'翻译软件'
..用look程序的查询功能, 修改字典文件, 可作简单词汇翻译.
1. 查找look的字典文件.
$ man look
....................
FILES
/usr/share/dict/words the dictionary
....................
修改权限, 创建操作目录
$ su -
# mkdir ./looktmp
# ls -l /usr/share/dict/
# cp /usr/share/dict/linux.words ./looktmp/w-words
安装文本格式转换的工具
# rpm -ivh [path]/dos2unix-3.1-10.i386.rpm
# rpm -ivh [path]/unix2dos-2.2-15.i386.rpm
# cd ./looktmp
# unix2dos w-words
# mv w-words w-words.txt
把 w-words.txt 文件在windows 平台上, 用翻译软件进行翻译, 操作如下:
windows平台--翻译软件--打开文件--视图--按行断句--翻译--导出--中文译文(word-yi.txt)--确定
把 word-yi.txt 放回linux平台
# cp [path]/word-yi.txt /root/looktmp/
# cd /root/looktmp
# dos2unix ./*.txt
# ls
word-yi.txt w-words.txt
# wc -l word-yi.txt ; wc -l w-words.txt
45427 word-yi.txt
45427 w-words.txt
[ 假如行数不等, 就要从头进行. 要点: 字典文件w-words.txt中以'-'结尾的单词, 如: Ibero- 改成 Ibero . 或者把空行删除. ]
把两个文件合并
# paste w-words.txt word-yi.txt > wei-words
# cp ./wei-words /usr/share/dict/
# cd /usr/share/dict/
# rm words
# ln -s wei-words words
测试:
# look SYnoPSIS
synopsis 提要
--
-- |
|