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

KBeamArcEagerDependencyParser 加载模型时路径含"data"会导致异常 #1585

Closed
1 task done
ZZzeal opened this issue Nov 15, 2020 · 1 comment
Closed
1 task done
Assignees
Labels

Comments

@ZZzeal
Copy link

ZZzeal commented Nov 15, 2020

Describe the bug
KBeamArcEagerDependencyParser 加载模型时路径含"data"会导致异常

Code to reproduce the issue

PerceptronPOSModelPath='G:/pythonProject/wikidata_django/env/Lib/site-packages/pyhanlp/static/data/model/perceptron/pku1998/pos.bin'
# 调用
parser = KBeamArcEagerDependencyParser()

Describe the current behavior
载入模型时直接将PerceptronPOSModelPath的路径从idata_django开始替换为G:/pythonProject/wikidata/model/perceptron/ctb/pos.bin

Expected behavior
pyhanlp/static/data开始替换

System information

  • OS Platform and Distribution: Windows 10 20H2
  • Python version: 3.8.6
  • HanLP version: 1.7.8

Other info / logs

public KBeamArcEagerDependencyParser(String modelPath) throws IOException, ClassNotFoundException
{
    this(new PerceptronLexicalAnalyzer(HanLP.Config.PerceptronCWSModelPath,
                                       HanLP.Config.PerceptronPOSModelPath.replaceFirst("data.*?.bin", "data/model/perceptron/ctb/pos.bin")
    ).enableCustomDictionary(false), new KBeamArcEagerParser(modelPath));
}

com.hankcs.hanlp.dependency.perceptron.parser.KBeamArcEagerDependencyParser 59行 replaceFirst导致

  • I've completed this form and searched the web for solutions.
@ZZzeal ZZzeal added the bug label Nov 15, 2020
hankcs added a commit that referenced this issue Nov 15, 2020
@hankcs
Copy link
Owner

hankcs commented Nov 15, 2020

感谢反馈,已经修复,请参考上面的commit。
如果还有问题,欢迎重开issue。

@hankcs hankcs closed this as completed Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants