This project is read-only.
2
Vote

Problem while using SharpNLP-1.0.2529-Bin\ToolsExample.exe

description

Hello support
I am using “SharpNLP-1.0.2529-Bin\ToolsExample.exe” example. As soon as I click on “Split” button I get following exception:
 
System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: count
at System.IO.FileStream.Read(Byte[] array, Int32 offset, Int32 count)
at SharpEntropy.IO.BinaryGisModelReader.ReadString()
at SharpEntropy.IO.BinaryGisModelReader.ReadPredicates(Int32[][]& outcomePatterns, Dictionary`2& predicates)
at SharpEntropy.IO.GisModelReader.ReadModel()
at SharpEntropy.IO.BinaryGisModelReader..ctor(String fileName)
at OpenNLP.Tools.SentenceDetect.EnglishMaximumEntropySentenceDetector..ctor(String name)
at ToolsExample.MainForm.SplitSentences(String paragraph)
at ToolsExample.MainForm.btnSplit_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 
Is their any setting I need to do to solve this problem?
 
Thank you

comments

chengyilong wrote Nov 10, 2009 at 3:57 PM

I met the same problem!! I wonder whether this project is still active.....

dylanhogg wrote Oct 20, 2010 at 12:39 PM

Adding the following snippet to line 169 of \SharpEntropy\IO\BinaryGisModelReader.cs (inside the for loop below this comment: "//read in the details of the predicates in this pattern") fixed it for me.

if (mInput.Position == mInput.Length)
{
return;
}

I also suspect from looking at the codeproject comments here: http://www.codeproject.com/KB/recipes/englishparsing.aspx it could also be fixed by downloading the Java .bin files and using the ModelConverter on them but haven't tried that.

dylanhogg wrote Oct 20, 2010 at 12:43 PM

sorry, I added the snippet on line 164, not 169 as I said below.

Also, mInput.Position == mInput.Length just determines that we are at the end of the stream so there's nothing more to read.

wrote Feb 22, 2013 at 12:16 AM