Author image Eduardo Iturrate
and 1 contributors


Lingua::ConText - Perl extension for finding the context of a word in a sentence.


  use Lingua::ConText qw( applyContext );

  my $text = 'The patient denied a history of pneumonia.';
  my $result = applyContext( 'pneumonia', $text );
  print join "\n", @{$result}; 
  # pneumonia
  # The patient denied a history of pneumonia.
  # negated
  # historical
  # patient


This is a perl implementation of the ConText algorithm which uses a list of phrases to determine the context of a given concept within a sentence.

This is a port from the java code authored by Stephane Meystre, Julien Charles Thibault, Oscar Ferrandez Escamez made available online.


None by default.

applyContext( $concept, $sentence );

  return [ 
    $concept, $sentence, $negation_context, 
    $temporality_context, $experiencer_context 

  $negation_context; # affirmed, negated, possible
  $temporality_context; # recent, hypothetical, historical
  $experiencer_context; # patient, other


The ConText documentation and downloads for java implementation can be found here:

Background information:

Chapman WW, Dowling JN, Chu DL. ConText: An algorithm for identifying contextual features from clinical text. In: BioNLP Workshop of the Association for Computational Linguistics Prague, Czech Republic; 2007. p. 81-88.

Harkema H, Thornblade T, Dowling J, Chapman WW. Portability of ConText: An Algorithm for determining Negation, Experiencer, and Temporal Status from Clinical Reports. J Biomed Inform. 2009;42(5):839-851.


Eduardo Iturrate, <>


Copyright (C) 2013 by Eduardo Iturrate

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.