You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by David Santucci <da...@gmail.com> on 2010/12/21 13:13:06 UTC

Adding features on a Concept Mapper dictionary

Hi,

I hope you can help me with a problem with Concept Mapper.
I defined a dictionary with more features:

<synonim>
<token canonical="aaa" text="bbb" feature1="ccc" feature2="ddd" >
<variant base="aaa" />
.....
How can I access the value of these features?

I tried defining a new "MyDictTerm.xml", which defines a type extend the
type "MyDictTerm" that extends the standard  "DictTerm".
 "MyDictTerm" contains new features (feature1 and feature2), added in the
"Type System Definition" of "MyDictTerm.xml" Component Descriptor Editor.
After creating the java classes with "JCasGen" the following code doesn't
work:

FSIndex index = jcas.getAnnotationIndex(MyDictTerm.type);
Iterator it = index.iterator();
DictTerm dict = new MyDictTerm(jcas);

while (it.hasNext()) {
dict = (MyDictTerm) it.next();
System.out.print("feature1" + dict.getFeature1());
}

The system says it needs a cast ((MyDictTerm) dict).getFeature1() , but the
system doesn't find any annotation.
What's the right way to retrieve features on a dictionary?


Best regards,

David

Re: Adding features on a Concept Mapper dictionary

Posted by David Santucci <da...@gmail.com>.
The mistake I've done is to set in a wrong way the configuration parameters.
There are three required step (go to "Parameter Settings" in our analysis
engine xml):
1) set ResultingAnnotationName with your annotation type (in my cas
"myUima.MyDictTerm")
2) set AttributeList with the list of attributes (canonical, text,
attribute1, attribute2)
    NB: attribute1 and attribute2 are the feature defined in the
dictionary!
3) set FeatureList with the list of corresponding features (DictCanon,
matchedText, attribute1Feature, attribute2Feature)
    NB: attribute1Feature and attribute2Feature are the feature defined in
MyDictTerm!

All elements in AttributeList must correspond to parallel element specified
in FeatureList.


David


2010/12/21 David Santucci <da...@gmail.com>

> I've done it, but it is the same: the example runs but it doesn't match
> anything ...
> I'm searching for the correct way to extract features from a dictionaries.
> I need to know the feature value of a matched token.
>
>
> 2010/12/21 Michael Tanenblatt <sl...@park-slope.net>
>
> First question: why do you declare 'dict' as a DictTerm instead of a
>> 'MyDictTerm', e.g.:
>>
>> MyDictTerm dict = new MyDictTerm(jcas);
>>
>>
>> On Dec 21, 2010, at 7:13 AM, David Santucci wrote:
>>
>> > Hi,
>> >
>> > I hope you can help me with a problem with Concept Mapper.
>> > I defined a dictionary with more features:
>> >
>> > <synonim>
>> > <token canonical="aaa" text="bbb" feature1="ccc" feature2="ddd" >
>> > <variant base="aaa" />
>> > .....
>> > How can I access the value of these features?
>> >
>> > I tried defining a new "MyDictTerm.xml", which defines a type extend the
>> > type "MyDictTerm" that extends the standard  "DictTerm".
>> > "MyDictTerm" contains new features (feature1 and feature2), added in the
>> > "Type System Definition" of "MyDictTerm.xml" Component Descriptor
>> Editor.
>> > After creating the java classes with "JCasGen" the following code
>> doesn't
>> > work:
>> >
>> > FSIndex index = jcas.getAnnotationIndex(MyDictTerm.type);
>> > Iterator it = index.iterator();
>> > DictTerm dict = new MyDictTerm(jcas);
>> >
>> > while (it.hasNext()) {
>> > dict = (MyDictTerm) it.next();
>> > System.out.print("feature1" + dict.getFeature1());
>> > }
>> >
>> > The system says it needs a cast ((MyDictTerm) dict).getFeature1() , but
>> the
>> > system doesn't find any annotation.
>> > What's the right way to retrieve features on a dictionary?
>> >
>> >
>> > Best regards,
>> >
>> > David
>>
>>
>

Re: Adding features on a Concept Mapper dictionary

Posted by David Santucci <da...@gmail.com>.
I've done it, but it is the same: the example runs but it doesn't match
anything ...
I'm searching for the correct way to extract features from a dictionaries.
I need to know the feature value of a matched token.


2010/12/21 Michael Tanenblatt <sl...@park-slope.net>

> First question: why do you declare 'dict' as a DictTerm instead of a
> 'MyDictTerm', e.g.:
>
> MyDictTerm dict = new MyDictTerm(jcas);
>
>
> On Dec 21, 2010, at 7:13 AM, David Santucci wrote:
>
> > Hi,
> >
> > I hope you can help me with a problem with Concept Mapper.
> > I defined a dictionary with more features:
> >
> > <synonim>
> > <token canonical="aaa" text="bbb" feature1="ccc" feature2="ddd" >
> > <variant base="aaa" />
> > .....
> > How can I access the value of these features?
> >
> > I tried defining a new "MyDictTerm.xml", which defines a type extend the
> > type "MyDictTerm" that extends the standard  "DictTerm".
> > "MyDictTerm" contains new features (feature1 and feature2), added in the
> > "Type System Definition" of "MyDictTerm.xml" Component Descriptor Editor.
> > After creating the java classes with "JCasGen" the following code doesn't
> > work:
> >
> > FSIndex index = jcas.getAnnotationIndex(MyDictTerm.type);
> > Iterator it = index.iterator();
> > DictTerm dict = new MyDictTerm(jcas);
> >
> > while (it.hasNext()) {
> > dict = (MyDictTerm) it.next();
> > System.out.print("feature1" + dict.getFeature1());
> > }
> >
> > The system says it needs a cast ((MyDictTerm) dict).getFeature1() , but
> the
> > system doesn't find any annotation.
> > What's the right way to retrieve features on a dictionary?
> >
> >
> > Best regards,
> >
> > David
>
>

Re: Adding features on a Concept Mapper dictionary

Posted by Michael Tanenblatt <sl...@park-slope.net>.
First question: why do you declare 'dict' as a DictTerm instead of a 'MyDictTerm', e.g.:

MyDictTerm dict = new MyDictTerm(jcas);


On Dec 21, 2010, at 7:13 AM, David Santucci wrote:

> Hi,
> 
> I hope you can help me with a problem with Concept Mapper.
> I defined a dictionary with more features:
> 
> <synonim>
> <token canonical="aaa" text="bbb" feature1="ccc" feature2="ddd" >
> <variant base="aaa" />
> .....
> How can I access the value of these features?
> 
> I tried defining a new "MyDictTerm.xml", which defines a type extend the
> type "MyDictTerm" that extends the standard  "DictTerm".
> "MyDictTerm" contains new features (feature1 and feature2), added in the
> "Type System Definition" of "MyDictTerm.xml" Component Descriptor Editor.
> After creating the java classes with "JCasGen" the following code doesn't
> work:
> 
> FSIndex index = jcas.getAnnotationIndex(MyDictTerm.type);
> Iterator it = index.iterator();
> DictTerm dict = new MyDictTerm(jcas);
> 
> while (it.hasNext()) {
> dict = (MyDictTerm) it.next();
> System.out.print("feature1" + dict.getFeature1());
> }
> 
> The system says it needs a cast ((MyDictTerm) dict).getFeature1() , but the
> system doesn't find any annotation.
> What's the right way to retrieve features on a dictionary?
> 
> 
> Best regards,
> 
> David