DmitryKey / simplenlg

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

Crash adding preModifier to SPhraseSpec when verb phrase is a CoordinatePhraseElement #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Call SPhraseSpec addPreModifier(NLGElement newPreModifier) when the SPhraseSpec 
object has a CoordinatePhraseElement as its VERB_PHRASE. Crash casting verb 
phrase to PhraseElement.

It looks like this can happen in other SPhraseSpec methods as well.

A fix to this particular case which checks the type before casting and handles 
both PhraseElements and CoordinatePhraseElements as verb phrases is attached as 
a unified diff.

Original issue reported on code.google.com by ChristopherCHowell@gmail.com on 22 Mar 2011 at 2:05

Attachments:

GoogleCodeExporter commented 9 years ago
Having a CoordinatedPhraseElement as the VEBB_PHRASE seemed to be necessary to 
make sentences like:

"As a result of the procedure the patient had an adverse contrast media 
reaction and went into cardiogenic shock."

Original comment by ChristopherCHowell@gmail.com on 22 Mar 2011 at 2:37

GoogleCodeExporter commented 9 years ago
Resolved -- the crash was caused by addPreModifier attempting to cast the 
object to a PhraseElement. Chris Howell's suggestion has been implemented -- 
casting is now to NLGElement.

Original comment by bertug...@gmail.com on 31 Mar 2011 at 6:34