Commit bdb7f294 authored by jcorvi's avatar jcorvi
Browse files

build version 0.1. Deprecated Version.

parent 3d30accb
Pipeline #2722 passed with stage
in 2 minutes and 23 seconds
variables:
DOCKER_USER: javicorvi
DOCKER_BUILD: $DOCKER_USER/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
stages:
- build
build_docker_image:
stage: build
only:
- tags
script:
- docker login -u javicorvi -p $DOCKER_PASS
- docker build -t $DOCKER_BUILD .
- docker push $DOCKER_BUILD
tags:
- build
\ No newline at end of file
# Change Log
## Version 1.0, 2020-03-03
First version of the component.
\ No newline at end of file
This diff is collapsed.
ades-relation-extraction
========================
<b>Relation Extraction for Preclinical Adverse Drug Effect text-mining Project</b>
<b>Relation Extraction for Preclinical Adverse Drug Effect text-mining Project. DEPRECATED.</b>
========================
......
#!/bin/sh
BASEDIR=/usr/local
ADES_RELATION_EXTRACTION_HOME="${BASEDIR}/share/ades_relation_extraction/"
ADES_RELATION_EXTRACTION_VERSION=1.0
# Exit on error
set -e
if [ $# -ge 1 ] ; then
ADES_RELATION_EXTRACTION_VERSION="$1"
fi
if [ -f /etc/alpine-release ] ; then
# Installing OpenJDK 8
apk add --update openjdk8-jre
# dict tagger development dependencies
apk add openjdk8 git maven
else
# Runtime dependencies
apt-get update
apt-get install openjdk-8-jre
# The development dependencies
apt-get install openjdk-8-jdk git maven
fi
git clone --depth 1 https://github.com/inab/docker-textmining-tools.git nlp_gate_generic_component
cd nlp_gate_generic_component
git filter-branch --prune-empty --subdirectory-filter nlp-gate-generic-component HEAD
mvn clean install -DskipTests
cd ..
#rename jar
mv nlp_gate_generic_component/target/nlp-gate-generic-component-0.0.1-SNAPSHOT-jar-with-dependencies.jar nlp-gate-generic-component-${ADES_RELATION_EXTRACTION_VERSION}.jar
cat > /usr/local/bin/ades-relation-extraction <<EOF
#!/bin/sh
exec java \$JAVA_OPTS -jar "${ADES_RELATION_EXTRACTION_HOME}/nlp-gate-generic-component-${ADES_RELATION_EXTRACTION_VERSION}.jar" -workdir "${ADES_RELATION_EXTRACTION_HOME}" -j jape_rules/main.jape "\$@"
EOF
chmod +x /usr/local/bin/ades-relation-extraction
#delete target, do not delete for now because it has the jape rules inside
#rm -R nlp_generic_annotation
#add bash for nextflow
apk add bash
if [ -f /etc/alpine-release ] ; then
# Removing not needed tools
apk del openjdk8 git maven
rm -rf /var/cache/apk/*
else
apt-get remove openjdk-8-jdk git maven
rm -rf /var/cache/dpkg
fi
......@@ -20,7 +20,7 @@
<dependency>
<groupId>uk.ac.gate</groupId>
<artifactId>gate-core</artifactId>
<version>8.5.1</version>
<version>8.6.1</version>
</dependency>
<dependency>
......
......@@ -223,14 +223,16 @@ public class App {
features_uncertain.put("ANNOTATION_TYPE", "MANIFESTATION_FINDING");
doc.getAnnotations(annotationSet).add(manifestation_finding.getStartNode(), manifestation_finding.getEndNode(), "FINDING_"+finding_id, manifestation_finding.getFeatures());
}*/
//if(searchSpecimen()) {
Annotation specimen = getClosestAnnotation(doc, sentenceFields, finding, "SPECIMEN", 15, 15, ";");
if(specimen!=null) {
System.out.println("SPECIMEN: " + gate.Utils.stringFor(doc, specimen));
specimen.getFeatures().put(template_value_name, getSendCode(specimen, gate.Utils.stringFor(doc, specimen)));
specimen.getFeatures().put("ANNOTATION_TYPE",specimen.getType());
doc.getAnnotations(annotationSetRelationExtraction).add(specimen.getStartNode(), specimen.getEndNode(), "FINDING_"+finding_id, specimen.getFeatures());
}
//}
Annotation specimen = getClosestAnnotation(doc, sentenceFields, finding, "SPECIMEN", 15, 15, ";");
if(specimen!=null) {
System.out.println("SPECIMEN: " + gate.Utils.stringFor(doc, specimen));
specimen.getFeatures().put(template_value_name, getSendCode(specimen, gate.Utils.stringFor(doc, specimen)));
specimen.getFeatures().put("ANNOTATION_TYPE",specimen.getType());
doc.getAnnotations(annotationSetRelationExtraction).add(specimen.getStartNode(), specimen.getEndNode(), "FINDING_"+finding_id, specimen.getFeatures());
}
// Annotation STUDY_TESTCD = getClosestAnnotation(doc, sentenceFields, finding, "STUDY_TESTCD");
// if(STUDY_TESTCD!=null) {
......@@ -257,29 +259,37 @@ public class App {
doc.getAnnotations(annotationSetRelationExtraction).add(risk_level.getStartNode(), risk_level.getEndNode(), "FINDING_"+finding_id, risk_level.getFeatures());
}
Annotation DOSE_QUANTITY = getClosestAnnotation(doc, sentenceFields, finding, "DOSE_QUANTITY", right_limit, left_limit, null);
if(DOSE_QUANTITY!=null) {
System.out.println("DOSE_QUANTITY: " + gate.Utils.stringFor(doc, DOSE_QUANTITY));
DOSE_QUANTITY.getFeatures().put("ANNOTATION_TYPE",DOSE_QUANTITY.getType());
DOSE_QUANTITY.getFeatures().put(template_value_name, gate.Utils.stringFor(doc, DOSE_QUANTITY));
doc.getAnnotations(annotationSetRelationExtraction).add(DOSE_QUANTITY.getStartNode(), DOSE_QUANTITY.getEndNode(), "FINDING_"+finding_id, DOSE_QUANTITY.getFeatures());
Annotation DOSE = getClosestAnnotation(doc, sentenceFields, finding, "DOSE", right_limit, left_limit, null);
if(DOSE!=null) {
System.out.println("DOSE: " + gate.Utils.stringFor(doc, DOSE));
DOSE.getFeatures().put("ANNOTATION_TYPE",DOSE.getType());
DOSE.getFeatures().put(template_value_name, gate.Utils.stringFor(doc, DOSE));
doc.getAnnotations(annotationSetRelationExtraction).add(DOSE.getStartNode(), DOSE.getEndNode(), "FINDING_"+finding_id, DOSE.getFeatures());
}
Annotation DOSE_FREQUENCY = getClosestAnnotation(doc, sentenceFields, finding, "DOSE_FREQUENCY", right_limit, left_limit, null);
if(DOSE_FREQUENCY!=null) {
System.out.println("DOSE_FREQUENCY: " + gate.Utils.stringFor(doc, DOSE_FREQUENCY));
DOSE_FREQUENCY.getFeatures().put("ANNOTATION_TYPE",DOSE_FREQUENCY.getType());
DOSE_FREQUENCY.getFeatures().put(template_value_name, gate.Utils.stringFor(doc, DOSE_FREQUENCY));
doc.getAnnotations(annotationSetRelationExtraction).add(DOSE_FREQUENCY.getStartNode(), DOSE_FREQUENCY.getEndNode(), "FINDING_"+finding_id, DOSE_FREQUENCY.getFeatures());
}
Annotation DOSE_DURATION = getClosestAnnotation(doc, sentenceFields, finding, "DOSE_DURATION", right_limit, left_limit, null);
if(DOSE_DURATION!=null) {
System.out.println("DOSE_DURATION: " + gate.Utils.stringFor(doc, DOSE_DURATION));
DOSE_DURATION.getFeatures().put("ANNOTATION_TYPE",DOSE_DURATION.getType());
DOSE_DURATION.getFeatures().put(template_value_name, gate.Utils.stringFor(doc, DOSE_DURATION));
doc.getAnnotations(annotationSetRelationExtraction).add(DOSE_DURATION.getStartNode(), DOSE_DURATION.getEndNode(), "FINDING_"+finding_id, DOSE_DURATION.getFeatures());
}
// Annotation DOSE_QUANTITY = getClosestAnnotation(doc, sentenceFields, finding, "DOSE_QUANTITY", right_limit, left_limit, null);
// if(DOSE_QUANTITY!=null) {
// System.out.println("DOSE_QUANTITY: " + gate.Utils.stringFor(doc, DOSE_QUANTITY));
// DOSE_QUANTITY.getFeatures().put("ANNOTATION_TYPE",DOSE_QUANTITY.getType());
// DOSE_QUANTITY.getFeatures().put(template_value_name, gate.Utils.stringFor(doc, DOSE_QUANTITY));
// doc.getAnnotations(annotationSetRelationExtraction).add(DOSE_QUANTITY.getStartNode(), DOSE_QUANTITY.getEndNode(), "FINDING_"+finding_id, DOSE_QUANTITY.getFeatures());
// }
//
// Annotation DOSE_FREQUENCY = getClosestAnnotation(doc, sentenceFields, finding, "DOSE_FREQUENCY", right_limit, left_limit, null);
// if(DOSE_FREQUENCY!=null) {
// System.out.println("DOSE_FREQUENCY: " + gate.Utils.stringFor(doc, DOSE_FREQUENCY));
// DOSE_FREQUENCY.getFeatures().put("ANNOTATION_TYPE",DOSE_FREQUENCY.getType());
// DOSE_FREQUENCY.getFeatures().put(template_value_name, gate.Utils.stringFor(doc, DOSE_FREQUENCY));
// doc.getAnnotations(annotationSetRelationExtraction).add(DOSE_FREQUENCY.getStartNode(), DOSE_FREQUENCY.getEndNode(), "FINDING_"+finding_id, DOSE_FREQUENCY.getFeatures());
// }
//
// Annotation DOSE_DURATION = getClosestAnnotation(doc, sentenceFields, finding, "DOSE_DURATION", right_limit, left_limit, null);
// if(DOSE_DURATION!=null) {
// System.out.println("DOSE_DURATION: " + gate.Utils.stringFor(doc, DOSE_DURATION));
// DOSE_DURATION.getFeatures().put("ANNOTATION_TYPE",DOSE_DURATION.getType());
// DOSE_DURATION.getFeatures().put(template_value_name, gate.Utils.stringFor(doc, DOSE_DURATION));
// doc.getAnnotations(annotationSetRelationExtraction).add(DOSE_DURATION.getStartNode(), DOSE_DURATION.getEndNode(), "FINDING_"+finding_id, DOSE_DURATION.getFeatures());
// }
Annotation STUDY_DAY_FINDING = getClosestAnnotation(doc, sentenceFields, finding, "STUDY_DAY_FINDING", right_limit, left_limit, null);
if(STUDY_DAY_FINDING!=null) {
......@@ -489,8 +499,9 @@ public class App {
closest = annotation_type;
token_between_closest = 0;
}
if(token_between!=null && tokensDoNotContain(token_between, avoid_token_between) && ((token_between.size()<token_between_closest) || token_between.size()==token_between_closest && beforeFinding)) {
//token_between.inDocumentOrder();
//if token do not contain in the middle specific tokens and the quantity of tokens is less than the closest one or are the same quantity but the closest one is not from the left side ....
if(token_between!=null && tokensDoNotContain(token_between, avoid_token_between) && ((token_between.size()<token_between_closest) || token_between.size()==token_between_closest && !beforeFinding)) {
closest = annotation_type;
token_between_closest = token_between.size();
}
......
package es.bsc.inb.ades.relation.extraction.parse;
public class Node {
}
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