HTML::WordTagRatio::Ratio - Default module for determining the ratio of words to tags in a range of tokens in an HTML document.


HTML-Content-Extractor documentation  | view source Contained in the HTML-Content-Extractor distribution.

Index


NAME

Top

HTML::WordTagRatio::Ratio - Default module for determining the ratio of words to tags in a range of tokens in an HTML document.

SYNOPSIS

Top

  use HTML::WordTagRatio::Ratio;
  use HTML::Content::HTMLTokenizer;
  use HTML::Content::ContentExtractor;

  my $tokenizer = new HTML::Content::HTMLTokenizer('TAG','WORD');

  open(HTML,"index.html");
  my $doc = join("",<HTML>);
  close(HTML);

  my ($word_count_arr_ref,$tag_count_arr_ref,$token_type_arr_ref,$token_hash_ref) = $tokenizer->Tokenize($doc);

  my $ratio = new HTML::WordTagRatio::Ratio();

  my $value = $ratio->RangeValue(0, @$word_count_arr_ref, 
  				$word_count_arr_ref, $tag_count_arr_ref);

DESCRIPTION

Top

HTML::WordTagRatio::Ratio and derived classes compute a ratio of Words to Tags for a given range. Ratio is the base class and merely returns the number of word tokens in the range.

Methods

* my $ratio = new HTML::WordTagRatio::Ratio()

Initializes HTML::WordTagRatio::Ratio

* my $value = $ratio->RangeValue($start, $end, \@WordCount, \@TagCount)

Returns the number of word tokens in ($start,$end]. $WordCount[$i] is the number of word tokens before or at the ith token in the input HTML document. $TagCount[$i] is the number of tag tokens before or at the ith token in the input HTML document.

AUTHOR

Top

Jean Tavernier (jj.tavernier@gmail.com)

COPYRIGHT

Top

SEE ALSO

Top

ContentExtractorDriver.pl (1), HTML::Content::ContentExtractor (3), HTML::Content::HTMLTokenizer (3), HTML::WordTagRatio::WeightedRatio (3), HTML::WordTagRatio::SmoothedRatio (3), HTML::WordTagRatio::RelativeRatio (3), HTML::WordTagRatio::ExponentialRatio (3), HTML::WordTagRatio::NormalizedRatio (3).


HTML-Content-Extractor documentation  | view source Contained in the HTML-Content-Extractor distribution.