2012-04-05 6 views
1

私はC#言語でopennlpツールを使用しています。 私は、次のコードを書いた:TypeInitializationExceptionが処理されていません

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

Umm、これはJavaではないC#ですか?実際にSharpNLPを使用している場合を除きますか? – Yuck

答えて

0

あなたが変換するIKVMコードを使用すると仮定しopenNLP jarファイルを.Netに変換するには、プロジェクトにIKVM Charsets dllをインクルードするだけで、これが機能するようにする必要があります。

関連する問題