uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eddie Epstein <eaepst...@gmail.com>
Subject Re: Accessing type system features within perl
Date Fri, 04 Mar 2011 22:05:03 GMT
Should be, yes. Look in $UIMACPP_HOME/scriptators/uima.i and search
for #ifdef SWIGPERL.

Eddie

On Fri, Mar 4, 2011 at 4:15 PM, Edward Johnson <ejohnson@coderyte.com> wrote:
> Thanks,  that helps a lot.
>
> I ran across a message from 2006: http://www.ibm.com/developerworks/forums/thread.jspa?messageID=13856521
> that in the comments suggests "there are Perl ties to make FSIterators look like arrays
and FeatureStructures look like hashes."  Is this feature still available?
>
>
> Edward.
>
>
> ----- Original Message -----
>> 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
>> <ejohnson@coderyte.com> 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.
>> >
>

Mime
View raw message