Lingua-Sentence-1.04/0000755000175000017500000000000012103044255013337 5ustar achimachimLingua-Sentence-1.04/META.yml0000644000175000017500000000120112103020366014577 0ustar achimachim--- abstract: 'Perl extension for breaking text paragraphs into sentences' author: - 'Achim Ruopp, ' build_requires: ExtUtils::MakeMaker: 6.59 Test::More: 0.47 configure_requires: ExtUtils::MakeMaker: 6.59 distribution_type: module dynamic_config: 1 generated_by: 'Module::Install version 1.06' license: lgpl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Lingua-Sentence no_index: directory: - inc - share - t requires: Carp: 0 File::ShareDir: 1.02 perl: 5.8.8 resources: license: http://opensource.org/licenses/lgpl-license.php version: 1.04 Lingua-Sentence-1.04/lib/0000755000175000017500000000000012103044255014105 5ustar achimachimLingua-Sentence-1.04/lib/Lingua/0000755000175000017500000000000012103044255015324 5ustar achimachimLingua-Sentence-1.04/lib/Lingua/Sentence.pm0000644000175000017500000002076312103043401017426 0ustar achimachimpackage Lingua::Sentence; use 5.008008; use strict; use warnings; use Carp qw(croak); use File::ShareDir 'dist_dir'; our $VERSION = '1.04'; # Preloaded methods go here. sub new { ref(my $class= shift) and croak "Class name needed"; my $langid = shift; if($langid !~ /^[a-z][a-z]$/) { croak "Invalid language id: $langid"; } my $prefixfile = shift; # Try loading nonbreaking prefix file specified in constructor my $dir = dist_dir('Lingua-Sentence'); if(defined($prefixfile)) { if(!(-e $prefixfile)) { print STDERR "WARNING: Specified prefix file '$prefixfile' does not exist, attempting fall-back to $langid version...\n"; $prefixfile = "$dir/nonbreaking_prefix.$langid"; } } else { $prefixfile = "$dir/nonbreaking_prefix.$langid"; } my %NONBREAKING_PREFIX; #default back to English if we don't have a language-specific prefix file if (!(-e $prefixfile)) { $prefixfile = "$dir/nonbreaking_prefix.en"; print STDERR "WARNING: No known abbreviations for language '$langid', attempting fall-back to English version...\n"; die ("ERROR: No abbreviations files found in $dir\n") unless (-e $prefixfile); } if (-e "$prefixfile") { open(PREFIX, "<:utf8", "$prefixfile"); while () { my $item = $_; chomp($item); if (($item) && (substr($item,0,1) ne "#")) { if ($item =~ /(.*)[\s]+(\#NUMERIC_ONLY\#)/) { $NONBREAKING_PREFIX{$1} = 2; } else { $NONBREAKING_PREFIX{$item} = 1; } } } close(PREFIX); } my $self = { LangID => $langid, Nonbreaking => \%NONBREAKING_PREFIX }; bless $self,$class; return $self; } sub split { my $self = shift; if(!ref $self) { return "Unnamed $self"; } my $text = shift; if(!$text) { return ''; } return _preprocess($self,$text); } sub split_array { my $self = shift; if(!ref $self) { return "Unnamed $self"; } my $text = shift; if(!$text) { return (); } my $splittext = _preprocess($self,$text); chomp $splittext; return split(/\n/,$splittext); } sub _preprocess { my ($self,$text) = @_; #####add sentence breaks as needed##### #non-period end of sentence markers (?!) followed by sentence starters. $text =~ s/([?!]) +([\'\"\(\[\¿\¡\p{IsPi}]*[\p{IsUpper}])/$1\n$2/g; #multi-dots followed by sentence starters $text =~ s/(\.[\.]+) +([\'\"\(\[\¿\¡\p{IsPi}]*[\p{IsUpper}])/$1\n$2/g; # add breaks for sentences that end with some sort of punctuation inside a quote or parenthetical and are followed by a possible sentence starter punctuation and upper case $text =~ s/([?!\.][\ ]*[\'\"\)\]\p{IsPf}]+) +([\'\"\(\[\¿\¡\p{IsPi}]*[\ ]*[\p{IsUpper}])/$1\n$2/g; # add breaks for sentences that end with some sort of punctuation are followed by a sentence starter punctuation and upper case $text =~ s/([?!\.]) +([\'\"\(\[\¿\¡\p{IsPi}]+[\ ]*[\p{IsUpper}])/$1\n$2/g; # special punctuation cases are covered. Check all remaining periods. my $word; my $i; my @words = split(/ +/,$text); $text = ""; for ($i=0;$i<(scalar(@words)-1);$i++) { if ($words[$i] =~ /([\p{IsAlnum}\.\-]*)([\'\"\)\]\%\p{IsPf}]*)(\.+)$/) { #check if $1 is a known honorific and $2 is empty, never break my $prefix = $1; my $starting_punct = $2; if($prefix && $self->{Nonbreaking}{$prefix} && $self->{Nonbreaking}{$prefix} == 1 && !$starting_punct) { #not breaking; } elsif ($words[$i] =~ /(\.)[\p{IsUpper}\-]+(\.+)$/) { #not breaking - upper case acronym } elsif($words[$i+1] =~ /^([ ]*[\'\"\(\[\¿\¡\p{IsPi}]*[ ]*[\p{IsUpper}0-9])/) { #the next word has a bunch of initial quotes, maybe a space, then either upper case or a number $words[$i] = $words[$i]."\n" unless ($prefix && $self->{Nonbreaking}{$prefix} && $self->{Nonbreaking}{$prefix} == 2 && !$starting_punct && ($words[$i+1] =~ /^[0-9]+/)); #we always add a return for these unless we have a numeric non-breaker and a number start } } $text = $text.$words[$i]." "; } #we stopped one token from the end to allow for easy look-ahead. Append it now. $text = $text.$words[$i]; # clean up spaces at head and tail of each line as well as any double-spacing $text =~ s/ +/ /g; $text =~ s/\n /\n/g; $text =~ s/ \n/\n/g; $text =~ s/^ //g; $text =~ s/ $//g; #add trailing break $text .= "\n" unless $text =~ /\n$/; return $text; } 1; __END__ =head1 NAME Lingua::Sentence - Perl extension for breaking text paragraphs into sentences =head1 SYNOPSIS use Lingua::Sentence; my $splitter = Lingua::Sentence->new("en"); my $text = 'This is a paragraph. It contains several sentences. "But why," you ask?'; print $splitter->split($text); =head1 DESCRIPTION This module allows splitting of text paragraphs into sentences. It is based on scripts developed by Philipp Koehn and Josh Schroeder for processing the Europarl corpus (L). The module uses punctuation and capitalization clues to split paragraphs into an newline-separated string with one sentence per line. For example: This is a paragraph. It contains several sentences. "But why," you ask? goes to: This is a paragraph. It contains several sentences. "But why," you ask? Languages currently supported by the module are: =over =item Catalan =item Czech =item Dutch =item English =item French =item German =item Greek =item Hungarian =item Icelandic =item Italian =item Latvian =item Polish =item Portuguese =item Russian =item Spanish =item Slovak =item Slovenian =item Swedish =back =head2 Nonbreaking Prefixes Files Nonbreaking prefixes are loosely defined as any word ending in a period that does NOT indicate an end of sentence marker. A basic example is Mr. and Ms. in English. The sentence splitter module uses the nonbreaking prefix files included in this distribution. To add a file for other languages, follow the naming convention nonbreaking_prefix.?? and use the two-letter language code you intend to use when creating a Lingua::Sentence object. The sentence splitter module will first look for a file for the language it is processing, and fall back to English if a file for that language is not found. For the splitter, normally a period followed by an uppercase word results in a sentence split. If the word preceeding the period is a nonbreaking prefix, this line break is not inserted. A special case of prefixes, NUMERIC_ONLY, is included for special cases where the prefix should be handled ONLY when before numbers. For example, "Article No. 24 states this." the No. is a nonbreaking prefix. However, in "No. It is not true." No functions as a word. See the example prefix files included in the distribution for more examples. =head3 CREDITS Thanks for the following individuals for supplying nonbreaking prefix files: Bas Rozema (Dutch), HilErio Leal Fontes (Portuguese), JesEs GimEnez (Catalan & Spanish) =head2 EXPORT =over =item new($lang_id) Instantiate an object to split sentences in language $lang_id. If the language is not supported, a splitter object for English will be instantiated. =item new($lang_id,$nonbreaking_prefix_file) Instantiate an object to split sentences in language $lang_id and the nonbreaking prefix file $nonbreaking_prefix_file. If the file does not exist, a splitter object for English will be instantiated. =item split($text) Split sentences in $text by inserting newline characters at the sentence breaks. The resulting string is also terminated with a newline. =item split_array($text) Split sentences in $text into an array of sentences. =back =head1 SUPPORT Bugs should always be submitted via the project hosting bug tracker L For other issues, contact the maintainer. =head1 SEE ALSO L, L, L, L =head1 AUTHOR Achim Ruopp, Eachimru@gmail.comE =head1 COPYRIGHT AND LICENSE Copyright (C) 2010 by Digital Silk Road Portions Copyright (C) 2005 by Philip Koehn and Josh Schroeder (used with permission) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . =cut Lingua-Sentence-1.04/t/0000755000175000017500000000000012103044255013602 5ustar achimachimLingua-Sentence-1.04/t/Lingua-Sentence.t0000644000175000017500000001246712103036430016756 0ustar achimachim# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl Lingua-Sentence.t' ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use Test::More tests => 33; BEGIN { use_ok('Lingua::Sentence') }; ######################### # Insert your test code below, the Test::More module is use()ed here so read # its man page ( perldoc Test::More ) for help writing this test script. use Lingua::Sentence; # English split test string and array results my $splitter = Lingua::Sentence->new("en"); isa_ok($splitter,'Lingua::Sentence'); is($splitter->split('Foo'),"Foo\n",'Line break appended to single word'); is($splitter->split('This is a paragraph. It contains several sentences. "But why," you ask?'),"This is a paragraph.\nIt contains several sentences.\n\"But why,\" you ask?\n", 'Three test sentences split'); my @split = $splitter->split_array('This is a paragraph. It contains several sentences. "But why," you ask?'); is(@split,3,'Three elements in split array'); is($split[0],'This is a paragraph.','First array element correct'); is($split[1],'It contains several sentences.','Second array element correct'); is($split[2],'"But why," you ask?','Third array element correct'); @split = $splitter->split_array('Hey! Now.'); is(@split,2,'Two elements in split array'); is($split[0],'Hey!','First array element correct'); is($split[1],'Now.','Second array element correct'); @split = $splitter->split_array('Hey... Now.'); is(@split,2,'Two elements in split array'); is($split[0],'Hey...','First array element correct'); is($split[1],'Now.','Second array element correct'); @split = $splitter->split_array('Hey. Now.'); is(@split,2,'Two elements in split array'); is($split[0],'Hey.','First array element correct'); is($split[1],'Now.','Second array element correct'); @split = $splitter->split_array('Hey. Now.'); is(@split,2,'Two elements in split array'); is($split[0],'Hey.','First array element correct'); is($split[1],'Now.','Second array element correct'); # Create splitter for language that does not exist in current ISO 639-2 list my $xo_splitter = Lingua::Sentence->new("xo"); isa_ok($xo_splitter,'Lingua::Sentence'); is($xo_splitter->split('This is a paragraph. It contains several sentences. "But why," you ask?'),"This is a paragraph.\nIt contains several sentences.\n\"But why,\" you ask?\n", 'Three test sentences split'); # Once a member variable for the language code is defined this could be checked here # German split test my $de_splitter = Lingua::Sentence->new("de"); isa_ok($de_splitter,'Lingua::Sentence'); is($de_splitter->split('Nie hätte das passieren sollen. Dr. Soltan sagte: "Der Fluxcompensator war doch kalibriert!".'),"Nie hätte das passieren sollen.\nDr. Soltan sagte: \"Der Fluxcompensator war doch kalibriert!\".\n","German split test"); # Greek split test my $el_splitter = Lingua::Sentence->new("el"); isa_ok($el_splitter,'Lingua::Sentence'); is($el_splitter->split('Όλα τα συστήματα ανώτατης εκπαίδευσης σχεδιάζονται σε εθνικό επίπεδο. Η ΕΕ αναλαμβάνει κυρίως να συμβάλει στη βελτίωση της συγκρισιμότητας μεταξύ των διάφορων συστημάτων και να βοηθά φοιτητές και καθηγητές να μετακινούνται με ευκολία μεταξύ των συστημάτων των κρατών μελών.'),"Όλα τα συστήματα ανώτατης εκπαίδευσης σχεδιάζονται σε εθνικό επίπεδο.\nΗ ΕΕ αναλαμβάνει κυρίως να συμβάλει στη βελτίωση της συγκρισιμότητας μεταξύ των διάφορων συστημάτων και να βοηθά φοιτητές και καθηγητές να μετακινούνται με ευκολία μεταξύ των συστημάτων των κρατών μελών.\n","Greek split test"); # Portuguese split test my $pt_splitter = Lingua::Sentence->new("pt"); isa_ok($pt_splitter,'Lingua::Sentence'); is($pt_splitter->split('Isto é um parágrafo. Contém várias frases. «Mas porquê,» perguntas tu?'),"Isto é um parágrafo.\nContém várias frases.\n«Mas porquê,» perguntas tu?\n","Portuguese split test"); # Spanish split test my $es_splitter = Lingua::Sentence->new("es"); isa_ok($es_splitter,'Lingua::Sentence'); is($es_splitter->split('La UE ofrece una gran variedad de empleos en un entorno multinacional y multilingüe. La Oficina Europea de Selección de Personal (EPSO) se ocupa de la contratación, sobre todo mediante oposiciones generales.'),"La UE ofrece una gran variedad de empleos en un entorno multinacional y multilingüe.\nLa Oficina Europea de Selección de Personal (EPSO) se ocupa de la contratación, sobre todo mediante oposiciones generales.\n","Spanish split test"); # Split test with custom prefix file ok( -e 't/nonbreaking_prefix.de'); my $de_custom_splitter = Lingua::Sentence->new("de","t/nonbreaking_prefix.de"); isa_ok($de_custom_splitter,'Lingua::Sentence'); is($de_custom_splitter->split('Nie hätte das passieren sollen. Dr. Soltan sagte: "Der Fluxcompensator war doch kalibriert!".'),"Nie hätte das passieren sollen.\nDr. Soltan sagte: \"Der Fluxcompensator war doch kalibriert!\".\n","German split test"); Lingua-Sentence-1.04/t/nonbreaking_prefix.de0000644000175000017500000000335012102557152017773 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name #no german words end in single lower-case letters, so we throw those in too. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z #Roman Numerals. A dot after one of these is not a sentence break in German. I II III IV V VI VII VIII IX X XI XII XIII XIV XV XVI XVII XVIII XIX XX i ii iii iv v vi vii viii ix x xi xii xiii xiv xv xvi xvii xviii xix xx #Titles and Honorifics Adj Adm Adv Asst Bart Bldg Brig Bros Capt Cmdr Col Comdr Con Corp Cpl DR Dr Ens Gen Gov Hon Hosp Insp Lt MM MR MRS MS Maj Messrs Mlle Mme Mr Mrs Ms Msgr Op Ord Pfc Ph Prof Pvt Rep Reps Res Rev Rt Sen Sens Sfc Sgt Sr St Supt Surg #Misc symbols Mio Mrd bzw v vs usw d.h z.B u.a etc Mrd MwSt ggf d.J D.h m.E vgl I.F z.T sogen ff u.E g.U g.g.A c.-à-d Buchst u.s.w sog u.ä Std evtl Zt Chr u.U o.ä Ltd b.A z.Zt spp sen SA k.o jun i.H.v dgl dergl Co zzt usf s.p.a Dkr Corp bzgl BSE #Number indicators # add #NUMERIC_ONLY# after the word if it should ONLY be non-breaking when a 0-9 digit follows it No Nos Art Nr pp ca Ca #Ordinals are done with . in German - "1." = "1st" in English 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 Lingua-Sentence-1.04/COPYING0000644000175000017500000001674312103013251014375 0ustar achimachim GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. Lingua-Sentence-1.04/MANIFEST.SKIP0000644000175000017500000000014112102557152015235 0ustar achimachim# Version control files \.svn # Build files ^Makefile$ ^Makefile.old$ ^blib/ # Editor files ~$ Lingua-Sentence-1.04/inc/0000755000175000017500000000000012103044255014110 5ustar achimachimLingua-Sentence-1.04/inc/Module/0000755000175000017500000000000012103044255015335 5ustar achimachimLingua-Sentence-1.04/inc/Module/Install/0000755000175000017500000000000012103044255016743 5ustar achimachimLingua-Sentence-1.04/inc/Module/Install/Metadata.pm0000644000175000017500000004327712103020366021033 0ustar achimachim#line 1 package Module::Install::Metadata; use strict 'vars'; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } my @boolean_keys = qw{ sign }; my @scalar_keys = qw{ name module_name abstract version distribution_type tests installdirs }; my @tuple_keys = qw{ configure_requires build_requires requires recommends bundles resources }; my @resource_keys = qw{ homepage bugtracker repository }; my @array_keys = qw{ keywords author }; *authors = \&author; sub Meta { shift } sub Meta_BooleanKeys { @boolean_keys } sub Meta_ScalarKeys { @scalar_keys } sub Meta_TupleKeys { @tuple_keys } sub Meta_ResourceKeys { @resource_keys } sub Meta_ArrayKeys { @array_keys } foreach my $key ( @boolean_keys ) { *$key = sub { my $self = shift; if ( defined wantarray and not @_ ) { return $self->{values}->{$key}; } $self->{values}->{$key} = ( @_ ? $_[0] : 1 ); return $self; }; } foreach my $key ( @scalar_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} = shift; return $self; }; } foreach my $key ( @array_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} ||= []; push @{$self->{values}->{$key}}, @_; return $self; }; } foreach my $key ( @resource_keys ) { *$key = sub { my $self = shift; unless ( @_ ) { return () unless $self->{values}->{resources}; return map { $_->[1] } grep { $_->[0] eq $key } @{ $self->{values}->{resources} }; } return $self->{values}->{resources}->{$key} unless @_; my $uri = shift or die( "Did not provide a value to $key()" ); $self->resources( $key => $uri ); return 1; }; } foreach my $key ( grep { $_ ne "resources" } @tuple_keys) { *$key = sub { my $self = shift; return $self->{values}->{$key} unless @_; my @added; while ( @_ ) { my $module = shift or last; my $version = shift || 0; push @added, [ $module, $version ]; } push @{ $self->{values}->{$key} }, @added; return map {@$_} @added; }; } # Resource handling my %lc_resource = map { $_ => 1 } qw{ homepage license bugtracker repository }; sub resources { my $self = shift; while ( @_ ) { my $name = shift or last; my $value = shift or next; if ( $name eq lc $name and ! $lc_resource{$name} ) { die("Unsupported reserved lowercase resource '$name'"); } $self->{values}->{resources} ||= []; push @{ $self->{values}->{resources} }, [ $name, $value ]; } $self->{values}->{resources}; } # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. sub test_requires { shift->build_requires(@_) } sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } sub install_as_cpan { $_[0]->installdirs('site') } sub install_as_site { $_[0]->installdirs('site') } sub install_as_vendor { $_[0]->installdirs('vendor') } sub dynamic_config { my $self = shift; my $value = @_ ? shift : 1; if ( $self->{values}->{dynamic_config} ) { # Once dynamic we never change to static, for safety return 0; } $self->{values}->{dynamic_config} = $value ? 1 : 0; return 1; } # Convenience command sub static_config { shift->dynamic_config(0); } sub perl_version { my $self = shift; return $self->{values}->{perl_version} unless @_; my $version = shift or die( "Did not provide a value to perl_version()" ); # Normalize the version $version = $self->_perl_version($version); # We don't support the really old versions unless ( $version >= 5.005 ) { die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; } $self->{values}->{perl_version} = $version; } sub all_from { my ( $self, $file ) = @_; unless ( defined($file) ) { my $name = $self->name or die( "all_from called with no args without setting name() first" ); $file = join('/', 'lib', split(/-/, $name)) . '.pm'; $file =~ s{.*/}{} unless -e $file; unless ( -e $file ) { die("all_from cannot find $file from $name"); } } unless ( -f $file ) { die("The path '$file' does not exist, or is not a file"); } $self->{values}{all_from} = $file; # Some methods pull from POD instead of code. # If there is a matching .pod, use that instead my $pod = $file; $pod =~ s/\.pm$/.pod/i; $pod = $file unless -e $pod; # Pull the different values $self->name_from($file) unless $self->name; $self->version_from($file) unless $self->version; $self->perl_version_from($file) unless $self->perl_version; $self->author_from($pod) unless @{$self->author || []}; $self->license_from($pod) unless $self->license; $self->abstract_from($pod) unless $self->abstract; return 1; } sub provides { my $self = shift; my $provides = ( $self->{values}->{provides} ||= {} ); %$provides = (%$provides, @_) if @_; return $provides; } sub auto_provides { my $self = shift; return $self unless $self->is_admin; unless (-e 'MANIFEST') { warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; return $self; } # Avoid spurious warnings as we are not checking manifest here. local $SIG{__WARN__} = sub {1}; require ExtUtils::Manifest; local *ExtUtils::Manifest::manicheck = sub { return }; require Module::Build; my $build = Module::Build->new( dist_name => $self->name, dist_version => $self->version, license => $self->license, ); $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { my $self = shift; my $name = shift; my $features = ( $self->{values}->{features} ||= [] ); my $mods; if ( @_ == 1 and ref( $_[0] ) ) { # The user used ->feature like ->features by passing in the second # argument as a reference. Accomodate for that. $mods = $_[0]; } else { $mods = \@_; } my $count = 0; push @$features, ( $name => [ map { ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ } @$mods ] ); return @$features; } sub features { my $self = shift; while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { $self->feature( $name, @$mods ); } return $self->{values}->{features} ? @{ $self->{values}->{features} } : (); } sub no_index { my $self = shift; my $type = shift; push @{ $self->{values}->{no_index}->{$type} }, @_ if $type; return $self->{values}->{no_index}; } sub read { my $self = shift; $self->include_deps( 'YAML::Tiny', 0 ); require YAML::Tiny; my $data = YAML::Tiny::LoadFile('META.yml'); # Call methods explicitly in case user has already set some values. while ( my ( $key, $value ) = each %$data ) { next unless $self->can($key); if ( ref $value eq 'HASH' ) { while ( my ( $module, $version ) = each %$value ) { $self->can($key)->($self, $module => $version ); } } else { $self->can($key)->($self, $value); } } return $self; } sub write { my $self = shift; return $self unless $self->is_admin; $self->admin->write_meta; return $self; } sub version_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->version( ExtUtils::MM_Unix->parse_version($file) ); # for version integrity check $self->makemaker_args( VERSION_FROM => $file ); } sub abstract_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->abstract( bless( { DISTNAME => $self->name }, 'ExtUtils::MM_Unix' )->parse_abstract($file) ); } # Add both distribution and module name sub name_from { my ($self, $file) = @_; if ( Module::Install::_read($file) =~ m/ ^ \s* package \s* ([\w:]+) \s* ; /ixms ) { my ($name, $module_name) = ($1, $1); $name =~ s{::}{-}g; $self->name($name); unless ( $self->module_name ) { $self->module_name($module_name); } } else { die("Cannot determine name from $file\n"); } } sub _extract_perl_version { if ( $_[0] =~ m/ ^\s* (?:use|require) \s* v? ([\d_\.]+) \s* ; /ixms ) { my $perl_version = $1; $perl_version =~ s{_}{}g; return $perl_version; } else { return; } } sub perl_version_from { my $self = shift; my $perl_version=_extract_perl_version(Module::Install::_read($_[0])); if ($perl_version) { $self->perl_version($perl_version); } else { warn "Cannot determine perl version info from $_[0]\n"; return; } } sub author_from { my $self = shift; my $content = Module::Install::_read($_[0]); if ($content =~ m/ =head \d \s+ (?:authors?)\b \s* ([^\n]*) | =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* ([^\n]*) /ixms) { my $author = $1 || $2; # XXX: ugly but should work anyway... if (eval "require Pod::Escapes; 1") { # Pod::Escapes has a mapping table. # It's in core of perl >= 5.9.3, and should be installed # as one of the Pod::Simple's prereqs, which is a prereq # of Pod::Text 3.x (see also below). $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $Pod::Escapes::Name2character_number{$1} ? chr($Pod::Escapes::Name2character_number{$1}) : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) { # Pod::Text < 3.0 has yet another mapping table, # though the table name of 2.x and 1.x are different. # (1.x is in core of Perl < 5.6, 2.x is in core of # Perl < 5.9.3) my $mapping = ($Pod::Text::VERSION < 2) ? \%Pod::Text::HTML_Escapes : \%Pod::Text::ESCAPES; $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $mapping->{$1} ? $mapping->{$1} : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } else { $author =~ s{E}{<}g; $author =~ s{E}{>}g; } $self->author($author); } else { warn "Cannot determine author info from $_[0]\n"; } } #Stolen from M::B my %license_urls = ( perl => 'http://dev.perl.org/licenses/', apache => 'http://apache.org/licenses/LICENSE-2.0', apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1', artistic => 'http://opensource.org/licenses/artistic-license.php', artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php', lgpl => 'http://opensource.org/licenses/lgpl-license.php', lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php', lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html', bsd => 'http://opensource.org/licenses/bsd-license.php', gpl => 'http://opensource.org/licenses/gpl-license.php', gpl2 => 'http://opensource.org/licenses/gpl-2.0.php', gpl3 => 'http://opensource.org/licenses/gpl-3.0.html', mit => 'http://opensource.org/licenses/mit-license.php', mozilla => 'http://opensource.org/licenses/mozilla1.1.php', open_source => undef, unrestricted => undef, restrictive => undef, unknown => undef, ); sub license { my $self = shift; return $self->{values}->{license} unless @_; my $license = shift or die( 'Did not provide a value to license()' ); $license = __extract_license($license) || lc $license; $self->{values}->{license} = $license; # Automatically fill in license URLs if ( $license_urls{$license} ) { $self->resources( license => $license_urls{$license} ); } return 1; } sub _extract_license { my $pod = shift; my $matched; return __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ L(?i:ICEN[CS]E|ICENSING)\b.*?) (=head \d.*|=cut.*|)\z /xms ) || __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ (?:C(?i:OPYRIGHTS?)|L(?i:EGAL))\b.*?) (=head \d.*|=cut.*|)\z /xms ); } sub __extract_license { my $license_text = shift or return; my @phrases = ( '(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1, '(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1, 'Artistic and GPL' => 'perl', 1, 'GNU general public license' => 'gpl', 1, 'GNU public license' => 'gpl', 1, 'GNU lesser general public license' => 'lgpl', 1, 'GNU lesser public license' => 'lgpl', 1, 'GNU library general public license' => 'lgpl', 1, 'GNU library public license' => 'lgpl', 1, 'GNU Free Documentation license' => 'unrestricted', 1, 'GNU Affero General Public License' => 'open_source', 1, '(?:Free)?BSD license' => 'bsd', 1, 'Artistic license 2\.0' => 'artistic_2', 1, 'Artistic license' => 'artistic', 1, 'Apache (?:Software )?license' => 'apache', 1, 'GPL' => 'gpl', 1, 'LGPL' => 'lgpl', 1, 'BSD' => 'bsd', 1, 'Artistic' => 'artistic', 1, 'MIT' => 'mit', 1, 'Mozilla Public License' => 'mozilla', 1, 'Q Public License' => 'open_source', 1, 'OpenSSL License' => 'unrestricted', 1, 'SSLeay License' => 'unrestricted', 1, 'zlib License' => 'open_source', 1, 'proprietary' => 'proprietary', 0, ); while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { $pattern =~ s#\s+#\\s+#gs; if ( $license_text =~ /\b$pattern\b/i ) { return $license; } } return ''; } sub license_from { my $self = shift; if (my $license=_extract_license(Module::Install::_read($_[0]))) { $self->license($license); } else { warn "Cannot determine license info from $_[0]\n"; return 'unknown'; } } sub _extract_bugtracker { my @links = $_[0] =~ m#L<( https?\Q://rt.cpan.org/\E[^>]+| https?\Q://github.com/\E[\w_]+/[\w_]+/issues| https?\Q://code.google.com/p/\E[\w_\-]+/issues/list )>#gx; my %links; @links{@links}=(); @links=keys %links; return @links; } sub bugtracker_from { my $self = shift; my $content = Module::Install::_read($_[0]); my @links = _extract_bugtracker($content); unless ( @links ) { warn "Cannot determine bugtracker info from $_[0]\n"; return 0; } if ( @links > 1 ) { warn "Found more than one bugtracker link in $_[0]\n"; return 0; } # Set the bugtracker bugtracker( $links[0] ); return 1; } sub requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->requires( $module => $version ); } } sub test_requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->test_requires( $module => $version ); } } # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to # numbers (eg, 5.006001 or 5.008009). # Also, convert double-part versions (eg, 5.8) sub _perl_version { my $v = $_[-1]; $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e; $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e; $v =~ s/(\.\d\d\d)000$/$1/; $v =~ s/_.+$//; if ( ref($v) ) { # Numify $v = $v + 0; } return $v; } sub add_metadata { my $self = shift; my %hash = @_; for my $key (keys %hash) { warn "add_metadata: $key is not prefixed with 'x_'.\n" . "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/; $self->{values}->{$key} = $hash{$key}; } } ###################################################################### # MYMETA Support sub WriteMyMeta { die "WriteMyMeta has been deprecated"; } sub write_mymeta_yaml { my $self = shift; # We need YAML::Tiny to write the MYMETA.yml file unless ( eval { require YAML::Tiny; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.yml\n"; YAML::Tiny::DumpFile('MYMETA.yml', $meta); } sub write_mymeta_json { my $self = shift; # We need JSON to write the MYMETA.json file unless ( eval { require JSON; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.json\n"; Module::Install::_write( 'MYMETA.json', JSON->new->pretty(1)->canonical->encode($meta), ); } sub _write_mymeta_data { my $self = shift; # If there's no existing META.yml there is nothing we can do return undef unless -f 'META.yml'; # We need Parse::CPAN::Meta to load the file unless ( eval { require Parse::CPAN::Meta; 1; } ) { return undef; } # Merge the perl version into the dependencies my $val = $self->Meta->{values}; my $perl = delete $val->{perl_version}; if ( $perl ) { $val->{requires} ||= []; my $requires = $val->{requires}; # Canonize to three-dot version after Perl 5.6 if ( $perl >= 5.006 ) { $perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e } unshift @$requires, [ perl => $perl ]; } # Load the advisory META.yml file my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); my $meta = $yaml[0]; # Overwrite the non-configure dependency hashs delete $meta->{requires}; delete $meta->{build_requires}; delete $meta->{recommends}; if ( exists $val->{requires} ) { $meta->{requires} = { map { @$_ } @{ $val->{requires} } }; } if ( exists $val->{build_requires} ) { $meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } }; } return $meta; } 1; Lingua-Sentence-1.04/inc/Module/Install/Can.pm0000644000175000017500000000615712103020366020010 0ustar achimachim#line 1 package Module::Install::Can; use strict; use Config (); use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # check if we can load some module ### Upgrade this to not have to load the module if possible sub can_use { my ($self, $mod, $ver) = @_; $mod =~ s{::|\\}{/}g; $mod .= '.pm' unless $mod =~ /\.pm$/i; my $pkg = $mod; $pkg =~ s{/}{::}g; $pkg =~ s{\.pm$}{}i; local $@; eval { require $mod; $pkg->VERSION($ver || 0); 1 }; } # Check if we can run some command sub can_run { my ($self, $cmd) = @_; my $_cmd = $cmd; return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { next if $dir eq ''; require File::Spec; my $abs = File::Spec->catfile($dir, $cmd); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } # Can our C compiler environment build XS files sub can_xs { my $self = shift; # Ensure we have the CBuilder module $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 ); # Do we have the configure_requires checker? local $@; eval "require ExtUtils::CBuilder;"; if ( $@ ) { # They don't obey configure_requires, so it is # someone old and delicate. Try to avoid hurting # them by falling back to an older simpler test. return $self->can_cc(); } # Do we have a working C compiler my $builder = ExtUtils::CBuilder->new( quiet => 1, ); unless ( $builder->have_compiler ) { # No working C compiler return 0; } # Write a C file representative of what XS becomes require File::Temp; my ( $FH, $tmpfile ) = File::Temp::tempfile( "compilexs-XXXXX", SUFFIX => '.c', ); binmode $FH; print $FH <<'END_C'; #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int main(int argc, char **argv) { return 0; } int boot_sanexs() { return 1; } END_C close $FH; # Can the C compiler access the same headers XS does my @libs = (); my $object = undef; eval { local $^W = 0; $object = $builder->compile( source => $tmpfile, ); @libs = $builder->link( objects => $object, module_name => 'sanexs', ); }; my $result = $@ ? 0 : 1; # Clean up all the build files foreach ( $tmpfile, $object, @libs ) { next unless defined $_; 1 while unlink; } return $result; } # Can we locate a (the) C compiler sub can_cc { my $self = shift; my @chunks = split(/ /, $Config::Config{cc}) or return; # $Config{cc} may contain args; try to find out the program part while (@chunks) { return $self->can_run("@chunks") || (pop(@chunks), next); } return; } # Fix Cygwin bug on maybe_command(); if ( $^O eq 'cygwin' ) { require ExtUtils::MM_Cygwin; require ExtUtils::MM_Win32; if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) { *ExtUtils::MM_Cygwin::maybe_command = sub { my ($self, $file) = @_; if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) { ExtUtils::MM_Win32->maybe_command($file); } else { ExtUtils::MM_Unix->maybe_command($file); } } } } 1; __END__ #line 236 Lingua-Sentence-1.04/inc/Module/Install/Base.pm0000644000175000017500000000214712103020366020154 0ustar achimachim#line 1 package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { $VERSION = '1.06'; } # Suspend handler for "redefined" warnings BEGIN { my $w = $SIG{__WARN__}; $SIG{__WARN__} = sub { $w }; } #line 42 sub new { my $class = shift; unless ( defined &{"${class}::call"} ) { *{"${class}::call"} = sub { shift->_top->call(@_) }; } unless ( defined &{"${class}::load"} ) { *{"${class}::load"} = sub { shift->_top->load(@_) }; } bless { @_ }, $class; } #line 61 sub AUTOLOAD { local $@; my $func = eval { shift->_top->autoload } or return; goto &$func; } #line 75 sub _top { $_[0]->{_top}; } #line 90 sub admin { $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new; } #line 106 sub is_admin { ! $_[0]->admin->isa('Module::Install::Base::FakeAdmin'); } sub DESTROY {} package Module::Install::Base::FakeAdmin; use vars qw{$VERSION}; BEGIN { $VERSION = $Module::Install::Base::VERSION; } my $fake; sub new { $fake ||= bless(\@_, $_[0]); } sub AUTOLOAD {} sub DESTROY {} # Restore warning handler BEGIN { $SIG{__WARN__} = $SIG{__WARN__}->(); } 1; #line 159 Lingua-Sentence-1.04/inc/Module/Install/WriteAll.pm0000644000175000017500000000237612103020366021031 0ustar achimachim#line 1 package Module::Install::WriteAll; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = qw{Module::Install::Base}; $ISCORE = 1; } sub WriteAll { my $self = shift; my %args = ( meta => 1, sign => 0, inline => 0, check_nmake => 1, @_, ); $self->sign(1) if $args{sign}; $self->admin->WriteAll(%args) if $self->is_admin; $self->check_nmake if $args{check_nmake}; unless ( $self->makemaker_args->{PL_FILES} ) { # XXX: This still may be a bit over-defensive... unless ($self->makemaker(6.25)) { $self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL'; } } # Until ExtUtils::MakeMaker support MYMETA.yml, make sure # we clean it up properly ourself. $self->realclean_files('MYMETA.yml'); if ( $args{inline} ) { $self->Inline->write; } else { $self->Makefile->write; } # The Makefile write process adds a couple of dependencies, # so write the META.yml files after the Makefile. if ( $args{meta} ) { $self->Meta->write; } # Experimental support for MYMETA if ( $ENV{X_MYMETA} ) { if ( $ENV{X_MYMETA} eq 'JSON' ) { $self->Meta->write_mymeta_json; } else { $self->Meta->write_mymeta_yaml; } } return 1; } 1; Lingua-Sentence-1.04/inc/Module/Install/Win32.pm0000644000175000017500000000340312103020366020200 0ustar achimachim#line 1 package Module::Install::Win32; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # determine if the user needs nmake, and download it if needed sub check_nmake { my $self = shift; $self->load('can_run'); $self->load('get_file'); require Config; return unless ( $^O eq 'MSWin32' and $Config::Config{make} and $Config::Config{make} =~ /^nmake\b/i and ! $self->can_run('nmake') ); print "The required 'nmake' executable not found, fetching it...\n"; require File::Basename; my $rv = $self->get_file( url => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe', ftp_url => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe', local_dir => File::Basename::dirname($^X), size => 51928, run => 'Nmake15.exe /o > nul', check_for => 'Nmake.exe', remove => 1, ); die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- Since you are using Microsoft Windows, you will need the 'nmake' utility before installation. It's available at: http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe or ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe Please download the file manually, save it to a directory in %PATH% (e.g. C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to that directory, and run "Nmake15.exe" from there; that will create the 'nmake.exe' file needed by this module. You may then resume the installation process described in README. ------------------------------------------------------------------------------- END_MESSAGE } 1; Lingua-Sentence-1.04/inc/Module/Install/Makefile.pm0000644000175000017500000002743712103020366021030 0ustar achimachim#line 1 package Module::Install::Makefile; use strict 'vars'; use ExtUtils::MakeMaker (); use Module::Install::Base (); use Fcntl qw/:flock :seek/; use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub Makefile { $_[0] } my %seen = (); sub prompt { shift; # Infinite loop protection my @c = caller(); if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) { die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])"; } # In automated testing or non-interactive session, always use defaults if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) { local $ENV{PERL_MM_USE_DEFAULT} = 1; goto &ExtUtils::MakeMaker::prompt; } else { goto &ExtUtils::MakeMaker::prompt; } } # Store a cleaned up version of the MakeMaker version, # since we need to behave differently in a variety of # ways based on the MM version. my $makemaker = eval $ExtUtils::MakeMaker::VERSION; # If we are passed a param, do a "newer than" comparison. # Otherwise, just return the MakeMaker version. sub makemaker { ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0 } # Ripped from ExtUtils::MakeMaker 6.56, and slightly modified # as we only need to know here whether the attribute is an array # or a hash or something else (which may or may not be appendable). my %makemaker_argtype = ( C => 'ARRAY', CONFIG => 'ARRAY', # CONFIGURE => 'CODE', # ignore DIR => 'ARRAY', DL_FUNCS => 'HASH', DL_VARS => 'ARRAY', EXCLUDE_EXT => 'ARRAY', EXE_FILES => 'ARRAY', FUNCLIST => 'ARRAY', H => 'ARRAY', IMPORTS => 'HASH', INCLUDE_EXT => 'ARRAY', LIBS => 'ARRAY', # ignore '' MAN1PODS => 'HASH', MAN3PODS => 'HASH', META_ADD => 'HASH', META_MERGE => 'HASH', PL_FILES => 'HASH', PM => 'HASH', PMLIBDIRS => 'ARRAY', PMLIBPARENTDIRS => 'ARRAY', PREREQ_PM => 'HASH', CONFIGURE_REQUIRES => 'HASH', SKIP => 'ARRAY', TYPEMAPS => 'ARRAY', XS => 'HASH', # VERSION => ['version',''], # ignore # _KEEP_AFTER_FLUSH => '', clean => 'HASH', depend => 'HASH', dist => 'HASH', dynamic_lib=> 'HASH', linkext => 'HASH', macro => 'HASH', postamble => 'HASH', realclean => 'HASH', test => 'HASH', tool_autosplit => 'HASH', # special cases where you can use makemaker_append CCFLAGS => 'APPENDABLE', DEFINE => 'APPENDABLE', INC => 'APPENDABLE', LDDLFLAGS => 'APPENDABLE', LDFROM => 'APPENDABLE', ); sub makemaker_args { my ($self, %new_args) = @_; my $args = ( $self->{makemaker_args} ||= {} ); foreach my $key (keys %new_args) { if ($makemaker_argtype{$key}) { if ($makemaker_argtype{$key} eq 'ARRAY') { $args->{$key} = [] unless defined $args->{$key}; unless (ref $args->{$key} eq 'ARRAY') { $args->{$key} = [$args->{$key}] } push @{$args->{$key}}, ref $new_args{$key} eq 'ARRAY' ? @{$new_args{$key}} : $new_args{$key}; } elsif ($makemaker_argtype{$key} eq 'HASH') { $args->{$key} = {} unless defined $args->{$key}; foreach my $skey (keys %{ $new_args{$key} }) { $args->{$key}{$skey} = $new_args{$key}{$skey}; } } elsif ($makemaker_argtype{$key} eq 'APPENDABLE') { $self->makemaker_append($key => $new_args{$key}); } } else { if (defined $args->{$key}) { warn qq{MakeMaker attribute "$key" is overriden; use "makemaker_append" to append values\n}; } $args->{$key} = $new_args{$key}; } } return $args; } # For mm args that take multiple space-seperated args, # append an argument to the current list. sub makemaker_append { my $self = shift; my $name = shift; my $args = $self->makemaker_args; $args->{$name} = defined $args->{$name} ? join( ' ', $args->{$name}, @_ ) : join( ' ', @_ ); } sub build_subdirs { my $self = shift; my $subdirs = $self->makemaker_args->{DIR} ||= []; for my $subdir (@_) { push @$subdirs, $subdir; } } sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; %$clean = ( %$clean, FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; %$realclean = ( %$realclean, FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } sub libs { my $self = shift; my $libs = ref $_[0] ? shift : [ shift ]; $self->makemaker_args( LIBS => $libs ); } sub inc { my $self = shift; $self->makemaker_args( INC => shift ); } sub _wanted_t { } sub tests_recursive { my $self = shift; my $dir = shift || 't'; unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } my %tests = map { $_ => 1 } split / /, ($self->tests || ''); require File::Find; File::Find::find( sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 }, $dir ); $self->tests( join ' ', sort keys %tests ); } sub write { my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; # Check the current Perl version my $perl_version = $self->perl_version; if ( $perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; } # Make sure we have a new enough MakeMaker require ExtUtils::MakeMaker; if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) { # This previous attempted to inherit the version of # ExtUtils::MakeMaker in use by the module author, but this # was found to be untenable as some authors build releases # using future dev versions of EU:MM that nobody else has. # Instead, #toolchain suggests we use 6.59 which is the most # stable version on CPAN at time of writing and is, to quote # ribasushi, "not terminally fucked, > and tested enough". # TODO: We will now need to maintain this over time to push # the version up as new versions are released. $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 ); } else { # Allow legacy-compatibility with 5.005 by depending on the # most recent EU:MM that supported 5.005. $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 ); } # Generate the MakeMaker params my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; $args->{NAME} = $self->module_name || $self->name; $args->{NAME} =~ s/-/::/g; $args->{VERSION} = $self->version or die <<'EOT'; ERROR: Can't determine distribution version. Please specify it explicitly via 'version' in Makefile.PL, or set a valid $VERSION in a module, and provide its file path via 'version_from' (or 'all_from' if you prefer) in Makefile.PL. EOT if ( $self->tests ) { my @tests = split ' ', $self->tests; my %seen; $args->{test} = { TESTS => (join ' ', grep {!$seen{$_}++} @tests), }; } elsif ( $Module::Install::ExtraTests::use_extratests ) { # Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness. # So, just ignore our xt tests here. } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { $args->{test} = { TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ), }; } if ( $] >= 5.005 ) { $args->{ABSTRACT} = $self->abstract; $args->{AUTHOR} = join ', ', @{$self->author || []}; } if ( $self->makemaker(6.10) ) { $args->{NO_META} = 1; #$args->{NO_MYMETA} = 1; } if ( $self->makemaker(6.17) and $self->sign ) { $args->{SIGN} = 1; } unless ( $self->is_admin ) { delete $args->{SIGN}; } if ( $self->makemaker(6.31) and $self->license ) { $args->{LICENSE} = $self->license; } my $prereq = ($args->{PREREQ_PM} ||= {}); %$prereq = ( %$prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->requires) ); # Remove any reference to perl, PREREQ_PM doesn't support it delete $args->{PREREQ_PM}->{perl}; # Merge both kinds of requires into BUILD_REQUIRES my $build_prereq = ($args->{BUILD_REQUIRES} ||= {}); %$build_prereq = ( %$build_prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->configure_requires, $self->build_requires) ); # Remove any reference to perl, BUILD_REQUIRES doesn't support it delete $args->{BUILD_REQUIRES}->{perl}; # Delete bundled dists from prereq_pm, add it to Makefile DIR my $subdirs = ($args->{DIR} || []); if ($self->bundles) { my %processed; foreach my $bundle (@{ $self->bundles }) { my ($mod_name, $dist_dir) = @$bundle; delete $prereq->{$mod_name}; $dist_dir = File::Basename::basename($dist_dir); # dir for building this module if (not exists $processed{$dist_dir}) { if (-d $dist_dir) { # List as sub-directory to be processed by make push @$subdirs, $dist_dir; } # Else do nothing: the module is already present on the system $processed{$dist_dir} = undef; } } } unless ( $self->makemaker('6.55_03') ) { %$prereq = (%$prereq,%$build_prereq); delete $args->{BUILD_REQUIRES}; } if ( my $perl_version = $self->perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; if ( $self->makemaker(6.48) ) { $args->{MIN_PERL_VERSION} = $perl_version; } } if ($self->installdirs) { warn qq{old INSTALLDIRS (probably set by makemaker_args) is overriden by installdirs\n} if $args->{INSTALLDIRS}; $args->{INSTALLDIRS} = $self->installdirs; } my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_} ) } keys %$args; my $user_preop = delete $args{dist}->{PREOP}; if ( my $preop = $self->admin->preop($user_preop) ) { foreach my $key ( keys %$preop ) { $args{dist}->{$key} = $preop->{$key}; } } my $mm = ExtUtils::MakeMaker::WriteMakefile(%args); $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile'); } sub fix_up_makefile { my $self = shift; my $makefile_name = shift; my $top_class = ref($self->_top) || ''; my $top_version = $self->_top->VERSION || ''; my $preamble = $self->preamble ? "# Preamble by $top_class $top_version\n" . $self->preamble : ''; my $postamble = "# Postamble by $top_class $top_version\n" . ($self->postamble || ''); local *MAKEFILE; open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; eval { flock MAKEFILE, LOCK_EX }; my $makefile = do { local $/; }; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; # Module::Install will never be used to build the Core Perl # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m; #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; seek MAKEFILE, 0, SEEK_SET; truncate MAKEFILE, 0; print MAKEFILE "$preamble$makefile$postamble" or die $!; close MAKEFILE or die $!; 1; } sub preamble { my ($self, $text) = @_; $self->{preamble} = $text . $self->{preamble} if defined $text; $self->{preamble}; } sub postamble { my ($self, $text) = @_; $self->{postamble} ||= $self->admin->postamble; $self->{postamble} .= $text if defined $text; $self->{postamble} } 1; __END__ #line 544 Lingua-Sentence-1.04/inc/Module/Install/Fetch.pm0000644000175000017500000000462712103020366020340 0ustar achimachim#line 1 package Module::Install::Fetch; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub get_file { my ($self, %args) = @_; my ($scheme, $host, $path, $file) = $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) { $args{url} = $args{ftp_url} or (warn("LWP support unavailable!\n"), return); ($scheme, $host, $path, $file) = $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; } $|++; print "Fetching '$file' from $host... "; unless (eval { require Socket; Socket::inet_aton($host) }) { warn "'$host' resolve failed!\n"; return; } return unless $scheme eq 'ftp' or $scheme eq 'http'; require Cwd; my $dir = Cwd::getcwd(); chdir $args{local_dir} or return if exists $args{local_dir}; if (eval { require LWP::Simple; 1 }) { LWP::Simple::mirror($args{url}, $file); } elsif (eval { require Net::FTP; 1 }) { eval { # use Net::FTP to get past firewall my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600); $ftp->login("anonymous", 'anonymous@example.com'); $ftp->cwd($path); $ftp->binary; $ftp->get($file) or (warn("$!\n"), return); $ftp->quit; } } elsif (my $ftp = $self->can_run('ftp')) { eval { # no Net::FTP, fallback to ftp.exe require FileHandle; my $fh = FileHandle->new; local $SIG{CHLD} = 'IGNORE'; unless ($fh->open("|$ftp -n")) { warn "Couldn't open ftp: $!\n"; chdir $dir; return; } my @dialog = split(/\n/, <<"END_FTP"); open $host user anonymous anonymous\@example.com cd $path binary get $file $file quit END_FTP foreach (@dialog) { $fh->print("$_\n") } $fh->close; } } else { warn "No working 'ftp' program available!\n"; chdir $dir; return; } unless (-f $file) { warn "Fetching failed: $@\n"; chdir $dir; return; } return if exists $args{size} and -s $file != $args{size}; system($args{run}) if exists $args{run}; unlink($file) if $args{remove}; print(((!exists $args{check_for} or -e $args{check_for}) ? "done!" : "failed! ($!)"), "\n"); chdir $dir; return !$?; } 1; Lingua-Sentence-1.04/inc/Module/Install/Share.pm0000644000175000017500000000464312103020366020347 0ustar achimachim#line 1 package Module::Install::Share; use strict; use Module::Install::Base (); use File::Find (); use ExtUtils::Manifest (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub install_share { my $self = shift; my $dir = @_ ? pop : 'share'; my $type = @_ ? shift : 'dist'; unless ( defined $type and $type eq 'module' or $type eq 'dist' ) { die "Illegal or invalid share dir type '$type'"; } unless ( defined $dir and -d $dir ) { require Carp; Carp::croak("Illegal or missing directory install_share param: '$dir'"); } # Split by type my $S = ($^O eq 'MSWin32') ? "\\" : "\/"; my $root; if ( $type eq 'dist' ) { die "Too many parameters to install_share" if @_; # Set up the install $root = "\$(INST_LIB)${S}auto${S}share${S}dist${S}\$(DISTNAME)"; } else { my $module = Module::Install::_CLASS($_[0]); unless ( defined $module ) { die "Missing or invalid module name '$_[0]'"; } $module =~ s/::/-/g; $root = "\$(INST_LIB)${S}auto${S}share${S}module${S}$module"; } my $manifest = -r 'MANIFEST' ? ExtUtils::Manifest::maniread() : undef; my $skip_checker = $ExtUtils::Manifest::VERSION >= 1.54 ? ExtUtils::Manifest::maniskip() : ExtUtils::Manifest::_maniskip(); my $postamble = ''; my $perm_dir = eval($ExtUtils::MakeMaker::VERSION) >= 6.52 ? '$(PERM_DIR)' : 755; File::Find::find({ no_chdir => 1, wanted => sub { my $path = File::Spec->abs2rel($_, $dir); if (-d $_) { return if $skip_checker->($File::Find::name); $postamble .=<<"END"; \t\$(NOECHO) \$(MKPATH) "$root${S}$path" \t\$(NOECHO) \$(CHMOD) $perm_dir "$root${S}$path" END } else { return if ref $manifest && !exists $manifest->{$File::Find::name}; return if $skip_checker->($File::Find::name); $postamble .=<<"END"; \t\$(NOECHO) \$(CP) "$dir${S}$path" "$root${S}$path" END } }, }, $dir); # Set up the install $self->postamble(<<"END_MAKEFILE"); config :: $postamble END_MAKEFILE # The above appears to behave incorrectly when used with old versions # of ExtUtils::Install (known-bad on RHEL 3, with 5.8.0) # So when we need to install a share directory, make sure we add a # dependency on a moderately new version of ExtUtils::MakeMaker. $self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); # 99% of the time we don't want to index a shared dir $self->no_index( directory => $dir ); } 1; __END__ #line 154 Lingua-Sentence-1.04/inc/Module/Install.pm0000644000175000017500000003013512103020365017277 0ustar achimachim#line 1 package Module::Install; # For any maintainers: # The load order for Module::Install is a bit magic. # It goes something like this... # # IF ( host has Module::Install installed, creating author mode ) { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install # 3. The installed version of inc::Module::Install loads # 4. inc::Module::Install calls "require Module::Install" # 5. The ./inc/ version of Module::Install loads # } ELSE { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install # 3. The ./inc/ version of Module::Install loads # } use 5.005; use strict 'vars'; use Cwd (); use File::Find (); use File::Path (); use vars qw{$VERSION $MAIN}; BEGIN { # All Module::Install core packages now require synchronised versions. # This will be used to ensure we don't accidentally load old or # different versions of modules. # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. $VERSION = '1.06'; # Storage for the pseudo-singleton $MAIN = undef; *inc::Module::Install::VERSION = *VERSION; @inc::Module::Install::ISA = __PACKAGE__; } sub import { my $class = shift; my $self = $class->new(@_); my $who = $self->_caller; #------------------------------------------------------------- # all of the following checks should be included in import(), # to allow "eval 'require Module::Install; 1' to test # installation of Module::Install. (RT #51267) #------------------------------------------------------------- # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. # If not set, the caller may NOT have loaded the bundled version, and thus # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; unless ( $INC{$file} ) { die <<"END_DIE" } Please invoke ${\__PACKAGE__} with: use inc::${\__PACKAGE__}; not: use ${\__PACKAGE__}; END_DIE # This reportedly fixes a rare Win32 UTC file time issue, but # as this is a non-cross-platform XS module not in the core, # we shouldn't really depend on it. See RT #24194 for detail. # (Also, this module only supports Perl 5.6 and above). eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006; # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. if ( -f $0 ) { my $s = (stat($0))[9]; # If the modification time is only slightly in the future, # sleep briefly to remove the problem. my $a = $s - time; if ( $a > 0 and $a < 5 ) { sleep 5 } # Too far in the future, throw an error. my $t = time; if ( $s > $t ) { die <<"END_DIE" } Your installer $0 has a modification time in the future ($s > $t). This is known to create infinite loops in make. Please correct this, then run $0 again. END_DIE } # Build.PL was formerly supported, but no longer is due to excessive # difficulty in implementing every single feature twice. if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } Module::Install no longer supports Build.PL. It was impossible to maintain duel backends, and has been deprecated. Please remove all Build.PL files and only use the Makefile.PL installer. END_DIE #------------------------------------------------------------- # To save some more typing in Module::Install installers, every... # use inc::Module::Install # ...also acts as an implicit use strict. $^H |= strict::bits(qw(refs subs vars)); #------------------------------------------------------------- unless ( -f $self->{file} ) { foreach my $key (keys %INC) { delete $INC{$key} if $key =~ /Module\/Install/; } local $^W; require "$self->{path}/$self->{dispatch}.pm"; File::Path::mkpath("$self->{prefix}/$self->{author}"); $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); $self->{admin}->init; @_ = ($class, _self => $self); goto &{"$self->{name}::import"}; } local $^W; *{"${who}::AUTOLOAD"} = $self->autoload; $self->preload; # Unregister loader and worker packages so subdirs can use them again delete $INC{'inc/Module/Install.pm'}; delete $INC{'Module/Install.pm'}; # Save to the singleton $MAIN = $self; return 1; } sub autoload { my $self = shift; my $who = $self->_caller; my $cwd = Cwd::cwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { my $pwd = Cwd::cwd(); if ( my $code = $sym->{$pwd} ) { # Delegate back to parent dirs goto &$code unless $cwd eq $pwd; } unless ($$sym =~ s/([^:]+)$//) { # XXX: it looks like we can't retrieve the missing function # via $$sym (usually $main::AUTOLOAD) in this case. # I'm still wondering if we should slurp Makefile.PL to # get some context or not ... my ($package, $file, $line) = caller; die <<"EOT"; Unknown function is found at $file line $line. Execution of $file aborted due to runtime errors. If you're a contributor to a project, you may need to install some Module::Install extensions from CPAN (or other repository). If you're a user of a module, please contact the author. EOT } my $method = $1; if ( uc($method) eq $method ) { # Do nothing return; } elsif ( $method =~ /^_/ and $self->can($method) ) { # Dispatch to the root M:I class return $self->$method(@_); } # Dispatch to the appropriate plugin unshift @_, ( $self, $1 ); goto &{$self->can('call')}; }; } sub preload { my $self = shift; unless ( $self->{extensions} ) { $self->load_extensions( "$self->{prefix}/$self->{path}", $self ); } my @exts = @{$self->{extensions}}; unless ( @exts ) { @exts = $self->{admin}->load_all_extensions; } my %seen; foreach my $obj ( @exts ) { while (my ($method, $glob) = each %{ref($obj) . '::'}) { next unless $obj->can($method); next if $method =~ /^_/; next if $method eq uc($method); $seen{$method}++; } } my $who = $self->_caller; foreach my $name ( sort keys %seen ) { local $^W; *{"${who}::$name"} = sub { ${"${who}::AUTOLOAD"} = "${who}::$name"; goto &{"${who}::AUTOLOAD"}; }; } } sub new { my ($class, %args) = @_; delete $INC{'FindBin.pm'}; { # to suppress the redefine warning local $SIG{__WARN__} = sub {}; require FindBin; } # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; $args{dispatch} ||= 'Admin'; $args{prefix} ||= 'inc'; $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); $args{bundle} ||= 'inc/BUNDLES'; $args{base} ||= $base_path; $class =~ s/^\Q$args{prefix}\E:://; $args{name} ||= $class; $args{version} ||= $class->VERSION; unless ( $args{path} ) { $args{path} = $args{name}; $args{path} =~ s!::!/!g; } $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; $args{wrote} = 0; bless( \%args, $class ); } sub call { my ($self, $method) = @_; my $obj = $self->load($method) or return; splice(@_, 0, 2, $obj); goto &{$obj->can($method)}; } sub load { my ($self, $method) = @_; $self->load_extensions( "$self->{prefix}/$self->{path}", $self ) unless $self->{extensions}; foreach my $obj (@{$self->{extensions}}) { return $obj if $obj->can($method); } my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE my $obj = $admin->load($method, 1); push @{$self->{extensions}}, $obj; $obj; } sub load_extensions { my ($self, $path, $top) = @_; my $should_reload = 0; unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { unshift @INC, $self->{prefix}; $should_reload = 1; } foreach my $rv ( $self->find_extensions($path) ) { my ($file, $pkg) = @{$rv}; next if $self->{pathnames}{$pkg}; local $@; my $new = eval { local $^W; require $file; $pkg->can('new') }; unless ( $new ) { warn $@ if $@; next; } $self->{pathnames}{$pkg} = $should_reload ? delete $INC{$file} : $INC{$file}; push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); } $self->{extensions} ||= []; } sub find_extensions { my ($self, $path) = @_; my @found; File::Find::find( sub { my $file = $File::Find::name; return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; my $subpath = $1; return if lc($subpath) eq lc($self->{dispatch}); $file = "$self->{path}/$subpath.pm"; my $pkg = "$self->{name}::$subpath"; $pkg =~ s!/!::!g; # If we have a mixed-case package name, assume case has been preserved # correctly. Otherwise, root through the file to locate the case-preserved # version of the package name. if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { my $content = Module::Install::_read($subpath . '.pm'); my $in_pod = 0; foreach ( split //, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text next if /^\s*#/; # and comments if ( m/^\s*package\s+($pkg)\s*;/i ) { $pkg = $1; last; } } } push @found, [ $file, $pkg ]; }, $path ) if -d $path; @found; } ##################################################################### # Common Utility Functions sub _caller { my $depth = 0; my $call = caller($depth); while ( $call eq __PACKAGE__ ) { $depth++; $call = caller($depth); } return $call; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_NEW sub _read { local *FH; open( FH, "< $_[0]" ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_OLD sub _readperl { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s; $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg; return $string; } sub _readpod { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; return $string if $_[0] =~ /\.pod\z/; $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg; $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg; $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg; $string =~ s/^\n+//s; return $string; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _write { local *FH; open( FH, '>', $_[0] ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_NEW sub _write { local *FH; open( FH, "> $_[0]" ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_OLD # _version is for processing module versions (eg, 1.03_05) not # Perl versions (eg, 5.8.1). sub _version ($) { my $s = shift || 0; my $d =()= $s =~ /(\.)/g; if ( $d >= 2 ) { # Normalise multipart versions $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg; } $s =~ s/^(\d+)\.?//; my $l = $1 || 0; my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; $l = $l . '.' . join '', @v if @v; return $l + 0; } sub _cmp ($$) { _version($_[1]) <=> _version($_[2]); } # Cloned from Params::Util::_CLASS sub _CLASS ($) { ( defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s ) ? $_[0] : undef; } 1; # Copyright 2008 - 2012 Adam Kennedy. Lingua-Sentence-1.04/README0000644000175000017500000000232312102557152014223 0ustar achimachimLingua-Sentence version 1.03 ============================ This module allows splitting of text paragraphs into sentences. It is based on scripts developed by Philipp Koehn and Josh Schroeder for processing the Europarl corpus. The module uses punctuation and capitalization clues to split paragraphs into an newline-separated string with one sentence per line. The module provides support for Catalan, English, German, Portuguese, Spanish, Italian, French, Dutch and Greek. Optionally files providing hints for other languages can be provided. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: Carp; File::ShareDir; Test::More COPYRIGHT AND LICENCE Copyright (C) 2010 by Digital Silk Road Portions Copyright (C) 2005 by Philip Koehn and Josh Schroeder (used with permission) Portuguese nonbreaking prefix file copyright (C) 2009 by Hilário Leal Fontes (used with permission) 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. Lingua-Sentence-1.04/Makefile.PL0000644000175000017500000000040112102557152015310 0ustar achimachimuse inc::Module::Install; # Define metadata name 'Lingua-Sentence'; all_from 'lib/Lingua/Sentence.pm'; # Dependencies requires 'Carp' => 0; requires 'File::ShareDir' => '1.02'; test_requires 'Test::More' => '0.47'; install_share; WriteAll; Lingua-Sentence-1.04/share/0000755000175000017500000000000012103044255014441 5ustar achimachimLingua-Sentence-1.04/share/nonbreaking_prefix.sv0000644000175000017500000000027012103012016020652 0ustar achimachim#single upper case letter are usually initials A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #misc abbreviations AB G VG dvs etc from iaf jfr kl kr mao mfl mm osv pga tex tom vs Lingua-Sentence-1.04/share/nonbreaking_prefix.lv0000644000175000017500000000230712103010325020647 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name A Ā B C Č D E Ē F G Ģ H I Ī J K Ķ L Ļ M N Ņ O P Q R S Š T U Ū V W X Y Z Ž #List of titles. These are often followed by upper-case names, but do not indicate sentence breaks dr Dr med prof Prof inž Inž ist.loc Ist.loc kor.loc Kor.loc v.i vietn Vietn #misc - odd period-ending items that NEVER indicate breaks (p.m. does NOT fall into this category - it sometimes ends a sentence) a.l t.p pārb Pārb vec Vec inv Inv sk Sk spec Spec vienk Vienk virz Virz māksl Māksl mūz Mūz akad Akad soc Soc galv Galv vad Vad sertif Sertif folkl Folkl hum Hum #Numbers only. These should only induce breaks when followed by a numeric sequence # add NUMERIC_ONLY after the word for this function #This case is mostly for the english "No." which can either be a sentence of its own, or #if followed by a number, a non-breaking prefix Nr #NUMERIC_ONLY# Lingua-Sentence-1.04/share/nonbreaking_prefix.sl0000644000175000017500000000042612103012016020643 0ustar achimachimdr Dr itd itn št #NUMERIC_ONLY# Št #NUMERIC_ONLY# d jan Jan feb Feb mar Mar apr Apr jun Jun jul Jul avg Avg sept Sept sep Sep okt Okt nov Nov dec Dec tj Tj npr Npr sl Sl op Op gl Gl oz Oz prev dipl ing prim Prim cf Cf gl Gl A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Lingua-Sentence-1.04/share/nonbreaking_prefix.is0000644000175000017500000000204312103012004020632 0ustar achimachimno #NUMERIC_ONLY# No #NUMERIC_ONLY# nr #NUMERIC_ONLY# Nr #NUMERIC_ONLY# nR #NUMERIC_ONLY# NR #NUMERIC_ONLY# a b c d e f g h i j k l m n o p q r s t u v w x y z ^ í á ó æ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ab.fn a.fn afs al alm alg andh ath aths atr ao au aukaf áfn áhrl.s áhrs ákv.gr ákv bh bls dr e.Kr et ef efn ennfr eink end e.st erl fél fskj fh f.hl físl fl fn fo forl frb frl frh frt fsl fsh fs fsk fst f.Kr ft fv fyrrn fyrrv germ gm gr hdl hdr hf hl hlsk hljsk hljv hljóðv hr hv hvk holl Hos höf hk hrl ísl kaf kap Khöfn kk kg kk km kl klst kr kt kgúrsk kvk leturbr lh lh.nt lh.þt lo ltr mlja mljó millj mm mms m.fl miðm mgr mst mín nf nh nhm nl nk nmgr no núv nt o.áfr o.m.fl ohf o.fl o.s.frv ófn ób óákv.gr óákv pfn PR pr Ritstj Rvík Rvk samb samhlj samn samn sbr sek sérn sf sfn sh sfn sh s.hl sk skv sl sn so ss.us s.st samþ sbr shlj sign skál st st.s stk sþ teg tbl tfn tl tvíhlj tvt till to umr uh us uppl útg vb Vf vh vkf Vl vl vlf vmf 8vo vsk vth þt þf þjs þgf þlt þolm þm þml þýð Lingua-Sentence-1.04/share/nonbreaking_prefix.ru0000644000175000017500000000436612103012016020662 0ustar achimachim; № №№ 0г 0га 0гг 0дм 0кг 0км 0л 0м 0мг 0мм 0см 0т 10-ый 11-ый 12-ый 1г 1га 1гг 1дм 1кг 1км 1л 1м 1мг 1мм 1см 1т 1-ый 2г 2га 2гг 2дм 2кг 2км 2л 2м 2мг 2мм 2-ой 2см 2т 3г 3га 3гг 3дм 3-ий 3кг 3км 3л 3м 3мг 3мм 3см 3т 4г 4га 4гг 4дм 4кг 4км 4л 4м 4мг 4мм 4см 4т 4-ый 5г 5га 5гг 5дм 5кг 5км 5л 5м 5мг 5мм 5см 5т 5-ый 6г 6га 6гг 6дм 6кг 6км 6л 6м 6мг 6мм 6-ой 6см 6т 7г 7га 7гг 7дм 7кг 7км 7л 7м 7мг 7мм 7-ой 7см 7т 8г 8га 8гг 8дм 8кг 8км 8л 8м 8мг 8мм 8-ой 8см 8т 9г 9га 9гг 9дм 9кг 9км 9л 9м 9мг 9мм 9см 9т 9-ый A B C Cв Cвв D E F G H I Iв Iвв J K L Lв Lвв M Mв Mвв N O P Q R S T U V Vв Vвв W X Xв Xвв Y Z А Б б/г б.г б/м б.м бн/о бомж Бр. Бтто. б/у б.у бульв в В вв вкл вм в/о вт в т. ч в/ч в.ч г Г га газ. гвтч гг г-жа гл гл. обр гм гн г-н гос грн д Д да дал дг дм до н. э до н.э доп до Р. Хр др д-р е Е ед Ё Ж ж/д ж. д З зав зам Зам и И и др им инд и.о И.О и пр исп Исп и т.д и т.п Й к К кал кап кв кг кит кл км км/час кол комн коп куб л Л лиц лл лм л. с л.с м М макс Мб м. б м.б мг мин мк мл млн Млн млрд Млрд мм м. пр н Н наб напр нач неуд ном нпр Н-то Нтто н. э н.э о о/ О обл обр общ ок ост отл п П п/г п.г пгт п. г. т пер Пер перераб пл п/м п. м пос пп п/пр пр приб просп Просп проф Проф п.т.ч р Р ред руб Руб с С сб св с/г с. г с.г сек сл. обр см См с/м см/сек соч ср ст стр Стр с/ч с.ч с.ш т Т табл Табл т/г т.г т. е т.е тел Тел тех т. к т.к т/м т.м т.н т. наз т. о т. обр тов тт туп тыс Тыс У уд у. е ул уст уч Ф физ Ф.И.О. фр х Х хор Ц ч Ч чел ч. п Ч. П ч. т. д Ш шт Щ Ы Ь э Э экз Ю Я Lingua-Sentence-1.04/share/nonbreaking_prefix.cs0000644000175000017500000000354512103011774020651 0ustar achimachimBc BcA Ing Ing.arch MUDr MVDr MgA Mgr JUDr PhDr RNDr PharmDr ThLic ThDr Ph.D Th.D prof doc CSc DrSc dr. h. c PaedDr Dr PhMr DiS abt ad a.i aj angl anon apod atd atp aut bd biogr b.m b.p b.r cca cit cizojaz c.k col čes čín čj ed facs fasc fol fot franc h.c hist hl hrsg ibid il ind inv.č jap jhdt jv koed kol korej kl krit lat lit m.a maď mj mp násl např nepubl něm no nr n.s okr odd odp obr opr orig phil pl pokrač pol port pozn př.kr př.n.l přel přeprac příl pseud pt red repr resp revid rkp roč roz rozš samost sect sest seš sign sl srv stol sv šk šk.ro špan tab t.č tis tj tř tzv univ uspoř vol vl.jm vs vyd vyobr zal zejm zkr zprac zvl n.p např než MUDr abl absol adj adv ak ak. sl akt alch amer anat angl anglosas arab arch archit arg astr astrol att bás belg bibl biol boh bot bulh círk csl č čas čes dat děj dep dět dial dór dopr dosl ekon epic etnonym eufem f fam fem fil film form fot fr fut fyz gen geogr geol geom germ gram hebr herald hist hl hovor hud hut chcsl chem ie imp impf ind indoevr inf instr interj ión iron it kanad katalán klas kniž komp konj konkr kř kuch lat lék les lid lit liturg lok log m mat meteor metr mod ms mysl n náb námoř neklas něm nesklon nom ob obch obyč ojed opt part pas pejor pers pf pl plpf práv prep předl přivl r rcsl refl reg rkp ř řec s samohl sg sl souhl spec srov stfr střv stsl subj subst superl sv sz táz tech telev teol trans typogr var vedl verb vl. jm voj vok vůb vulg výtv vztaž zahr zájm zast zejm zeměd zkr zř mj dl atp sport Mgr horn MVDr JUDr RSDr Bc PhDr ThDr Ing aj apod PharmDr pomn ev slang nprap odp dop pol st stol p. n. l před n. l n. l př. Kr po Kr př. n. l odd RNDr tzv atd tzn resp tj p br č. j čj č. p čp a. s s. r. o spol. s r. o p. o s. p v. o. s k. s o. p. s o. s v. r v z ml vč kr mld hod popř ap event rus slov rum švýc P. T zvl hor dol S.O.S Lingua-Sentence-1.04/share/nonbreaking_prefix.sk0000644000175000017500000000463412103012016020647 0ustar achimachimBc Mgr RNDr PharmDr PhDr JUDr PaedDr ThDr Ing MUDr MDDr MVDr Dr ThLic PhD ArtD ThDr Dr DrSc CSs prof obr Obr Č č absol adj admin adr Adr adv advok afr ak akad akc akuz et al alch amer anat angl Angl anglosas anorg ap apod arch archeol archit arg art astr astrol astron atp atď austr Austr aut belg Belg bibl Bibl biol bot bud bás býv cest chem cirk csl čs Čs dat dep det dial diaľ dipl distrib dokl dosl dopr dram duš dv dvojčl dór ekol ekon el elektr elektrotech energet epic est etc etonym eufem európ Európ ev evid expr fa fam farm fem feud fil filat filoz fi fon form fot fr Fr franc Franc fraz fut fyz fyziol garb gen genet genpor geod geogr geol geom germ gr Gr gréc Gréc gréckokat hebr herald hist hlav hosp hromad hud hypok ident i.e ident imp impf indoeur inf inform instr int interj inšt inštr iron jap Jap jaz jedn juhoamer juhových juhozáp juž kanad Kanad kanc kapit kpt kart katastr knih kniž komp konj konkr kozmet krajč kresť kt kuch lat latinskoamer lek lex lingv lit litur log lok max Max maď Maď medzinár mest metr mil Mil min Min miner ml mld mn mod mytol napr nar Nar nasl nedok neg negat neklas nem Nem neodb neos neskl nesklon nespis nespráv neved než niekt niž nom náb nákl námor nár obch obj obv obyč obč občian odb odd ods ojed okr Okr opt opyt org os osob ot ovoc par part pejor pers pf Pf P.f p.f pl Plk pod podst pokl polit politol polygr pomn popl por porad porov posch potrav použ poz pozit poľ poľno poľnohosp poľov pošt pož prac predl pren prep preuk priezv Priezv privl prof práv príd príj prík príp prír prísl príslov príč psych publ pís písm pôv refl reg rep resp rozk rozlič rozpráv roč Roč ryb rádiotech rím samohl semest sev severoamer severových severozáp sg skr skup sl Sloven soc soch sociol sp spol Spol spoloč spoluhl správ spôs st star starogréc starorím s.r.o stol stor str stredoamer stredoškol subj subst superl sv sz súkr súp súvzť tal Tal tech tel Tel telef teles telev teol trans turist tuzem typogr tzn tzv ukaz ul Ul umel univ ust ved vedľ verb veter vin viď vl vod vodohosp pnl vulg vyj vys vysokoškol vzťaž vôb vých výd výrob výsk výsl výtv výtvar význ včel vš všeob zahr zar zariad zast zastar zastaráv zb zdravot združ zjemn zlat zn Zn zool zr zried zv záhr zák zákl zám záp západoeur zázn územ účt čast čes Čes čl čísl živ pr fak Kr p.n.l A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Lingua-Sentence-1.04/share/nonbreaking_prefix.nl0000644000175000017500000000305612102557152020656 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #Sources: http://nl.wikipedia.org/wiki/Lijst_van_afkortingen # http://nl.wikipedia.org/wiki/Aanspreekvorm # http://nl.wikipedia.org/wiki/Titulatuur_in_het_Nederlands_hoger_onderwijs #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #List of titles. These are often followed by upper-case names, but do not indicate sentence breaks bacc bc bgen c.i dhr dr dr.h.c drs drs ds eint fa Fa fam gen genm ing ir jhr jkvr jr kand kol lgen lkol Lt maj Mej mevr Mme mr mr Mw o.b.s plv prof ritm tint Vz Z.D Z.D.H Z.E Z.Em Z.H Z.K.H Z.K.M Z.M z.v #misc - odd period-ending items that NEVER indicate breaks (p.m. does NOT fall into this category - it sometimes ends a sentence) #we seem to have a lot of these in dutch i.e.: i.p.v - in plaats van (in stead of) never ends a sentence a.g.v bijv bijz bv d.w.z e.c e.g e.k ev i.p.v i.s.m i.t.t i.v.m m.a.w m.b.t m.b.v m.h.o m.i m.i.v v.w.t #Numbers only. These should only induce breaks when followed by a numeric sequence # add NUMERIC_ONLY after the word for this function #This case is mostly for the english "No." which can either be a sentence of its own, or #if followed by a number, a non-breaking prefix Nr #NUMERIC_ONLY# Nrs nrs nr #NUMERIC_ONLY# Lingua-Sentence-1.04/share/nonbreaking_prefix.it0000644000175000017500000000165312102557152020662 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender #usually upper case letters are initials in a name #no Italian words end in single lower-case letters, so we throw those in too? A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z # Period-final abbreviation list from http://www.chass.utoronto.ca/~ngargano/corsi/corrisp/abbreviazioni.html a.c es all Amn Arch Avv Bcc c.a C.A.P Cc banc post c.c.p c.m Co c.p C.P corr c.s c.v Dott Dr ecc Egr e.p.c fatt Geom gg Id Ing int lett Mo Mons N.B ogg on pp p.c p.c p.c.c p.es p.f p.r P.S p.v P.T Prof racc Rag Rev ric Rif RP RSVP S.A acc S.B.F seg sgg ss Sig Sigg s.n.c Soc S.p.A Spett S.P.M S.r.l tel u.s V.P v.r v.s Lingua-Sentence-1.04/share/nonbreaking_prefix.ca0000644000175000017500000000222212102557152020622 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #Abbreviations aa abrev adj adm admón afma afmas afmo afmos ag am ap apdo art arts assn atte av bros bv cap caps cg cgo cia cía cit cl cm co col corp cos cta cte ctra cts dcha dept dg dl dm doc docs dpt dpto dr dra dras dres dto dupdo ed ej emma emmas emmo emmos entlo entpo esp etc ex excm excma excmas excmo excmos fasc fdo fig figs fol fra gral ha hnos hz ib ibid ibíd id íd ilm ilma ilmas ilmo ilmos iltre inc intr ít izq izqda izqdo jr kc kcal kg khz kl km kw lám lda ldo lib lim ltd ma máx mg mhz min mín mm mr mrs mtro ntra ntro núm ob op pág págs pd ph pje pl plc pm pp pral prof pról prov ps pta ptas pte pts pza ref rr rte sec seg sig sr sra sras sres srta ss sust tech tel teléf tít ud uds vda vdo vid vol vols vra vro vta Lingua-Sentence-1.04/share/nonbreaking_prefix.el0000644000175000017500000000007112102557152020637 0ustar achimachim# for now, just include the Greek equivalent of "Mr." κ Lingua-Sentence-1.04/share/nonbreaking_prefix.pl0000644000175000017500000000243712103012014020642 0ustar achimachimadw afr akad al Al am amer arch art Art artyst astr austr bałt bdb bł bm br bryg bryt centr ces chem chiń chir c.k c.o cyg cyw cyt czes czw cd Cd czyt ćw ćwicz daw dcn dekl demokr det diec dł dn dot dol dop dost dosł h.c ds dst duszp dypl egz ekol ekon elektr em ew fab farm fot fr gat gastr geogr geol gimn głęb gm godz górn gosp gr gram hist hiszp hr Hr hot id in im iron jn kard kat katol k.k kk kol kl k.p.a kpc k.p.c kpt kr k.r krak k.r.o kryt kult laic łac niem woj nb np Nb Np pol pow m.in pt ps Pt Ps cdn jw ryc rys Ryc Rys tj tzw Tzw tzn zob ang ub ul pw pn pl al k n nr #NUMERIC_ONLY# Nr #NUMERIC_ONLY# ww wł ur zm żyd żarg żyw wył bp bp wyst tow Tow o sp Sp st spółdz Spółdz społ spółgł stoł stow Stoł Stow zn zew zewn zdr zazw zast zaw zał zal zam zak zakł zagr zach adw Adw lek Lek med mec Mec doc Doc dyw dyr Dyw Dyr inż Inż mgr Mgr dh dr Dh Dr p P red Red prof prok Prof Prok hab płk Płk nadkom Nadkom podkom Podkom ks Ks gen Gen por Por reż Reż przyp Przyp śp św śW Śp Św ŚW szer Szer pkt #NUMERIC_ONLY# str #NUMERIC_ONLY# tab #NUMERIC_ONLY# Tab #NUMERIC_ONLY# tel ust #NUMERIC_ONLY# par #NUMERIC_ONLY# poz pok oo oO Oo OO r #NUMERIC_ONLY# l #NUMERIC_ONLY# s #NUMERIC_ONLY# najśw Najśw A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Ś Ć Ż Ź Dz Lingua-Sentence-1.04/share/nonbreaking_prefix.pt0000644000175000017500000000340212102557152020663 0ustar achimachim#File adapted for PT by H. Leal Fontes from the EN & DE versions published with moses-2009-04-13. Last update: 10.11.2009. #Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z #Roman Numerals. A dot after one of these is not a sentence break in Portuguese. I II III IV V VI VII VIII IX X XI XII XIII XIV XV XVI XVII XVIII XIX XX i ii iii iv v vi vii viii ix x xi xii xiii xiv xv xvi xvii xviii xix xx #List of titles. These are often followed by upper-case names, but do not indicate sentence breaks Adj Adm Adv Art Ca Capt Cmdr Col Comdr Con Corp Cpl DR DRA Dr Dra Dras Drs Eng Enga Engas Engos Ex Exo Exmo Fig Gen Hosp Insp Lda MM MR MRS MS Maj Mrs Ms Msgr Op Ord Pfc Ph Prof Pvt Rep Reps Res Rev Rt Sen Sens Sfc Sgt Sr Sra Sras Srs Sto Supt Surg adj adm adv art cit col con corp cpl dr dra dras drs eng enga engas engos ex exo exmo fig op prof sr sra sras srs sto #misc - odd period-ending items that NEVER indicate breaks (p.m. does NOT fall into this category - it sometimes ends a sentence) v vs i.e rev e.g #Numbers only. These should only induce breaks when followed by a numeric sequence # add NUMERIC_ONLY after the word for this function #This case is mostly for the english "No." which can either be a sentence of its own, or #if followed by a number, a non-breaking prefix No #NUMERIC_ONLY# Nos Art #NUMERIC_ONLY# Nr p #NUMERIC_ONLY# pp #NUMERIC_ONLY# Lingua-Sentence-1.04/share/nonbreaking_prefix.hu0000644000175000017500000000274412103010325020647 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Á É Í Ó Ö Ő Ú Ü Ű #List of titles. These are often followed by upper-case names, but do not indicate sentence breaks Dr dr kb Kb vö Vö pl Pl ca Ca min Min max Max ún Ún prof Prof de De du Du Szt St #Numbers only. These should only induce breaks when followed by a numeric sequence # add NUMERIC_ONLY after the word for this function #This case is mostly for the english "No." which can either be a sentence of its own, or #if followed by a number, a non-breaking prefix # Month name abbreviations jan #NUMERIC_ONLY# Jan #NUMERIC_ONLY# Feb #NUMERIC_ONLY# feb #NUMERIC_ONLY# márc #NUMERIC_ONLY# Márc #NUMERIC_ONLY# ápr #NUMERIC_ONLY# Ápr #NUMERIC_ONLY# máj #NUMERIC_ONLY# Máj #NUMERIC_ONLY# jún #NUMERIC_ONLY# Jún #NUMERIC_ONLY# Júl #NUMERIC_ONLY# júl #NUMERIC_ONLY# aug #NUMERIC_ONLY# Aug #NUMERIC_ONLY# Szept #NUMERIC_ONLY# szept #NUMERIC_ONLY# okt #NUMERIC_ONLY# Okt #NUMERIC_ONLY# nov #NUMERIC_ONLY# Nov #NUMERIC_ONLY# dec #NUMERIC_ONLY# Dec #NUMERIC_ONLY# # Other abbreviations tel #NUMERIC_ONLY# Tel #NUMERIC_ONLY# Fax #NUMERIC_ONLY# fax #NUMERIC_ONLY# Lingua-Sentence-1.04/share/nonbreaking_prefix.ro0000644000175000017500000000015012103012016020637 0ustar achimachimA B C D E F G H I J K L M N O P Q R S T U V W X Y Z dpdv etc șamd M.Ap.N dl Dl d-na D-na dvs Dvs pt Pt Lingua-Sentence-1.04/share/nonbreaking_prefix.es0000644000175000017500000000253412102557152020654 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #Abbreviations a.c aa.rr abrev adj adm admón afma afmas afmo afmos ag am ap apdo art arts arz arzbpo assn atte av avda bros bv cap caps cg cgo cia cit cl cm co col corp cos cta cte ctra cts cía cía d.c dcha dept depto dg dl dm doc docs dpt dpto dr dra dras dres dto dupdo ed ee.uu ej emma emmas emmo emmos entlo entpo esp etc ex excm excma excmas excmo excmos fasc fdo fig figs fil fol fra gr grs gral ha hnos hros hz ib ibid ibíd id ilm ilma ilmas ilmo ilmos iltre inc intr izq izqda izqdo jr kc kcal kg khz kl km kw lda ldo lib lic lim loc ltd ltda lám ma mg mhz min mm mons mr mrs ms mss mtro máx mín ntra ntro núm ob obpo op pd ph pje pl plc pm pp ppal pral prof prov pról ps pta ptas pte pts pza pág págs párr rda rdo ref reg rel rev revda revdo rma rmo rte s sa sdad sec secret seg sg sig smo sr sra sras sres srs srta ss.mm sta sto sust tech tel telf teléf ten tfono tlf t.v.e tít ud uds vda vdo vid vol vols vra vro vta íd ít Lingua-Sentence-1.04/share/nonbreaking_prefix.de0000644000175000017500000000335012102557152020632 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name #no german words end in single lower-case letters, so we throw those in too. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z #Roman Numerals. A dot after one of these is not a sentence break in German. I II III IV V VI VII VIII IX X XI XII XIII XIV XV XVI XVII XVIII XIX XX i ii iii iv v vi vii viii ix x xi xii xiii xiv xv xvi xvii xviii xix xx #Titles and Honorifics Adj Adm Adv Asst Bart Bldg Brig Bros Capt Cmdr Col Comdr Con Corp Cpl DR Dr Ens Gen Gov Hon Hosp Insp Lt MM MR MRS MS Maj Messrs Mlle Mme Mr Mrs Ms Msgr Op Ord Pfc Ph Prof Pvt Rep Reps Res Rev Rt Sen Sens Sfc Sgt Sr St Supt Surg #Misc symbols Mio Mrd bzw v vs usw d.h z.B u.a etc Mrd MwSt ggf d.J D.h m.E vgl I.F z.T sogen ff u.E g.U g.g.A c.-à-d Buchst u.s.w sog u.ä Std evtl Zt Chr u.U o.ä Ltd b.A z.Zt spp sen SA k.o jun i.H.v dgl dergl Co zzt usf s.p.a Dkr Corp bzgl BSE #Number indicators # add #NUMERIC_ONLY# after the word if it should ONLY be non-breaking when a 0-9 digit follows it No Nos Art Nr pp ca Ca #Ordinals are done with . in German - "1." = "1st" in English 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 Lingua-Sentence-1.04/share/nonbreaking_prefix.en0000644000175000017500000000233112102557152020642 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in) #usually upper case letters are initials in a name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #List of titles. These are often followed by upper-case names, but do not indicate sentence breaks Adj Adm Adv Asst Bart Bldg Brig Bros Capt Cmdr Col Comdr Con Corp Cpl DR Dr Drs Ens Gen Gov Hon Hr Hosp Insp Lt MM MR MRS MS Maj Messrs Mlle Mme Mr Mrs Ms Msgr Op Ord Pfc Ph Prof Pvt Rep Reps Res Rev Rt Sen Sens Sfc Sgt Sr St Supt Surg #misc - odd period-ending items that NEVER indicate breaks (p.m. does NOT fall into this category - it sometimes ends a sentence) v vs i.e rev e.g #Numbers only. These should only induce breaks when followed by a numeric sequence # add NUMERIC_ONLY after the word for this function #This case is mostly for the english "No." which can either be a sentence of its own, or #if followed by a number, a non-breaking prefix No #NUMERIC_ONLY# Nos Art #NUMERIC_ONLY# Nr pp #NUMERIC_ONLY# Lingua-Sentence-1.04/share/nonbreaking_prefix.fr0000644000175000017500000000175712102557152020662 0ustar achimachim#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker. #Special cases are included for prefixes that ONLY appear before 0-9 numbers. #any single upper case letter followed by a period is not a sentence ender #usually upper case letters are initials in a name #no French words end in single lower-case letters, so we throw those in too? A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z # Period-final abbreviation list for French A.C.N A.M art ann apr av auj lib B.P boul ca c.-à-d cf ch.-l chap contr C.P.I C.Q.F.D C.N C.N.S C.S dir éd e.g env al etc E.V ex fasc fém fig fr hab ibid id i.e inf LL.AA LL.AA.II LL.AA.RR LL.AA.SS L.D LL.EE LL.MM LL.MM.II.RR loc.cit masc MM ms N.B N.D.A N.D.L.R N.D.T n/réf NN.SS N.S N.D N.P.A.I p.c.c pl pp p.ex p.j P.S R.A.S R.-V R.P R.I.P SS S.S S.A S.A.I S.A.R S.A.S S.E sec sect sing S.M S.M.I.R sq sqq suiv sup suppl tél T.S.V.P vb vol vs X.O Z.I Lingua-Sentence-1.04/Changes0000644000175000017500000000141212103044105014622 0ustar achimachimRevision history for Perl extension Lingua::Sentence. 1.04 Fri Feb 01 15:30:00 2013 - added language support for Czech, Hungarian, Icelandic, Latvian, Polish, Romanian, Russian, Slovak, Slovenian and Swedish - changed license to LGPLv3 because language support files come under this license - fixed RT issue #82069: Sentences with more than one trailing whitespace not split - removed use of Exporter as this is object-oriented module 1.03 Sat Dec 04 17:40:00 2010 - added language support for Catalan and Dutch - update language support for Spanish 1.02 Wed July 07 11:47:00 2010 - added language support for French, Italian, Spanish - switched to File::ShareDir to access nonbreaking prefix files 1.00 Thu Feb 18 15:07:00 2010 - original version Lingua-Sentence-1.04/MANIFEST0000644000175000017500000000165312103025405014471 0ustar achimachimChanges COPYING inc/Module/Install.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/Share.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm lib/Lingua/Sentence.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP META.yml README share/nonbreaking_prefix.ca share/nonbreaking_prefix.cs share/nonbreaking_prefix.de share/nonbreaking_prefix.el share/nonbreaking_prefix.en share/nonbreaking_prefix.es share/nonbreaking_prefix.fr share/nonbreaking_prefix.hu share/nonbreaking_prefix.is share/nonbreaking_prefix.it share/nonbreaking_prefix.lv share/nonbreaking_prefix.nl share/nonbreaking_prefix.pl share/nonbreaking_prefix.pt share/nonbreaking_prefix.ro share/nonbreaking_prefix.ru share/nonbreaking_prefix.sk share/nonbreaking_prefix.sl share/nonbreaking_prefix.sv t/Lingua-Sentence.t t/nonbreaking_prefix.de