0

C# で Stanford CoreNLP (Java プロジェクト) を使用しようとしています。

IKVM を使用して .NET に変換された CoreNLP を含むこのNuget パッケージを見つけました。正常に動作していますが、Java プロジェクトにもいくつかの変更を加える必要があります。

Githubから CoreNLP をダウンロードしました。Ant から CoreNLP JAR をビルドできます。また、Eclipse でも正常に動作していますが、JAR を DLL に変換する際に問題が発生しています。Googleで見つけたビルドログに基づいて、これを行っています

ikvmc.exe  -version:2.1 ..\lib\joda-time.jar -out:joda-time.dll 
ikvmc.exe  -r:joda-time.dll -version:0.4.7 ..\lib\jollyday-0.4.7.jar -out:jollyday.dll 
ikvmc.exe  -version:0.23 ..\lib\ejml-0.23.jar -out:ejml-0.23.dll 
ikvmc.exe  -version:1.2.10 ..\lib\xom-1.2.10.jar -out:xom.dll 
ikvmc.exe  -version:1.0 ..\lib\javax.json.jar -out:javax.json.dll 
ikvmc.exe  -r:joda-time.dll -r:jollyday.dll -r:ejml-0.23.dll -r:xom.dll -r:javax.json.dll -version:3.5.0 ..\javanlp-core.jar -out:javanlp-core.dll 

次の変換から得られるのは、参照されているクラスが見つからないといういくつかの警告だけです。

warning IKVMC0100: Class "org.apache.xerces.parsers.SAXParser" not found
warning IKVMC0100: Class "junit.framework.TestCase" not found
warning IKVMC0100: Class "org.apache.xerces.impl.Version" not found
...
warning IKVMC0100: Class "junit.framework.TestCase" not found
warning IKVMC0100: Class "javax.servlet.http.HttpServlet" not found
warning IKVMC0100: Class "javax.servlet.Filter" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$FileDescriptor$InternalDescriptorAssigner" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$Builder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage" not found
warning IKVMC0100: Class "com.google.protobuf.MessageOrBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableMessage" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableMessageOrBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.Internal$EnumLiteMap" not found
warning IKVMC0100: Class "com.google.protobuf.ProtocolMessageEnum" not found
warning IKVMC0100: Class "junit.framework.TestSuite" not found
warning IKVMC0100: Class "junit.framework.Assert" not found
warning IKVMC0100: Class "com.apple.eawt.ApplicationAdapter" not found
warning IKVMC0100: Class "org.junit.Assert" not found
warning IKVMC0100: Class "org.apache.lucene.analysis.core.KeywordAnalyzer" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexWriterConfig" not found
warning IKVMC0100: Class "org.apache.lucene.util.Version" not found
warning IKVMC0100: Class "org.apache.lucene.store.FSDirectory" not found
warning IKVMC0100: Class "org.apache.lucene.index.DirectoryReader" not found
warning IKVMC0100: Class "org.apache.lucene.search.IndexSearcher" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanQuery" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanClause" not found
warning IKVMC0100: Class "org.apache.lucene.search.TermQuery" not found
warning IKVMC0100: Class "org.apache.lucene.index.Term" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanClause$Occur" not found
warning IKVMC0100: Class "org.apache.lucene.search.TopDocs" not found
warning IKVMC0100: Class "org.apache.lucene.search.ScoreDoc" not found
warning IKVMC0100: Class "org.apache.lucene.document.Document" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexWriter" not found
warning IKVMC0100: Class "org.apache.lucene.queryparser.classic.ParseException" not found
warning IKVMC0100: Class "org.apache.lucene.document.StringField" not found
warning IKVMC0100: Class "org.apache.lucene.document.Field$Store" not found
warning IKVMC0100: Class "org.apache.lucene.document.Field" not found
warning IKVMC0100: Class "org.apache.lucene.search.Query" not found
warning IKVMC0100: Class "org.apache.lucene.store.Directory" not found
warning IKVMC0100: Class "org.apache.lucene.index.CheckIndex" not found
warning IKVMC0100: Class "org.apache.lucene.index.CheckIndex$Status" not found
warning IKVMC0100: Class "org.apache.lucene.store.NIOFSDirectory" not found
warning IKVMC0100: Class "org.apache.lucene.util.BytesRef" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexReader" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$FileDescriptor" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$Descriptor" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$FieldAccessorTable" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors" not found
warning IKVMC0100: Class "junit.framework.AssertionFailedError" not found
warning IKVMC0100: Class "org.apache.lucene.document.FieldType" not found

PS: protobuf.jar の変換も試みましたが、以下に説明する問題は解決しませんでした。

問題は、新しくコンパイルされた参照 (6 dll) の Nuget 参照を置き換えると、正常にコンパイルされます (すべての参照が見つかります) が、このMissingMethodException がスローされます: 追加情報: メソッドが見つかりません: 'Void edu.stanford.nlp.pipeline .StanfordCoreNLP..ctor(java.util.Properties)'.

誰でも光を当てることができますか?

4

1 に答える 1

1

私はそれを理解したと思います。これが修正されたものです:

  1. Nuget パッケージ IKVM 8.0.5449.1 を削除しました
  2. Nuget Package IKVM 8.0.5449.0 をインストールしました (これは、JAR ファイルの変換に使用していたバージョンです)
  3. クリーニングして再構築します。

私の理解が正しければ、JAR ファイルの変換に使用した ikvmc.exe は、参照されているランタイム DLL と同じバージョンでなければなりません。

于 2015-04-16T03:16:12.073 に答える