Lingua-YaTeA

 view release on metacpan or  search on metacpan

lib/Lingua/YaTeA/Sentence.pm  view on Meta::CPAN

package Lingua::YaTeA::Sentence;
use strict;
use warnings;

our $counter = 0;
our $in_doc_counter = 0;
our $start_char = 0;

our $VERSION=$Lingua::YaTeA::VERSION;

sub new
{
    my ($class,$documents) = @_;
    my $this = {};
    bless ($this,$class);
     $this->{ID} = $counter;
    $this->{IN_DOC_ID} = $in_doc_counter;
    $this->{DOCUMENT} = $documents->getCurrent;
    return $this;
}

sub resetInDocCounter
{
    my ($class) = @_;
    $in_doc_counter = 0;
}

sub resetStartChar
{
    my ($class) = @_;
    $start_char = 0;
}

sub updateStartChar
{
    my ($class,$word) = @_;
    $start_char += $word->getLexItem->getLength +1;
}

sub getDocument
{
    my ($this) = @_;
    return $this->{DOCUMENT};
}

sub getID
{
    my ($this) = @_;
    return $this->{ID};
}

sub getInDocID
{
    my ($this) = @_;
    return $this->{IN_DOC_ID};
}


1;

__END__

=head1 NAME

Lingua::YaTeA::Sentence - Perl extension for sentence

=head1 SYNOPSIS

  use Lingua::YaTeA::Sentence;
  Lingua::YaTeA::Sentence->new($document);

=head1 DESCRIPTION

the module implements sentences of the document. An identifier (field
C<ID>) is associated to each sentence. The field C<IN_DOC_ID> records
the rank of the sentence in the document. The field C<DOCUMENT> is
the reference to the document object.

=head1 METHODS


=head2 new()

    new($document);

the method creates a new sentence and defined the reference given the
document C<$document>.


=head2 resetInDocCounter()

    resetInDocCounter();

The method resets the counter managing the sentence rank in a



( run in 1.871 second using v1.01-cache-2.11-cpan-ff9377addf4 )