Lingua-YaTeA
view release on metacpan or search on metacpan
lib/Lingua/YaTeA/WordFromCorpus.pm view on Meta::CPAN
sub getSentence
{
my ($this) = @_;
return $this->{SENTENCE};
}
sub getDocument
{
my ($this) = @_;
return $this->getSentence->getDocument;
}
sub getSentenceID
{
my ($this) = @_;
return $this->getSentence->getID;
}
sub getDocumentID
{
my ($this) = @_;
return $this->getSentence->getDocument->getID;
}
sub getStartChar
{
my ($this) = @_;
return $this->{START_CHAR};
}
sub getLexItem
{
my ($this) = @_;
return $this->{LEX_ITEM};
}
sub isSentenceBoundary
{
my ($this,$sentence_boundary) = @_;
if ($this->getLexItem->getPOS eq $sentence_boundary)
{
return 1;
}
return 0;
}
sub isDocumentBoundary
{
my ($this,$document_boundary) = @_;
if ($this->getLexItem->getPOS eq $document_boundary)
{
return 1;
}
return 0;
}
sub updateSentence
{
my ($this,$sentences) = @_;
$this->{SENTENCE} = $sentences->getCurrent;
}
sub updateStartChar
{
my ($this) = @_;
$this->{START_CHAR} = $Lingua::YaTeA::Sentence::start_char;
}
sub isChunkingFrontier
{
my ($this,$chunking_data) = @_;
my @types = ("POS", "LF", "IF");
my $type;
foreach $type (@types)
{
# word is a chunking frontier
if ($chunking_data->existData("ChunkingFrontiers",$type,$this->getLexItem->{$type}) == 1)
{
# word is not a chunking exception : end
if (! $this->isChunkingException($chunking_data) )
{
return 1;
}
return 0;
}
}
return 0;
}
sub isChunkingException
{
my ($this,$chunking_data) = @_;
my @types = ("POS", "LF", "IF");
my $type;
foreach $type (@types)
{
if ($chunking_data->existData("ChunkingExceptions",$type,$this->getLexItem->{$type}) == 1)
{
return 1;
}
}
return 0;
}
sub isCleaningFrontier
{
my ($this,$chunking_data) = @_;
my @types = ("POS", "LF", "IF");
my $type;
foreach $type (@types)
{
if ($chunking_data->existData("CleaningFrontiers",$type,$this->getLexItem->{$type}) == 1)
{
if (! $this->isCleaningException($chunking_data))
{
return 1;
}
}
}
return 0;
}
( run in 1.804 second using v1.01-cache-2.11-cpan-800906f7e73 )