| 1 | package Treex::Block::Read::Sentences; | ||||||||||
| 2 | { | ||||||||||
| 3 | 6 | $Treex::Block::Read::Sentences::VERSION = '0.08633_1'; | |||||||||
| 4 | } | ||||||||||
| 5 | 6 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 6 | ▶ | use Treex::Core::Common; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 6 | extends 'Treex::Block::Read::BaseTextReader'; | |||||||||
| 8 | |||||||||||
| 9 | sub next_document { | ||||||||||
| 10 | 10 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
next_document: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||
| 11 | 10 | my $text = $self->next_document_text(); | |||||||||
| 12 | 10 | ▶ | return if !defined $text; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | |||||||||||
| 14 | 5 | my $document = $self->new_document(); | |||||||||
| 15 | 5 | foreach my $sentence ( split /\n/, $text ) { | |||||||||
| 16 | 0 | my $bundle = $document->create_bundle(); | |||||||||
| 17 | 0 | my $zone = $bundle->create_zone( $self->language, $self->selector ); | |||||||||
| 18 | 0 | $zone->set_sentence($sentence); | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 5 | return $document; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 6 | 1; | |||||||||
| 25 | |||||||||||
| 26 | __END__ | ||||||||||
| 27 | |||||||||||
| 28 | =head1 NAME | ||||||||||
| 29 | |||||||||||
| 30 | Treex::Block::Read::Sentences | ||||||||||
| 31 | |||||||||||
| 32 | =head1 VERSION | ||||||||||
| 33 | |||||||||||
| 34 | version 0.08633_1 | ||||||||||
| 35 | |||||||||||
| 36 | =head1 DESCRIPTION | ||||||||||
| 37 | |||||||||||
| 38 | Document reader for plain text format, one sentence per line. | ||||||||||
| 39 | The sentences are stored into L<bundles|Treex::Core::Bundle> in the | ||||||||||
| 40 | L<document|Treex::Core::Document>. | ||||||||||
| 41 | |||||||||||
| 42 | =head1 ATTRIBUTES | ||||||||||
| 43 | |||||||||||
| 44 | =over | ||||||||||
| 45 | |||||||||||
| 46 | =item from | ||||||||||
| 47 | |||||||||||
| 48 | space or comma separated list of filenames | ||||||||||
| 49 | |||||||||||
| 50 | =back | ||||||||||
| 51 | |||||||||||
| 52 | =head1 METHODS | ||||||||||
| 53 | |||||||||||
| 54 | =over | ||||||||||
| 55 | |||||||||||
| 56 | =item next_document | ||||||||||
| 57 | |||||||||||
| 58 | Loads a document. | ||||||||||
| 59 | |||||||||||
| 60 | =back | ||||||||||
| 61 | |||||||||||
| 62 | =head1 SEE | ||||||||||
| 63 | |||||||||||
| 64 | L<Treex::Block::Read::BaseTextReader> | ||||||||||
| 65 | L<Treex::Core::Document> | ||||||||||
| 66 | L<Treex::Core::Bundle> | ||||||||||
| 67 | L<Treex::Block::Read::AlignedSentences> | ||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | =head1 AUTHOR | ||||||||||
| 71 | |||||||||||
| 72 | Martin Popel | ||||||||||
| 73 | |||||||||||
| 74 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 75 | |||||||||||
| 76 | Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague | ||||||||||
| 77 | |||||||||||
| 78 | This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||