ECDICT
ECDICT copied to clipboard
How To Convert `stardict.csv` To `stardict.db`?
This piece works well:
srcname = ur"bnc-words.csv"
dstname = ur"bnc-words.sqlite"
convert_dict(dstname, srcname)
Differ from the file stardict.csv which was extracted from stardict.7z:
srcname = ur"stardict.csv"
dstname = ur"stardict.sqlite"
convert_dict(dstname, srcname)
thrown an MemoryError:
thrown same error when running a command-line,:

词典太大,内存爆掉了,csv格式的词典会全部载入内存再开始转换,你需要 64位 python来跑这个操作。
32位python再 windows下只能用 2G的内存,很多工作都不够用。你可以单独下载一个 64位的 python,放在一个单独的地方,转换完以后你又可以用回你的 32位版本了。
You are so great! Thank you for your advice!
After switching the platform to python3.5 x64 + Windows8 x64 this don't throw error anymore!
You’re the best githuber ever!

我Win7 32bit上面用下面的方法转
import stardict stardict.convert_dict(r'C:\Users\i\Downloads\ECDICT-master\stardict.csv', r'C:\Users\i\Downloads\ECDICT-master\stardict.sqlite')
最终stardict.sqlite只有10kb,这是不是也是同样的问题?
另外,谁能分享个能用的stardict.sqlite来,谢谢
stardict.convert_dict(r'C:\Users\i\Downloads\ECDICT-master\stardict.csv', r'C:\Users\i\Downloads\ECDICT-master\stardict.db')
后缀名用 .db
@skywind3000 谢谢,我改了,还是没用,最终stardict.db只有10kb
stardict.convert_dict(r'C:\Users\i\Downloads\ECDICT-master\stardict.db', r'C:\Users\i\Downloads\ECDICT-master\stardict.csv')
不好意思,我写反了,你的 stardict.csv 可能被破坏了,重新恢复一下。
谢谢大哥,我建议你交换下参数位置比较自然,如 stardict.convert_dictk(from,to)
@skywind3000 转出来有810MB,太大了,是否有什么方法可以减小点?
sqlite就是那么大啊
@skywind3000 我用这个工具 https://github.com/mmjang/mdict-query 调用本项目的“简明增强-css”词典,最终转出来的文件concise-enhanced.mdx和concise-enhanced.mdx.db共有375MB,一下子小了好多,太棒了
嗯,挺好。