uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: determining whether a feature has been set
Date Mon, 03 May 2010 15:36:22 GMT
You could pick a value which won't occur otherwise.

For instance, Float has a special value Float.NaN, which is not a
number.  (If you use this, remember that the equals test doesn't work on
this.)
Integers don't have any such value, but some codes use
Integer.MIN_VALUE, if it won't occur otherwise.

Finally, you could define another feature in your FeatureStructure, of
type boolean, and set that to false initially, and true when you set the
feature of interest.

-Marshall

On 5/3/2010 10:02 AM, Thilo Goetz wrote:
> On 5/3/2010 15:15, Klaus Rothenhäusler wrote:
>   
>> Hi,
>> is there any way to determine whether a feature of a primitive
>> numerical type has been set in a particular feature structure? The
>> methods like getIntValue(feat), getFloatValue(feat), etc. all return a
>> zero value if the feature hasn't been set. But zero is of course a
>> perfectly plausible value in many domains.
>>
>> Thanks
>> --Klaus Rothenhäusler
>>     
> There is no way to check this.  We do not wrap primitive
> values internally, and so do not attach any metadata like,
> has it been set or not.  It's like a Java primitive variable
> in that sense.
>
> --Thilo
>
>
>   

Mime
View raw message