uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <eck...@ukp.informatik.tu-darmstadt.de>
Subject Re: Arrays/Lists of custom types
Date Fri, 16 Nov 2012 13:45:18 GMT
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

Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab (UKP-TUD) 
FB 20 Computer Science Department      
Technische Universit├Ąt Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de

View raw message