Search code examples
uimaruta

Same feature value for all corresponding feature


I have tried to set the sentence as a feature for each Me_UnitSpacing. But I'm getting the same sentence value for all the occurence of the Me_UnitSpacing

Sample Code:

DECLARE LOWERCAMELCASE,UPPERCAMELCASE;
DECLARE ME_UNITSPACING(STRING sentence, STRING replace,STRING description);
Document{-> RETAINTYPE(SPACE)};
SW CW{->MARK(LOWERCAMELCASE,1,2)};
CW CW{->MARK(UPPERCAMELCASE,1,2)};
Document{-> RETAINTYPE};
LOWERCAMELCASE{REGEXP("mmHg")->MARK(ME_UNITSPACING)};
UPPERCAMELCASE{REGEXP("MmHg")->MARK(ME_UNITSPACING)};
W{REGEXP("Mmhg",true)->MARK(ME_UNITSPACING)};

DECLARE UnitspacingSENTENCE;
SENTENCE{CONTAINS(ME_UNITSPACING)->UnitspacingSENTENCE};
STRING unitspacingsent;
UnitspacingSENTENCE{->MATCHEDTEXT(unitspacingsent)};
ME_UNITSPACING{->ME_UNITSPACING.sentence=unitspacingsent};

Sample Input:

 A number of psychological and  mmHg psychiatric correlates have been found                     
 implicated in the onset and/or repetition of NSSI behavior. Nock et al. 14      
 reported 9 k that more than half of the clinical adolescents they studied 
 met the DSM-IV criteria for an internalizing disorder, an externalizing    
 disorder, or a substance-related disorder, with a prevalence  mmHg  rate of 
 psychiatric pathologies estimated to be as high as 87%. In a large  
 community-based sample of 12,068 adolescents from 11 countries, Brunner et  
 al. (2014) found significant associations mmHg with symptoms of depression    
 and anxiety in adolescents who engaged in self-harming behavior 6, and they   
 emphasized that self-injury is strongly indicative of psychological   
 problems that require professional attention. Their results are consistent    
 with previous reports of a significantly higher rate of depressive and   
 anxious symptoms in self-injurers.5,15,16,17,18,19 The onset of NSSI   
 behavior in teenagers with depression is mainly attributable to the    
 function of NSSI as a way to seek relief from the depressive symptoms. 20  
 The literature generally stresses the broad variety of psychiatric problems  
 seen in mmHg  teenagers with history of NSSI. Cluster B personality   
 disorders are often identified, especially in self-cutting adolescent  
 females, and so are eating disorders; approximately one in three  
 adolescents with eating disorders are also self-injurers, the NSSI 
 frequently coinciding with or following the eating disorder 21, 22.

Solution

  • DECLARE LOWERCAMELCASE,UPPERCAMELCASE;
    DECLARE ME_UNITSPACING(STRING sentence, STRING replace,STRING description);
    Document{-> RETAINTYPE(SPACE)};
    SW CW{->MARK(LOWERCAMELCASE,1,2)};
    CW CW{->MARK(UPPERCAMELCASE,1,2)};
    Document{-> RETAINTYPE};
    LOWERCAMELCASE{REGEXP("mmHg")->MARK(ME_UNITSPACING)};
    UPPERCAMELCASE{REGEXP("MmHg")->MARK(ME_UNITSPACING)};
    W{REGEXP("Mmhg",true)->MARK(ME_UNITSPACING)};
    
    DECLARE UnitspacingSENTENCE;
    SENTENCE{CONTAINS(ME_UNITSPACING)->UnitspacingSENTENCE};
    BLOCK(foreach)UnitspacingSENTENCE{}
    {
    STRING unitspacingsent;
    UnitspacingSENTENCE{->MATCHEDTEXT(unitspacingsent)};
    ME_UNITSPACING{->ME_UNITSPACING.sentence=unitspacingsent};
    }