The argument for $annotation->getStringValue() is a Feature object.
Presumably your type system has created a feature named
"annotatorName" for some Type derived from uima.tcas.Annotation. To
access that feature in Perl, first get a handle to that Feature object
in the typeSystemInit method, something like:
    $main::annotnamefeat = $main::mytype->getFeatureByBaseName("annotatorName");
where $main::mytype is the Type object for your custom type.

You can test this by modifying sample.pl, first in typeSystemInit:
  $main::keybeginfeat = $main::keywordtype->getFeatureByBaseName("begin");

then in in the loop at the bottom listing annotations created, add:
  print "(begin)= (", $anno->getIntValue($main::keybeginfeat),")\n";

Eddie

On Wed, Mar 2, 2011 at 12:08 PM, Edward Johnson <[email protected]> wrote:
> I am having difficulty getting/setting a types features from within a perl 
> annotator.  I have tried a few things without success:
>
> print $annotation->getStringValue('annotatorName'),"\n";
> TypeError in method 'FeatureStructure_getStringValue', argument 2 of type 
> 'Feature const &'
>
> print $annotation->getFSValue('annotatorName')\n";
> TypeError in method 'FeatureStructure_getFSValue', argument 2 of type 
> 'Feature const &'
>
> print $annotation->{'annotatorName'}\n";
> Can't locate auto/perltator/AnnotationFS/swig_annota.al in @INC (@INC 
> contains: ...) at perltator.pm line 33
>
> The first two messages suggest that I should be passing a Feature object 
> instead of a string, however, there doesn't appear to be a way to set the 
> Feature object's name.
>
> In the above examples, the type was created with an xml descriptor and has a 
> string feature named 'annotatorName'.
>
> Could someone tell me the correct way to do this?
>
> Thank you.
>  Edward.
>

Reply via email to