纯PHP编写的xdb词典(SCWS -
http://www.ftphp.com/scws 所采用)导入导出工具!!
1. 词典导出:dump_xdb_file.php 在命令行模式下运行
php dump_xdb_file.php <要导出的.xdb文件> [存入的文本文件]
第二参数省略则直接输出到标准输出。
2. 词典生成:make_xdb_file.php 同样是在命令行模式下运行(需要安装 mbstring 扩展)
默认是处理 gbk 编码的文本,如果你的文本是 utf8,则需要修改该程序的第一行,把
define('IS_UTF8_TXT', false); 改为 true
php make_xdb_file.php <要生成的.xdb> [导入的文本文件]
---
关于文本文件的说明,每行一条记录,#开头表示注释,每条记录由
word、TF、IDF、Attr组成,其中TF是词频系数,IDF是逆词频率系数
而Attr是北大标注法的词性,这四个字段之间用\t隔开。
---
hightman 特别制作于 2009.7.1
下载地址:http://www.ftphp.com/scws 或
http://www.hightman.cn/bbs 的 scws 版
非常兴奋!
今天上来网站看,发现你已经做好了这个工具,还没测试,先赞一下。
站长真是给人意外惊喜,马上试试先。
发现以下错误,不过应该没有大问题,另我不是在命令行方式执行的:
Notice: Undefined variable: mask in C:\wamp\www\pscws4\etc\xdb.class.php on line 138
Warning: fread() [function.fread]: Length parameter must be greater than 0 in C:\wamp\www\pscws4\etc\xdb.class.php on line 612
Warning: unpack() [function.unpack]: Type I: not enough input, need 4, have 0 in C:\wamp\www\pscws4\etc\xdb.class.php on line 613
Notice: Undefined index: klen in C:\wamp\www\pscws4\etc\xdb.class.php on line 633
Notice: Undefined index: klen in C:\wamp\www\pscws4\etc\xdb.class.php on line 634
Warning: fread() [function.fread]: Length parameter must be greater than 0 in C:\wamp\www\pscws4\etc\xdb.class.php on line 638
Notice: Undefined index: llen in C:\wamp\www\pscws4\etc\xdb.class.php on line 322
Notice: Undefined index: rlen in C:\wamp\www\pscws4\etc\xdb.class.php on line 327
Warning: unpack() [function.unpack]: Type I: not enough input, need 4, have 0 in C:\wamp\www\pscws4\etc\xdb.class.php on line 613
Notice: Undefined index: klen in C:\wamp\www\pscws4\etc\xdb.class.php on line 633
Notice: Undefined index: klen in C:\wamp\www\pscws4\etc\xdb.class.php on line 634
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1642825009 bytes) in C:\wamp\www\pscws4\etc\xdb.class.php on line 638
我这台电脑只有512M,是不是这个原因呢?
生成字典时,发现mbstring exteions没有装好,搞了半天都没有装上,正研究中...
可能你的词典文件错误或被篡改过导致的错误吧. 不然不会有这么多的内存需求.
Notice: Undefined variable: mask in C:\wamp\www\pscws4\etc\xdb.class.php on line 138
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1642825009 bytes) in C:\wamp\www\pscws4\etc\xdb.class.php on line 638
这两个问题我试过多次,还是有的,麻烦站长看看,内存不够的问题到底是什么原因啊。
(2009-07-18 05:22 PM)heraldboy 提到: [ -> ]Notice: Undefined variable: mask in C:\wamp\www\pscws4\etc\xdb.class.php on line 138
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1642825009 bytes) in C:\wamp\www\pscws4\etc\xdb.class.php on line 638
这两个问题我试过多次,还是有的,麻烦站长看看,内存不够的问题到底是什么原因啊。
把 xdb.class.php Line 138 的 $mask 改成 $prime