0

I'm trying to use the Stanford NLP tools ported to IKVM, but it gives me unhandeled exception.

here's the code I'm using

       `string StanfordModelsDirectory = "englishPCFG.ser.gz";
        try
        {
            LexicalizedParser LP = LexicalizedParser.loadModel(StanfordModelsDirectory);

            TreebankLanguagePack tlp = new PennTreebankLanguagePack();
            GrammaticalStructureFactory gsf = tlp.grammaticalStructureFactory();


            Tree parse = LP.apply("what's the largest city in canada?");
            parse.pennPrint();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }`

I've referenced IKVM.OpenJDK.Core and stanford-parser, but the message "Could not load file or assembly 'IKVM.OpenJDK.Core, Version=7.1.4532.2, Culture=neutral, PublicKeyToken=13235d27fcbfff58' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)" appears.

I'm using windows 8 (visual studio 2012, .NET 4.5)

Eric J.
  • 147,927
  • 63
  • 340
  • 553
Mokhtar Ashour
  • 600
  • 2
  • 9
  • 21
  • This error is a standard error of .NET version hell and has nothing to do with IKVM or NLP. Do you have compiled the stanford-parser with the same version of IKVM? – Horcrux7 Feb 12 '13 at 16:53
  • I didn't compile the Stanford-parser, I got the dll compiled. but I got the java files for the parser, how can I get a .MET assembly from them. and which files I'll use. thanks :) – Mokhtar Ashour Feb 12 '13 at 17:13
  • 1
    If you use an existing .NET dll then you need all dependencies in the right version. I think the dll was compiled with a different IKVM version. If you want compile it self then you can look at et [wiki](http://sourceforge.net/apps/mediawiki/ikvm/index.php?title=Convert_a_jar_file_to_a_dll_and_use_it_as_library). – Horcrux7 Feb 14 '13 at 12:08

1 Answers1

1

IKVM is compiled for .NET 2.0. You need to add a config file to your application to map to a different .NET version like 4.5.

IKVM 7.2.x contains such config file for ikvm.exe, ikvmc.exe, .....

Horcrux7
  • 23,758
  • 21
  • 98
  • 156