From 2a4f7cd2b6c54428ec91d50dcba53ea129cc382f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lamarque?= Date: Wed, 15 Apr 2020 14:12:23 +0200 Subject: [PATCH] Upgrading ConText component to FastContext within annotator UI (cf. annotators issue #28 : https://github.com/sifrproject/annotators/issues/28) --- app/assets/javascripts/bp_annotator.js | 6 +----- app/controllers/annotator_controller.rb | 10 ++-------- app/views/annotator/index.html.haml | 25 +++++++------------------ 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/app/assets/javascripts/bp_annotator.js b/app/assets/javascripts/bp_annotator.js index 18c54f6b7..d952fd64b 100644 --- a/app/assets/javascripts/bp_annotator.js +++ b/app/assets/javascripts/bp_annotator.js @@ -90,11 +90,7 @@ function get_annotations() { params.expand_mappings = jQuery("#expand_mappings").is(':checked'); params.ncbo_slice = (("ncbo_slice" in BP_CONFIG) ? BP_CONFIG.ncbo_slice : ''); - params.negation = jQuery("#negation").is(':checked'); - params.experiencer = jQuery("#experiencer").is(':checked'); - params.temporality = jQuery("#temporality").is(':checked'); - params.certainty = jQuery("#certainty").is(':checked'); - + params.negation = params.experiencer = params.temporality = params.certainty = params.fast_context = jQuery("#fast_context").is(':checked'); params.score_threshold = jQuery("#score_threshold").val(); params.confidence_threshold = jQuery("#confidence_threshold").val(); diff --git a/app/controllers/annotator_controller.rb b/app/controllers/annotator_controller.rb index ada22f1d1..94f5fe92a 100644 --- a/app/controllers/annotator_controller.rb +++ b/app/controllers/annotator_controller.rb @@ -52,10 +52,7 @@ def create :exclude_numbers => params[:exclude_numbers] ||= "false", # service default is false :whole_word_only => params[:whole_word_only] ||= "true", # service default is true :exclude_synonyms => params[:exclude_synonyms] ||= "false", # service default is false - :negation => params[:negation] ||= "false", # service default is false - :experiencer => params[:experiencer] ||= "false", # service default is false - :temporality => params[:temporality] ||= "false", # service default is false - :certainty => params[:certainty] ||= "false", + :fast_context => params[:fast_context] ||= "false", # service default is false :score => params[:score], :score_threshold => params[:score_threshold] ||=-1, :confidence_threshold => params[:confidence_threshold] ||=-1, @@ -74,10 +71,7 @@ def create query += "&score=" + options[:score] unless options[:score] == "" query += "&score_threshold=" + options[:score_threshold] unless options[:score] == "" or options[:score_threshold]==-1 query += "&confidence_threshold=" + options[:confidence_threshold] unless options[:score] == "" or options[:confidence_threshold]==-1 - query += "&negation=" + options[:negation] unless options[:negation].empty? - query += "&experiencer=" + options[:experiencer] unless options[:experiencer].empty? - query += "&temporality=" + options[:temporality] unless options[:temporality].empty? - query += "&certainty=" + options[:certainty] unless options[:certainty].empty? + query += "&fast_context=" + options[:fast_context] unless options[:fast_context].empty? query += "&ontologies=" + CGI.escape(options[:ontologies].join(',')) unless options[:ontologies].empty? query += "&semantic_types=" + options[:semantic_types].join(',') unless options[:semantic_types].empty? query += "&semantic_groups=" + options[:semantic_groups].join(',') unless options[:semantic_groups].empty? diff --git a/app/views/annotator/index.html.haml b/app/views/annotator/index.html.haml index 8d588183b..7fb19ee5d 100644 --- a/app/views/annotator/index.html.haml +++ b/app/views/annotator/index.html.haml @@ -58,26 +58,15 @@ = check_box_tag :lemmatize, :all, false, :id => "lemmatize" = label_tag :lemmatize, "Lemmatize (beta)" - %div{:class => "panel panel-primary", :style => "width: 17em; display: inline-block; vertical-align: top; height: 256px;"} + %div{:class => "panel panel-primary", :style => "width: 20em; display: inline-block; vertical-align: top;"} %div{:class => "panel-heading"} - %h3{:class => "panel-title"} NegEx / ConText + %h3{:class => "panel-title"} FastContext %div{:class => "panel-body"} - %p{title: "Detect if a concept has been negated (affirmed, negated)", style: "margin-top: 40px;"} - = check_box_tag :negation, :all, false, :id => "negation" - = label_tag :negation, "Detect negation" - = help_icon("/annotator", {:title => "Detect if a concept has been negated (affirmed, negated, possible)"}).html_safe - %p{title: "Detect who experienced the found concept (patient, other)"} - = check_box_tag :experiencer, :all, false, :id => "experiencer" - = label_tag :experiencer, "Detect experiencer" - = help_icon("/annotator", {:title => "Detect who experienced the found concept (patient, other)"}).html_safe - %p{title: "Detect when the annotated concept occurred (recent, historical, hypothetical)"} - = check_box_tag :temporality, :all, false, :id => "temporality" - = label_tag :temporality, "Detect temporality" - = help_icon("/annotator", {:title => "Detect when the annotated concept occurred (recent, historical, hypothetical)"}).html_safe - %p{title: "Detect if the annotated concept is uncertain (certain, uncertain)"} - = check_box_tag :certainty, :all, false, :id => "certainty" - = label_tag :certainty, "Detect uncertainty" - = help_icon("/annotator", {:title => "Detect if an annotated concept is uncertain (certain, uncertain)"}).html_safe + - faxt_context_tooltip = "Enable FastContext to detect : if a concept has been negated (affirmed, negated), who experienced the found concept (patient, other), when the annotated concept occurred (recent, historical, hypothetical), and/or if the annotated concept is uncertain (certain, uncertain)" + %p{title: faxt_context_tooltip, style: ""} + = check_box_tag :fast_context, :all, false, :id => "fast_context" + = label_tag :fast_context, "Enable/disable FastContext" + = help_icon("/annotator", {:title => faxt_context_tooltip}).html_safe %div %b Ancestors Level: