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

使用maven的jar包,程序執行時找不到詞典路徑。 #269

Closed
skedin opened this issue Jul 7, 2016 · 3 comments
Closed

使用maven的jar包,程序執行時找不到詞典路徑。 #269

skedin opened this issue Jul 7, 2016 · 3 comments
Labels

Comments

@skedin
Copy link

skedin commented Jul 7, 2016

Exception如下:

Jul 07, 2016 5:00:15 PM com.hankcs.hanlp.seg.CRF.CRFSegment$CharTable <clinit>
SEVERE: 字符正规化表加载失败,原因如下:
java.io.FileNotFoundException: data/dictionary/other/CharTable.bin.yes (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.io.FileInputStream.<init>(FileInputStream.java:93)
    at com.hankcs.hanlp.seg.CRF.CRFSegment$CharTable.<clinit>(CRFSegment.java:368)
    at com.hankcs.hanlp.seg.CRF.CRFSegment.segSentence(CRFSegment.java:46)
    at com.hankcs.hanlp.seg.Segment.seg(Segment.java:454)
    at io.smackds.processors.NLP$$anonfun$receive$1.applyOrElse(NLP.scala:31)
    at akka.actor.Actor$class.aroundReceive(Actor.scala:484)
    at io.smackds.processors.NLP.aroundReceive(NLP.scala:19)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
    at akka.actor.ActorCell.invoke(ActorCell.scala:495)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
    at akka.dispatch.Mailbox.run(Mailbox.scala:224)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

但如果直接使用github的jar,則沒有錯誤。
我的hanlp.properties裡指定了root=/Users/stephen/devel/hanlp-1.2.10,並另外下載了完整的詞典檔。

@hankcs
Copy link
Owner

hankcs commented Jul 7, 2016

root=/Users/stephen/devel/hanlp-1.2.10/
请注意后面的斜杠,该问题已在最新的代码中得到改进,参考:
7e391fe

@hankcs hankcs added the question label Jul 7, 2016
@skedin
Copy link
Author

skedin commented Jul 7, 2016

感謝,問題解決。
但好奇請問下,為什麼使用github裡hanlp-1.2.10-release.zip的jar,不會有這個錯誤?我的路徑設置都一樣,詞典檔也都一樣(data-for-1.2.10.zip)。

@hankcs
Copy link
Owner

hankcs commented Jul 7, 2016

因为两个分支对后斜杠的处理不一样,一个有人性化的补充,另一个没有。

@skedin skedin closed this as completed Jul 7, 2016
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