You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ctakes.apache.org by Steven Bethard <st...@Colorado.EDU> on 2013/02/14 21:27:12 UTC

SHARPKnowtatorXMLReader and new type system

I was looking again at SHARPKnowtatorXMLReader, and I have some questions about how annotations should be loaded now that we have things like BodyLateralityModifier, ProcedureMethodModifier, etc. in the type system.

Specifically, what should we be doing with the normalized form?

Take for example, procedure methods. In the annotations, each "method_class" (procedure method) has an "associatedCode" string attribute. Should SHARPKnowtatorXMLReader

(1) Just set the associated code on the modifier directly:

        String code = stringSlots.remove("associatedCode");
        ProcedureMethodModifier modifier = new ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
        modifier.setValue(code);

(2) Create an appropriate Attribute subclass, set the associated code there, and set the Attribute as the modifier's normalized form:

        String code = stringSlots.remove("associatedCode");
        ProcedureMethodModifier modifier = new ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
        ProcedureMethod method = new ProcedureMethod(jCas);
        method.setValue(code);
        modifier.setNormalizedForm(method);

(3) Both?

        String code = stringSlots.remove("associatedCode");
        ProcedureMethodModifier modifier = new ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
        modifier.setValue(code);
        ProcedureMethod method = new ProcedureMethod(jCas);
        method.setValue(code);
        modifier.setNormalizedForm(method);

I lean towards (3), but the duplication makes me a little nervous, like maybe I'm doing something wrong.

Steve


RE: SHARPKnowtatorXMLReader and new type system

Posted by "Masanz, James J." <Ma...@mayo.edu>.
> -----Original Message-----
> From: ctakes-dev-return-1208-Masanz.James=mayo.edu@incubator.apache.org
> [mailto:ctakes-dev-return-1208-
> Masanz.James=mayo.edu@incubator.apache.org] On Behalf Of Steven Bethard
> Sent: Thursday, February 14, 2013 6:20 PM
> To: ctakes-dev@incubator.apache.org
> Subject: Re: SHARPKnowtatorXMLReader and new type system
> 
> On Feb 14, 2013, at 3:43 PM, "Masanz, James J." <Ma...@mayo.edu>
> wrote:
> > I'm not familiar with  the decisions behind ProcedureMethod, but
> > modeling after this fragment of code
> >
> >      } else if ("method_class".equals(annotation.type)) {
> >        String code = stringSlots.remove("associatedCode");
> >        ProcedureMethod method = new ProcedureMethod(jCas);
> >        method.setValue(code);
> >        ProcedureMethodModifier modifier = new
> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
> >        modifier.setNormalizedForm(method);
> >
> > I would have picked (2)
> 
> Presumably if we pick (2), then we should also remove the .setValue
> methods from the Modifiers?

Makes sense to me

-- James Masanz

> > I'm also a little nervous about (3).
> >
> > Hopefully someone else will chime in.
> 
> Yeah, hopefully. =)
> 
> Steve
> 
> >
> > -- James
> >
> >> -----Original Message-----
> >> From:
> >> ctakes-dev-return-1206-Masanz.James=mayo.edu@incubator.apache.org
> >> [mailto:ctakes-dev-return-1206-Masanz.James=mayo.edu@incubator.apache
> >> .org]
> >> On Behalf Of Steven Bethard
> >> Sent: Thursday, February 14, 2013 2:27 PM
> >> To: ctakes-dev@incubator.apache.org
> >> Subject: SHARPKnowtatorXMLReader and new type system
> >>
> >> I was looking again at SHARPKnowtatorXMLReader, and I have some
> >> questions about how annotations should be loaded now that we have
> >> things like BodyLateralityModifier, ProcedureMethodModifier, etc. in
> the type system.
> >>
> >> Specifically, what should we be doing with the normalized form?
> >>
> >> Take for example, procedure methods. In the annotations, each
> >> "method_class" (procedure method) has an "associatedCode" string
> >> attribute. Should SHARPKnowtatorXMLReader
> >>
> >> (1) Just set the associated code on the modifier directly:
> >>
> >>        String code = stringSlots.remove("associatedCode");
> >>        ProcedureMethodModifier modifier = new
> >> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
> >>        modifier.setValue(code);
> >>
> >> (2) Create an appropriate Attribute subclass, set the associated code
> >> there, and set the Attribute as the modifier's normalized form:
> >>
> >>        String code = stringSlots.remove("associatedCode");
> >>        ProcedureMethodModifier modifier = new
> >> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
> >>        ProcedureMethod method = new ProcedureMethod(jCas);
> >>        method.setValue(code);
> >>        modifier.setNormalizedForm(method);
> >>
> >> (3) Both?
> >>
> >>        String code = stringSlots.remove("associatedCode");
> >>        ProcedureMethodModifier modifier = new
> >> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
> >>        modifier.setValue(code);
> >>        ProcedureMethod method = new ProcedureMethod(jCas);
> >>        method.setValue(code);
> >>        modifier.setNormalizedForm(method);
> >>
> >> I lean towards (3), but the duplication makes me a little nervous,
> >> like maybe I'm doing something wrong.
> >>
> >> Steve
> >


Re: SHARPKnowtatorXMLReader and new type system

Posted by Steven Bethard <st...@Colorado.EDU>.
On Feb 14, 2013, at 3:43 PM, "Masanz, James J." <Ma...@mayo.edu> wrote:
> I'm not familiar with  the decisions behind ProcedureMethod, but modeling after this fragment of code
> 
>      } else if ("method_class".equals(annotation.type)) {
>        String code = stringSlots.remove("associatedCode");
>        ProcedureMethod method = new ProcedureMethod(jCas);
>        method.setValue(code);
>        ProcedureMethodModifier modifier = new ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
>        modifier.setNormalizedForm(method);
> 
> I would have picked (2)

Presumably if we pick (2), then we should also remove the .setValue methods from the Modifiers?

> I'm also a little nervous about (3).
> 
> Hopefully someone else will chime in.

Yeah, hopefully. =)

Steve

> 
> -- James
> 
> 
> 
>> -----Original Message-----
>> From: ctakes-dev-return-1206-Masanz.James=mayo.edu@incubator.apache.org
>> [mailto:ctakes-dev-return-1206-Masanz.James=mayo.edu@incubator.apache.org]
>> On Behalf Of Steven Bethard
>> Sent: Thursday, February 14, 2013 2:27 PM
>> To: ctakes-dev@incubator.apache.org
>> Subject: SHARPKnowtatorXMLReader and new type system
>> 
>> I was looking again at SHARPKnowtatorXMLReader, and I have some questions
>> about how annotations should be loaded now that we have things like
>> BodyLateralityModifier, ProcedureMethodModifier, etc. in the type system.
>> 
>> Specifically, what should we be doing with the normalized form?
>> 
>> Take for example, procedure methods. In the annotations, each
>> "method_class" (procedure method) has an "associatedCode" string
>> attribute. Should SHARPKnowtatorXMLReader
>> 
>> (1) Just set the associated code on the modifier directly:
>> 
>>        String code = stringSlots.remove("associatedCode");
>>        ProcedureMethodModifier modifier = new
>> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
>>        modifier.setValue(code);
>> 
>> (2) Create an appropriate Attribute subclass, set the associated code
>> there, and set the Attribute as the modifier's normalized form:
>> 
>>        String code = stringSlots.remove("associatedCode");
>>        ProcedureMethodModifier modifier = new
>> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
>>        ProcedureMethod method = new ProcedureMethod(jCas);
>>        method.setValue(code);
>>        modifier.setNormalizedForm(method);
>> 
>> (3) Both?
>> 
>>        String code = stringSlots.remove("associatedCode");
>>        ProcedureMethodModifier modifier = new
>> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
>>        modifier.setValue(code);
>>        ProcedureMethod method = new ProcedureMethod(jCas);
>>        method.setValue(code);
>>        modifier.setNormalizedForm(method);
>> 
>> I lean towards (3), but the duplication makes me a little nervous, like
>> maybe I'm doing something wrong.
>> 
>> Steve
> 


RE: SHARPKnowtatorXMLReader and new type system

Posted by "Masanz, James J." <Ma...@mayo.edu>.
I'm not familiar with  the decisions behind ProcedureMethod, but modeling after this fragment of code

      } else if ("method_class".equals(annotation.type)) {
        String code = stringSlots.remove("associatedCode");
        ProcedureMethod method = new ProcedureMethod(jCas);
        method.setValue(code);
        ProcedureMethodModifier modifier = new ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
        modifier.setNormalizedForm(method);

I would have picked (2) 

I'm also a little nervous about (3).

Hopefully someone else will chime in.

-- James



> -----Original Message-----
> From: ctakes-dev-return-1206-Masanz.James=mayo.edu@incubator.apache.org
> [mailto:ctakes-dev-return-1206-Masanz.James=mayo.edu@incubator.apache.org]
> On Behalf Of Steven Bethard
> Sent: Thursday, February 14, 2013 2:27 PM
> To: ctakes-dev@incubator.apache.org
> Subject: SHARPKnowtatorXMLReader and new type system
> 
> I was looking again at SHARPKnowtatorXMLReader, and I have some questions
> about how annotations should be loaded now that we have things like
> BodyLateralityModifier, ProcedureMethodModifier, etc. in the type system.
> 
> Specifically, what should we be doing with the normalized form?
> 
> Take for example, procedure methods. In the annotations, each
> "method_class" (procedure method) has an "associatedCode" string
> attribute. Should SHARPKnowtatorXMLReader
> 
> (1) Just set the associated code on the modifier directly:
> 
>         String code = stringSlots.remove("associatedCode");
>         ProcedureMethodModifier modifier = new
> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
>         modifier.setValue(code);
> 
> (2) Create an appropriate Attribute subclass, set the associated code
> there, and set the Attribute as the modifier's normalized form:
> 
>         String code = stringSlots.remove("associatedCode");
>         ProcedureMethodModifier modifier = new
> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
>         ProcedureMethod method = new ProcedureMethod(jCas);
>         method.setValue(code);
>         modifier.setNormalizedForm(method);
> 
> (3) Both?
> 
>         String code = stringSlots.remove("associatedCode");
>         ProcedureMethodModifier modifier = new
> ProcedureMethodModifier(jCas, coveringSpan.begin, coveringSpan.end);
>         modifier.setValue(code);
>         ProcedureMethod method = new ProcedureMethod(jCas);
>         method.setValue(code);
>         modifier.setNormalizedForm(method);
> 
> I lean towards (3), but the duplication makes me a little nervous, like
> maybe I'm doing something wrong.
> 
> Steve