jiangnanboy / jcorrector

jcorrector 中文文本纠错工具, Text Error Correction Tool,Spelling Check
Apache License 2.0
56 stars 14 forks source link

运行例子报错 #3

Closed huwenjian closed 2 years ago

huwenjian commented 2 years ago

#CorrectDemo

[main] INFO sy.core.spelling.LoadCorrectorDict - file load -> E:/work/project/gitee/study-test-project/jcorrector/target/classes/spelling/same_stroke.txt
Please input a sentence:
我的喉咙发炎了要买点阿莫细林吉
[main] WARN sy.core.spelling.Detector - index error or detect error: 我的喉咙发炎了要买点阿莫细林吉
java.lang.NullPointerException
Exception in thread "main" java.lang.NullPointerException
    at sy.core.spelling.Detector.pplScore(Detector.java:76)
    at sy.core.spelling.Corrector.lambda$getLmCorrectItem$12(Corrector.java:222)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at sy.core.spelling.Corrector.getLmCorrectItem(Corrector.java:224)
    at sy.core.spelling.Corrector.getLmCorrectItem(Corrector.java:202)
    at sy.core.spelling.Corrector.correct(Corrector.java:312)
    at sy.core.spelling.Corrector.correct(Corrector.java:264)
    at examples.CorrectDemo.main(CorrectDemo.java:24)

Process finished with exit code 1

#DetectDemo

[main] WARN sy.core.ngram.NGramModel - model file not found model/data_char.bin
Please input a sentence:
我的喉咙发炎了要买点阿莫细林吉
[main] WARN sy.core.spelling.Detector - index error or detect error: 我的喉咙发炎了要买点阿莫细林吉
java.lang.NullPointerException
[[林吉, 13, 15, word]]
Please input a sentence:
少先队员因该为老人让坐
[main] WARN sy.core.spelling.Detector - index error or detect error: 少先队员因该为老人让坐
java.lang.NullPointerException
[]
Please input a sentence:
jiangnanboy commented 2 years ago

需要加载model

lanqiuguantou commented 2 years ago

报了同样的错误,没有找到ngrm/data_char.bin这个模型文件,问一下这个文件在哪里获取

jiangnanboy commented 2 years ago

已有模型,可自行下载