http://www.perlmonks.org?node_id=1071391

Mordan has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, I am trying to get some expressions in the regex to print. I asked a related question to this and made a bit of a hash so starting afresh.

I am using tagger and want to be able to display the tags found in the regex.

$NUM = get_exp('cd'); $GER = get_exp('vbg'); $ADJ = get_exp('jj[rs]*'); $PART = get_exp('vbn'); $NN = get_exp('nn[sp]*'); $NNP = get_exp('nnp'); $PREP = get_exp('in'); $DET = get_exp('det'); $PAREN= get_exp('[lr]rb'); $QUOT = get_exp('ppr'); $SEN = get_exp('pp'); $WORD = get_exp('\p{IsWord}+');

I can display the text I input all tagged (code below), but what I want to do is display the count of tags. So like:

This code will output tagged text, but I can't seem to get it to tabulate the tags. My efforts, such as print $tag, print $GER and so on won't work.

Also I heard that tagger has problems accepting input from files rather than text in the coding, anyone else heard that?

#!/usr/bin/env perl use Lingua::EN::Tagger qw(add_tags); my $postagger = new Lingua::EN::Tagger; my $text = "the quick brown fox jumped over the lazy dog"; my $tagged = $postagger->add_tags($text); print $tagged, "\n";