| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | ####################################################################### | ||
| 4 | # | ||
| 5 | # Last Update: 16/09/2015 (mm/dd/yyyy date format) | ||
| 6 | # | ||
| 7 | # Copyright (C) 2002 Thierry Hamon | ||
| 8 | # | ||
| 9 | # Written by thierry.hamon@limsi.fr | ||
| 10 | # | ||
| 11 | # Author : Thierry Hamon | ||
| 12 | # Email : thierry.hamon@limsi.fr | ||
| 13 | # URL : https://perso.limsi.fr/hamon/ | ||
| 14 | # | ||
| 15 | ######################################################################## | ||
| 16 | |||
| 17 | =head1 NAME | ||
| 18 | |||
| 19 | TermTagger-brat.pl -- A Perl script for tagging text with terms (Brat format output) | ||
| 20 | |||
| 21 | =head1 SYNOPSIS | ||
| 22 | |||
| 23 | TermTagger.pl [options] corpus termlist selected_term_list lemmatised_corpus | ||
| 24 | |||
| 25 | =head1 OPTIONS | ||
| 26 | |||
| 27 | =over 4 | ||
| 28 | |||
| 29 | =item B<--help> brief help message | ||
| 30 | |||
| 31 | =back | ||
| 32 | |||
| 33 | =head1 DESCRIPTION | ||
| 34 | |||
| 35 | This script tags a corpus with terms and provide a output compatible with Brat (<http://brat.nlplab.org/>). Corpus (C<corpus>) is a file | ||
| 36 | with one sentence per line. Term list (C<termlist>) is a file | ||
| 37 | containing one term per line. For each term, additionnal information | ||
| 38 | (as canonical form) can be given after a column. Each line of the | ||
| 39 | output file (C<selected_term_list>) contains the sentence number, the | ||
| 40 | term, additional information, all separated by a tabulation character. | ||
| 41 | |||
| 42 | ==hea1 EXAMPLES | ||
| 43 | |||
| 44 | Tag the textual corpus in C<corpus-test.txt> with terms in the file | ||
| 45 | C<termlist-test.lst> and record the results in the file | ||
| 46 | C<corpus-test.ann>) according to the Brat input format: | ||
| 47 | |||
| 48 | TermTagger-brat.pl corpus-test.txt termlist-test.lst corpus-test.ann | ||
| 49 | |||
| 50 | |||
| 51 | =head1 SEE ALSO | ||
| 52 | |||
| 53 | Alvis web site: http://www.alvis.info | ||
| 54 | |||
| 55 | Brat: http://brat.nlplab.org/ | ||
| 56 | |||
| 57 | =head1 AUTHORS | ||
| 58 | |||
| 59 | Thierry Hamon <thierry.hamon@limsi.fr> | ||
| 60 | |||
| 61 | =head1 LICENSE | ||
| 62 | |||
| 63 | Copyright (C) 2006 by Thierry Hamon | ||
| 64 | |||
| 65 | This library is free software; you can redistribute it and/or modify | ||
| 66 | it under the same terms as Perl itself, either Perl version 5.8.6 or, | ||
| 67 | at your option, any later version of Perl 5 you may have available. | ||
| 68 | |||
| 69 | =cut | ||
| 70 | |||
| 71 | use strict; | ||
| 72 | use warnings; | ||
| 73 | |||
| 74 | use Alvis::TermTagger; | ||
| 75 | |||
| 76 | use Getopt::Long; | ||
| 77 | use Pod::Usage; | ||
| 78 | |||
| 79 | # Process Option | ||
| 80 | |||
| 81 | my $man = 0; | ||
| 82 | my $help = 0; | ||
| 83 | |||
| 84 | GetOptions('help|?' => \$help) or pod2usage(2); | ||
| 85 | pod2usage(1) if $help; | ||
| 86 | # pod2usage(-exitstatus => 0, -verbose => 2) if $man; | ||
| 87 | # , man => \$man | ||
| 88 | |||
| 89 | Alvis::TermTagger::termtagging_brat($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[3]); | ||
| 90 | |||
| 91 | |||
| 92 |