uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: Arrays/Lists of custom types
Date Sat, 17 Nov 2012 19:37:16 GMT
+1

-Marshall
On 11/16/2012 8:45 AM, Richard Eckart de Castilho wrote:
> I'd recommend to use FSList only when it is necessary that elements are added to the
list at some point. If the number of elements in your list are known when the feature is set
and no elements need to be appended later, I would recommend FSArray.
>
> -- Richard
>
> Am 16.11.2012 um 02:15 schrieb Himanshu Gahlot <himanshu.gahlot86@gmail.com>:
>
>> Create a feature of type NonEmptyFSList in your Sentence type and name it
>> 'words'. Now in your sentence annotator, iterate over all the words in this
>> sentence, put them in a List<Word>, create an FSList using your List<Word>,
>> and set this FSList as the 'words' feature in your Sentence. Some untested
>> code to help you out:
>>
>> List<Word> wordList = //your list of words in the current sentence
>> FSList wordFSList = FSCollectionFactory.createFSList(aJCas, wordList);
>> sentence.setWords(wordFSList);
>>
>> Note that I am using FSCollectionFactory class from uimafit (
>> http://uimafit.googlecode.com/svn-history/r623/trunk/apidocs/org/uimafit/util/FSCollectionFactory.html
>> ).
>>
>> Himanshu
>>
>>
>> On Thu, Nov 15, 2012 at 9:37 AM, Administrator <
>> roman.alexandrovich.mueller@gmail.com> wrote:
>>
>>> Hello dear uima user,
>>>
>>> Lets say i defined the types Word and Sentence. How to add a feature to
>>> the type Sentence which holds multiple Words? For instance a list of Words.
>>>
>>> Thanks in advance
>>> Roman
>


Mime
View raw message