Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用户自定义词典添加的路径问题 #38

Closed
jamesDeng opened this issue May 16, 2013 · 6 comments
Closed

用户自定义词典添加的路径问题 #38

jamesDeng opened this issue May 16, 2013 · 6 comments

Comments

@jamesDeng
Copy link

1:建议将加载的根改在classes下就和library.properties加载路径一样就好,放在项目根下不加加载特别是用到maven测试的时候我不管放那它好像都无法加载到。

PS:如果能改成maven项目就更加好了,这个方便

2:如路径是文件夹时加载文件夹下的dic文件这个功能有bug,它和我指定一个文件分词出的结果是不一样的代码如下:

    MyStaticValue.userDefinePath="E:/library/userLibrary.dic";
    Analysis udf = new ToAnalysis(new StringReader("土建工程师反遭毒手城市规划师龟龙麟凤T恤B超龚鼎重写了"));
    Term term = null ;
    List<Term> list=new ArrayList<Term>();
    while((term=udf.next())!=null){
        //term.getTermNatures().
        //System.out.print(term.getName()+" "+nature);
        list.add(term);
    }
    new NatureRecognition(list).recognition() ;
    for (Term term2 : list) {
        System.out.println(term2.getName()+":"+term2.getNatrue().natureStr +" ");
    }

结果是:
土建工程师:n
反遭毒手:v
城市规划师:n
龟龙麟凤:ns
t:en
恤:nr
b:en
超:v
龚鼎:nr
重写:v
了:ul

如改成:
MyStaticValue.userDefinePath="E:/library"
结果是:
土建:n
工程师:n
反:v
遭:v
毒手:n
城市:n
规划师:n
龟:n
龙麟凤:nr
t:en
恤:nr
b:en
超:v
龚鼎:nr
重写:v
了:ul

这明显不是我想要的....

@ansjsun
Copy link
Member

ansjsun commented May 16, 2013

@jamesDeng
Copy link
Author

加载方式我是看过的,还是觉得很不方便.....

我说的第二个问题是加载文件和加载文件夹出来的分词效果是不一样的

@ansjsun
Copy link
Member

ansjsun commented May 17, 2013

第二个用文件夹方式加载..词典文件的后缀必须是dic

On 2013-5-17, at 下午3:14, jamesDeng notifications@github.com wrote:

加载方式我是看过的,还是觉得很不方便.....

我说的第二个问题是加载文件和加载文件夹出来的分词效果是不一样的


Reply to this email directly or view it on GitHub.

@jamesDeng
Copy link
Author

例子里的
MyStaticValue.userDefinePath="E:/library/userLibrary.dic";
我是只是把它改为了
MyStaticValue.userDefinePath="E:/library"

文件夹里的文件是没有变动

如果你需要我可以把userLibrary.dic发到你邮箱中

@ansjsun
Copy link
Member

ansjsun commented May 22, 2013

这种方式应该只能填写文件名吧...

你可以不修改这个..
建议你用这个方式来添加

file 是 "目录/文件"
如果是目录..他只会扫描目录中dic后缀的文件..
UserDefineLibrary.loadFile(UserDefineLibrary.FOREST, file) ;

这个方法..在任何时间都可以调用..不用分词加载前

On 2013-5-22, at 下午3:04, jamesDeng notifications@github.com wrote:

例子里的
MyStaticValue.userDefinePath="E:/library/userLibrary.dic";
我是只是把它改为了
MyStaticValue.userDefinePath="E:/library"

文件夹里的文件是没有变动的


Reply to this email directly or view it on GitHub.

@ansjsun
Copy link
Member

ansjsun commented May 29, 2013

楼上的...修复了呵呵...感谢randing89童鞋

@ansjsun ansjsun closed this as completed May 29, 2013
mcesar pushed a commit to project-draco-hr/ansj_seg that referenced this issue Oct 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants