| 1 | package Alvis::NLPPlatform::UserNLPWrappers; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Alvis::NLPPlatform::NLPWrappers; | ||
| 7 | |||
| 8 | our @ISA = ("Alvis::NLPPlatform::NLPWrappers"); | ||
| 9 | |||
| 10 | our $VERSION=$Alvis::NLPPlatform::VERSION; | ||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | Alvis::NLPPlatform::UserNLPWRapper - User interface for customizing | ||
| 15 | the NLP wrappers used for linguistically annotating of XML documents | ||
| 16 | in Alvis | ||
| 17 | |||
| 18 | =head1 SYNOPSIS | ||
| 19 | |||
| 20 | use Alvis::NLPPlatform::UserNLPWrapper; | ||
| 21 | |||
| 22 | Alvis::NLPPlatform::UserNLPWrappers->tokenize($h_config,$doc_hash); | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | This module is a mere infterface for allowing the cutomisation of the | ||
| 27 | NLP Wrappers. Anyone who wants to integrated a new NLP tool have to | ||
| 28 | overwrite the default wrapper. The aim of this module is to make | ||
| 29 | easier the development a specific wrapper, its integration and its use | ||
| 30 | in the platform. | ||
| 31 | |||
| 32 | |||
| 33 | Before developing a new wraper, it is necessary to copy and modify | ||
| 34 | this file in a local directory and add this directory to the PERL5LIB | ||
| 35 | variable. | ||
| 36 | |||
| 37 | =head1 METHODS | ||
| 38 | |||
| 39 | |||
| 40 | =head2 tokenize() | ||
| 41 | |||
| 42 | tokenize($h_config, $doc_hash); | ||
| 43 | |||
| 44 | This method carries out the tokenisation process of the input | ||
| 45 | document. C<$doc_hash> is the hashtable containing containing all the | ||
| 46 | annotations of the input document. See documentation in | ||
| 47 | C<Alvis::NLPPlatform::NLPWrappers>. It is not recommended to | ||
| 48 | overwrite this method. | ||
| 49 | |||
| 50 | C<$hash_config> is the | ||
| 51 | reference to the hashtable containing the variables defined in the | ||
| 52 | configuration file. | ||
| 53 | |||
| 54 | The method returns the number of tokens. | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | |||
| 59 | sub tokenize { | ||
| 60 | my @arg = @_; | ||
| 61 | |||
| 62 | my $class = shift @arg; | ||
| 63 | |||
| 64 | return($class->SUPER::tokenize(@arg)); | ||
| 65 | |||
| 66 | } | ||
| 67 | |||
| 68 | =head2 scan_ne() | ||
| 69 | |||
| 70 | scan_ne($h_config, $doc_hash); | ||
| 71 | |||
| 72 | This method wraps the Named entity recognition and tagging | ||
| 73 | step. C<$doc_hash> is the hashtable containing containing all the | ||
| 74 | annotations of the input document. It aims at annotating semantic | ||
| 75 | units with syntactic and semantic types. Each text sequence | ||
| 76 | corresponding to a named entity will be tagged with a unique tag | ||
| 77 | corresponding to its semantic value (for example a "gene" type for | ||
| 78 | gene names, "species" type for species names, etc.). All these text | ||
| 79 | sequences are also assumed to be equivalent to nouns: the tagger | ||
| 80 | dynamically produces linguistic units equivalent to words or noun | ||
| 81 | phrases. | ||
| 82 | |||
| 83 | C<$hash_config> is the | ||
| 84 | reference to the hashtable containing the variables defined in the | ||
| 85 | configuration file. | ||
| 86 | |||
| 87 | =cut | ||
| 88 | |||
| 89 | |||
| 90 | sub scan_ne | ||
| 91 | { | ||
| 92 | my @arg = @_; | ||
| 93 | |||
| 94 | my $class = shift @arg; | ||
| 95 | |||
| 96 | $class->SUPER::scan_ne(@arg); | ||
| 97 | |||
| 98 | } | ||
| 99 | |||
| 100 | =head2 word_segmentation() | ||
| 101 | |||
| 102 | word_segmentation($h_config, $doc_hash); | ||
| 103 | |||
| 104 | This method wraps the default word segmentation step. C<$doc_hash> is | ||
| 105 | the hashtable containing containing all the annotations of the input | ||
| 106 | document. | ||
| 107 | |||
| 108 | C<$hash_config> is the | ||
| 109 | reference to the hashtable containing the variables defined in the | ||
| 110 | configuration file. | ||
| 111 | |||
| 112 | =cut | ||
| 113 | |||
| 114 | sub word_segmentation | ||
| 115 | { | ||
| 116 | my @arg = @_; | ||
| 117 | |||
| 118 | my $class = shift @arg; | ||
| 119 | |||
| 120 | $class->SUPER::word_segmentation(@arg); | ||
| 121 | |||
| 122 | } | ||
| 123 | |||
| 124 | =head2 sentence_segmentation() | ||
| 125 | |||
| 126 | sentence_segmentation($h_config, $doc_hash); | ||
| 127 | |||
| 128 | This method wraps the default sentence segmentation step. | ||
| 129 | C<$doc_hash> is the hashtable containing containing all the | ||
| 130 | annotations of the input document. | ||
| 131 | |||
| 132 | C<$hash_config> is the | ||
| 133 | reference to the hashtable containing the variables defined in the | ||
| 134 | configuration file. | ||
| 135 | |||
| 136 | =cut | ||
| 137 | |||
| 138 | sub sentence_segmentation | ||
| 139 | { | ||
| 140 | my @arg = @_; | ||
| 141 | |||
| 142 | my $class = shift @arg; | ||
| 143 | |||
| 144 | $class->SUPER::sentence_segmentation(@arg); | ||
| 145 | |||
| 146 | } | ||
| 147 | |||
| 148 | =head2 pos_tag() | ||
| 149 | |||
| 150 | pos_tag($h_config, $doc_hash); | ||
| 151 | |||
| 152 | The method wraps the Part-of-Speech (POS) tagging. C<$doc_hash> is | ||
| 153 | the hashtable containing containing all the annotations of the input | ||
| 154 | document. For every input word, the wrapped Part-Of-Speech tagger | ||
| 155 | outputs its tag. | ||
| 156 | |||
| 157 | C<$hash_config> is the | ||
| 158 | reference to the hashtable containing the variables defined in the | ||
| 159 | configuration file. | ||
| 160 | |||
| 161 | =cut | ||
| 162 | |||
| 163 | sub pos_tag | ||
| 164 | { | ||
| 165 | my @arg = @_; | ||
| 166 | |||
| 167 | my $class = shift @arg; | ||
| 168 | |||
| 169 | $class->SUPER::pos_tag(@arg); | ||
| 170 | |||
| 171 | } | ||
| 172 | |||
| 173 | =head2 lemmatization() | ||
| 174 | |||
| 175 | lemmatization($h_config, $doc_hash); | ||
| 176 | |||
| 177 | This methods wraps the lemmatizer. C<$doc_hash> is the hashtable | ||
| 178 | containing containing all the annotations of the input document. For | ||
| 179 | every input word, the wrapped lemmatizer outputs its lemma i.e. the | ||
| 180 | canonical form of the word.. | ||
| 181 | |||
| 182 | C<$hash_config> is the | ||
| 183 | reference to the hashtable containing the variables defined in the | ||
| 184 | configuration file. | ||
| 185 | |||
| 186 | =cut | ||
| 187 | |||
| 188 | sub lemmatization | ||
| 189 | { | ||
| 190 | my @arg = @_; | ||
| 191 | |||
| 192 | my $class = shift @arg; | ||
| 193 | |||
| 194 | $class->SUPER::lemmatization(@arg); | ||
| 195 | |||
| 196 | } | ||
| 197 | |||
| 198 | |||
| 199 | =head2 term_tag() | ||
| 200 | |||
| 201 | term_tag($h_config, $doc_hash); | ||
| 202 | |||
| 203 | The method wraps the term tagging step of the ALVIS NLP | ||
| 204 | Platform. C<$doc_hash> is the hashtable containing containing all the | ||
| 205 | annotations of the input document. This step aims at recognizing terms | ||
| 206 | in the documents differing from named entities, like I<gene | ||
| 207 | expression>, I<spore coat cell>. | ||
| 208 | |||
| 209 | C<$hash_config> is the | ||
| 210 | reference to the hashtable containing the variables defined in the | ||
| 211 | configuration file. | ||
| 212 | |||
| 213 | =cut | ||
| 214 | |||
| 215 | sub term_tag | ||
| 216 | { | ||
| 217 | my @arg = @_; | ||
| 218 | |||
| 219 | my $class = shift @arg; | ||
| 220 | |||
| 221 | $class->SUPER::term_tag(@arg); | ||
| 222 | |||
| 223 | } | ||
| 224 | |||
| 225 | =head2 syntactic_parsing() | ||
| 226 | |||
| 227 | syntactic_parsing($h_config, $doc_hash); | ||
| 228 | |||
| 229 | This method wraps the sentence parsing. It aims at exhibiting the | ||
| 230 | graph of the syntactic dependency relations between the words of the | ||
| 231 | sentence. C<$doc_hash> is the hashtable containing containing all the | ||
| 232 | annotations of the input document. | ||
| 233 | |||
| 234 | C<$hash_config> is the | ||
| 235 | reference to the hashtable containing the variables defined in the | ||
| 236 | configuration file. | ||
| 237 | |||
| 238 | =cut | ||
| 239 | |||
| 240 | |||
| 241 | sub syntactic_parsing | ||
| 242 | { | ||
| 243 | my @arg = @_; | ||
| 244 | |||
| 245 | my $class = shift @arg; | ||
| 246 | |||
| 247 | $class->SUPER::syntactic_parsing(@arg); | ||
| 248 | |||
| 249 | } | ||
| 250 | |||
| 251 | =head2 semantic_feature_tagging() | ||
| 252 | |||
| 253 | semantic_feature_tagging($h_config, $doc_hash) | ||
| 254 | |||
| 255 | The method wraps the semantic typing step, that is the attachment of a | ||
| 256 | semantic type to the words, terms and named-entities (referred to as | ||
| 257 | lexical items in the following) in documents according to the | ||
| 258 | conceptual hierarchies of the ontology of the domain. | ||
| 259 | |||
| 260 | C<$doc_hash> is the hashtable containing containing all the | ||
| 261 | annotations of the input document. | ||
| 262 | |||
| 263 | C<$hash_config> is the | ||
| 264 | reference to the hashtable containing the variables defined in the | ||
| 265 | configuration file. | ||
| 266 | |||
| 267 | =cut | ||
| 268 | |||
| 269 | sub semantic_feature_tagging | ||
| 270 | { | ||
| 271 | my @arg = @_; | ||
| 272 | |||
| 273 | my $class = shift @arg; | ||
| 274 | |||
| 275 | $class->SUPER::semantic_feature_tagging(@arg); | ||
| 276 | |||
| 277 | } | ||
| 278 | |||
| 279 | =head2 semantic_relation_tagging() | ||
| 280 | |||
| 281 | semantic_relation_tagging($h_config, $doc_hash) | ||
| 282 | |||
| 283 | |||
| 284 | This method wraps the semantic relation identification step. These | ||
| 285 | semantic relation annotations give another level of semantic | ||
| 286 | representation of the document that makes explicit the role that these | ||
| 287 | semantic units (usually named-entities and/or terms) play with respect | ||
| 288 | to each other, pertaining to the ontology of the domain. | ||
| 289 | |||
| 290 | C<$doc_hash> is the hashtable containing containing all the | ||
| 291 | annotations of the input document. | ||
| 292 | |||
| 293 | C<$hash_config> is the | ||
| 294 | reference to the hashtable containing the variables defined in the | ||
| 295 | configuration file. | ||
| 296 | |||
| 297 | =cut | ||
| 298 | |||
| 299 | sub semantic_relation_tagging | ||
| 300 | { | ||
| 301 | my @arg = @_; | ||
| 302 | |||
| 303 | my $class = shift @arg; | ||
| 304 | |||
| 305 | $class->SUPER::semantic_relation_tagging(@arg); | ||
| 306 | |||
| 307 | } | ||
| 308 | |||
| 309 | =head2 anaphora_resolution() | ||
| 310 | |||
| 311 | anaphora_resolution($h_config, $doc_hash) | ||
| 312 | |||
| 313 | The methods wraps the anaphora solver. C<$doc_hash> is the hashtable | ||
| 314 | containing containing all the annotations of the input document. It | ||
| 315 | aims at identifing and solving the anaphora present in a document. | ||
| 316 | |||
| 317 | C<$hash_config> is the | ||
| 318 | reference to the hashtable containing the variables defined in the | ||
| 319 | configuration file. | ||
| 320 | |||
| 321 | =cut | ||
| 322 | |||
| 323 | sub anaphora_resolution | ||
| 324 | { | ||
| 325 | my @arg = @_; | ||
| 326 | |||
| 327 | my $class = shift @arg; | ||
| 328 | |||
| 329 | $class->SUPER::anaphora_resolution(@arg); | ||
| 330 | |||
| 331 | } | ||
| 332 | |||
| 333 | # =head1 ENVIRONMENT | ||
| 334 | |||
| 335 | =head1 SEE ALSO | ||
| 336 | |||
| 337 | Alvis web site: http://www.alvis.info | ||
| 338 | |||
| 339 | =head1 AUTHORS | ||
| 340 | |||
| 341 | Thierry Hamon <thierry.hamon@lipn.univ-paris13.fr> and Julien Deriviere <julien.deriviere@lipn.univ-paris13.fr> | ||
| 342 | |||
| 343 | =head1 LICENSE | ||
| 344 | |||
| 345 | Copyright (C) 2005 by Thierry Hamon and Julien Deriviere | ||
| 346 | |||
| 347 | This program is free software; you can redistribute it and/or modify | ||
| 348 | it under the same terms as Perl itself, either Perl version 5.8.6 or, | ||
| 349 | at your option, any later version of Perl 5 you may have available. | ||
| 350 | |||
| 351 | =cut | ||
| 352 | |||
| 353 | 1; |