1

私はC#言語でopennlpツールを使用しています。私は次のコードを書きました:

string modelpath = @"D:\models\en-sent.bin";
java.io.FileInputStream modelInpStream = new java.io.FileInputStream(modelpath);
SentenceModel model = new SentenceModel(modelInpStream);
SentenceDetectorME sentenceDetector = new SentenceDetectorME(model);

しかし、次の行でTypeInitializationExceptionが発生しました。

SentenceModel model = new SentenceModel(modelInpStream);

例外メッセージ:

TypeInitializationException was unhandled
The type initializer for 'java.nio.charset.StandardCharsets' threw an exception.
4

1 に答える 1

0

IKVM コードを使用して openNLP jar ファイルを .Net に変換したと仮定すると、これを機能させるには、プロジェクトに IKVM Charsets dll も含める必要があります。

于 2012-05-01T22:12:10.833 に答える