cory-p-oncota / negex

Automatically exported from code.google.com/p/negex
0 stars 0 forks source link

POST negation gives StringIndexOutOfBoundsException if endOffset < startOffset #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try with input as the phrase "job" in a sentence like "Her job is ruled
out but clearly there is a requirement for her skills".
2. A StringInexOutOfBoundsException occurs in GenNegEx.java

What is the expected output? What do you see instead?
Expected output is the negation of the term "job" as follows:
"Her  [NEGATED]job[NEGATED] [POST]is ruled out[POST] [CONJ]but[CONJ]
clearly there is a requirement for her skills.  negated Her 
[NEGATED]job[NEGATED] [POST]is ruled out"

Got the StringIndexOutOfBoundsException:
java.lang.StringIndexOutOfBoundsException: String index out of range

At the following line in GenNegex.java:
sScope = sentence.substring(startOffset, endOffset);    

What version of the product are you using? On what operating system?
GeneralNegEx.java.v.1.2.05092009.zip

Please provide any additional information below.
Can be fixed by adding another if condition in GenNegEx.java as follows:
if(startOffset > endOffset){
    startOffset = sentence.lastIndexOf("[PSEU]");
}
PFA the modified GenNegEx.java file.

Original issue reported on code.google.com by jyothsna...@gmail.com on 14 Apr 2010 at 8:24

Attachments: