« blib/lib/Lingua/Ogmios/NLPWrappers/BasicNER.pm
↑ Summary
blib/lib/Lingua/Ogmios/LearningDataSet/Attribute.pm »
| 1 | package Lingua::Ogmios::NLPWrappers::AssertionDetection; | ||
| 2 | |||
| 3 | |||
| 4 | our $VERSION='0.1'; | ||
| 5 | |||
| 6 | |||
| 7 | use Lingua::Ogmios::NLPWrappers::Wrapper; | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | |||
| 12 | our @ISA = qw(Lingua::Ogmios::NLPWrappers::Wrapper); | ||
| 13 | |||
| 14 | sub new { | ||
| 15 | my ($class, $config, $tmpfile_prefix, $logfile, $position, $no_standard_output) = @_; | ||
| 16 | |||
| 17 | warn "[LOG] Creating a wrapper of the AssertionDetection\n"; | ||
| 18 | |||
| 19 | |||
| 20 | my $AssertionDetection = $class->SUPER::new($config, $tmpfile_prefix, $logfile, $position, $no_standard_output); | ||
| 21 | |||
| 22 | $AssertionDetection->_input_filename($tmpfile_prefix . ".AssertionDetection.in"); | ||
| 23 | $AssertionDetection->_output_filename($tmpfile_prefix . ".AssertionDetection.out"); | ||
| 24 | |||
| 25 | return($AssertionDetection); | ||
| 26 | |||
| 27 | } | ||
| 28 | |||
| 29 | sub _processAssertionDetection { | ||
| 30 | my ($self, $lang) = @_; | ||
| 31 | |||
| 32 | warn "[LOG] POS tagger\n"; | ||
| 33 | |||
| 34 | $lang = $self->_documentSet->[0]->getAnnotations->getLanguage; | ||
| 35 | |||
| 36 | return($self->_exec_command($self->_defineCommandLine($self->_config->commands($lang)->{AssertionDetection_CMD} . " < " . $self->_input_filename . ">" . $self->_output_filename))); | ||
| 37 | |||
| 38 | warn "[LOG]\n"; | ||
| 39 | } | ||
| 40 | |||
| 41 | sub _inputAssertionDetection { | ||
| 42 | my ($self) = @_; | ||
| 43 | |||
| 44 | warn "[LOG] making AssertionDetection input\n"; | ||
| 45 | |||
| 46 | warn "[LOG] done\n"; | ||
| 47 | } | ||
| 48 | |||
| 49 | |||
| 50 | sub _outputAssertionDetection { | ||
| 51 | my ($self) = @_; | ||
| 52 | |||
| 53 | warn "[LOG] . Parsing " . $self->_output_filename . "\n"; | ||
| 54 | |||
| 55 | warn "[LOG] done\n"; | ||
| 56 | } | ||
| 57 | |||
| 58 | sub run { | ||
| 59 | my ($self, $documentSet) = @_; | ||
| 60 | |||
| 61 | # Set variables according the the configuration | ||
| 62 | |||
| 63 | $self->_documentSet($documentSet); | ||
| 64 | |||
| 65 | warn "[LOG] " . $self->_config->comments . " ... \n"; | ||
| 66 | |||
| 67 | $self->_inputAssertionDetection; | ||
| 68 | |||
| 69 | my $command_line = $self->_processAssertionDetection; | ||
| 70 | |||
| 71 | # if ($self->_position eq "last") { | ||
| 72 | # # TODO | ||
| 73 | if (($self->_position eq "last") && ($self->_no_standard_output)) { | ||
| 74 | warn "print no standard output\n"; | ||
| 75 | } else { | ||
| 76 | $self->_outputAssertionDetection; | ||
| 77 | } | ||
| 78 | # $self->_outputParsing; | ||
| 79 | |||
| 80 | |||
| 81 | # Put log information | ||
| 82 | |||
| 83 | my $information = { 'software_name' => $self->_config->name, | ||
| 84 | 'comments' => $self->_config->comments, | ||
| 85 | 'command_line' => $command_line, | ||
| 86 | }; | ||
| 87 | $self->_log($information); | ||
| 88 | |||
| 89 | |||
| 90 | # die "You call the 'rum' method of the wrapper class base\n | ||
| 91 | # You should define a 'run' method for your wrapper\n"; | ||
| 92 | warn "[LOG] done\n"; | ||
| 93 | } | ||
| 94 | |||
| 95 | sub checkNegation { | ||
| 96 | my ($self, $term, $document, $windowLimitFrom, $windowLimitTo, $wordLimit) = @_; | ||
| 97 | |||
| 98 | return($self->checkMarkerFromTagSuffix($term, "neg", $document, $windowLimitFrom, $windowLimitTo, $wordLimit)); | ||
| 99 | } | ||
| 100 | |||
| 101 | |||
| 102 | 1; | ||
| 103 | |||
| 104 | |||
| 105 | __END__ |