Commit 421fe8bb authored by Javi Corvi's avatar Javi Corvi
Browse files

more improvement in study and specimen

parent 13abb018
Pipeline #28700 failed with stage
in 0 seconds
......@@ -9,7 +9,6 @@ treatment-related
treatment related
alteration
unilateral
basophilic tubules
mature
lymphoid tissue
bile
......
......@@ -50,6 +50,7 @@ relation-extraction/finding_group
relation-extraction/finding_dose
relation-extraction/finding_closest_sex
relation-extraction/finding_specimen_advance
relation-extraction/studytestcd_specimen_advance
relation-extraction/finding_specimen
relation-extraction/finding_manifestation
relation-extraction/studytest_manifestation
......
......@@ -24,8 +24,8 @@ Rule: delete_rule
AnnotationSet sentenceFields = inputAS.get(sentence.getStartNode().getOffset(), sentence.getEndNode().getOffset());
AnnotationSet annotations_type = sentenceFields.get(types);
if(annotations_type==null || annotations_type.size()==0){
System.out.println("MANIFESTATION ALONE: " + stringFor(doc, manifestation));
System.out.println(stringFor(doc, sentence));
//System.out.println("MANIFESTATION ALONE: " + stringFor(doc, manifestation));
//System.out.println(stringFor(doc, sentence));
outputAS.remove(manifestation);
}
}
......
......@@ -23,11 +23,11 @@ Rule: finding_specimen_advance
gate.AnnotationSet specimen_entities = lookup.get("SPECIMEN");
gate.AnnotationSet man_entities = lookup.get("FINDING");
gate.Annotation finding_change = man_entities.iterator().next();
String content = stringFor(doc, lookup.firstNode().getOffset(),lookup.lastNode().getOffset());
//System.out.println("FINDING:" + stringFor(doc, finding_change));
//System.out.println(content);
gate.FeatureMap features = finding_change.getFeatures();
String content = stringFor(doc, lookup.firstNode().getOffset(),lookup.lastNode().getOffset());
features.put("text", stringFor(doc, finding_change));
features.put("text", stringFor(doc, finding_change));
features.put("rule", "FINDING_SPECIMEN");
Boolean first = true;
String spe_ids = "";
......
//this rule annotates findings orientated to detect MANIFESTATION OF FINDING Changes in a specimen
Imports: {
import static gate.Utils.*;
}
Phase:secondphase
Input: Token STUDY_TESTCD SPECIMEN
Options: control = appelt
Rule: finding_specimen_advance
(
({SPECIMEN} {STUDY_TESTCD}) |
({STUDY_TESTCD} ({Token})[0,3] {Token.pos=="IN"} ({Token.pos=="DT"})? {SPECIMEN} (({Token.root==","} | {Token.root=="and"}) {SPECIMEN})[0,8])
) :finding_specimen_advance
-->
{
gate.AnnotationSet lookup = (gate.AnnotationSet) bindings.get("finding_specimen_advance");
gate.Annotation ann = (gate.Annotation) lookup.iterator().next();
gate.AnnotationSet sentence_set = outputAS.get("Sentence",ann.getStartNode().getOffset(), ann.getEndNode().getOffset());
gate.Annotation sentence = sentence_set.iterator().next();
//System.out.println("finding_specimen_advance");
//System.out.println(stringFor(doc, sentence));
try{
//System.out.println(doc.getName());
gate.AnnotationSet specimen_entities = lookup.get("SPECIMEN");
gate.AnnotationSet man_entities = lookup.get("STUDY_TESTCD");
gate.Annotation finding_change = man_entities.iterator().next();
String content = stringFor(doc, lookup.firstNode().getOffset(),lookup.lastNode().getOffset());
//System.out.println("FINDING:" + stringFor(doc, finding_change));
System.out.println(content);
gate.FeatureMap features = finding_change.getFeatures();
features.put("text", stringFor(doc, finding_change));
features.put("rule", "STUDY_TESTCD_SPECIMEN");
Boolean first = true;
String spe_ids = "";
for (Annotation spe : specimen_entities) {
//System.out.println("SPECIMEN:" + stringFor(doc, spe));
if(first){
spe_ids = spe.getId().toString();
first=false;
}else{
spe_ids = spe_ids+","+spe.getId().toString();
}
}
features.put("SPECIMEN", spe_ids);
//System.out.println(stringFor(doc, lookup.firstNode().getOffset(),lookup.lastNode().getOffset()));
//outputAS.add(finding_change.getStartNode().getOffset(),finding_change.getEndNode().getOffset(), "FINDING", features);
outputAS.add(lookup.firstNode().getOffset(),lookup.lastNode().getOffset(), "STUDY_TEST_2", features);
}catch(InvalidOffsetException e){
throw new LuckyException(e);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment