Skip to content

POST negation gives StringIndexOutOfBoundsException if endOffset < startOffset #2

@GoogleCodeExporter

Description

@GoogleCodeExporter
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:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions