Child pages
  • Introduction to using openNLP in .NET Projects
Skip to end of metadata
Go to start of metadata


Using the amazing IKVM OpenNLP's java files can be converted to a .Net assembly (dll).
Thus allowing you to use the latest releases of OpenNLP from C# (or any other .net language).
So far the .Net assembly has succesfully been used for: Splitting, Tokenising, POS Tagging & Chunking. Full parsing has yet to be fully tested.


(Don't forget to unblock any downloaded files)

  • Download & extract the latest OpenNlp release from . At the time of writing this is
  • The three .jar files (opennlp-maxent-3.0.1-incubating.jar, jwnl-1.3.3.jar, opennlp-tools-1.5.1-incubating.jar) in the lib folder can be used to compile a .net assembly as follows.
  • Download & extract the latest IKVM from At the time of writing this is
  • For simplicity, copy the three .jar files above into the ikvmbin- folder
  • From a command window, In the ikvmbin- folder use IKVMC & the above three jar files make the opennlp.dll as follows:
  • ikvmc -target:library -assembly:opennlp opennlp-maxent-3.0.1-incubating.jar jwnl-1.3.3.jar opennlp-tools-1.5.1-incubating.jar
  • Copy the following from the ikvmbin- folder to your project folder (or the folder of your choice)
    • opennlp.dll (the assembly you have just created)
    • IKVM.Runtime.dll
    • IKVM.OpenJDK.Core.dll
    • IKVM.OpenJDK.Jdbc.dll
    • IKVM.OpenJDK.Text.dll
    • IKVM.OpenJDK.Util.dll
    • IKVM.OpenJDK.XML.API.dll
      (I found using reflection which IKVM dll's are referenced in the opennlp.dll )

Add references to these assemblies in your project & use at will (smile)
The OpenNlp manual is at

You will need the models for your language which are currently here

Note: This is still a java in .net clothes, so care has to be taken over some things.
e.g when loading models the inputstreams are java types (referenced from the assemblies above)



Workaround if an invalid format exception occurs when reading en-pos-maxent.bin
The file en-pos-maxent.bin is actually a zip archive.
If you examine the contents of this zip file, it currently has three files (the others seem to only have 2),   tags.tagdict,  &  pos.model
Delete the tags.tagdict from the zipfile so that it only contains & pos.model
Note: Don't actually unzip  en-pos-maxent.bin just delete tags.dagdict, so that  en-pos-maxent.bin remains a Zip archive containing the remaining 2 files.

  • No labels