Here you go
#!/usr/bin/perl -- ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr +-ce -nibc -i=4 -pt=0 "-nsak=*" use strict; use warnings; use Data::Dump qw/ dd /; use Lingua::EN::Tagger ; Main( @ARGV ); exit( 0 ); sub Main { my $text = q{ If that is a question, can you show small code sample, complete with small input and word description of what counts you expect? Now <brackets> here :/ }; my $postagger = Lingua::EN::Tagger->new; my $tagged = $postagger->add_tags($text); #~ dd( $postagger, $tagged ); #~ dd ( map { [ $_, $postagger->$_( $text ) ] } qw{ get_words get_ +readable get_sentences } ); #~ dd ( map { [ $_, $postagger->$_( $tagged ) ] } qw{ get_proper_n +ouns get_nouns get_max_noun_phrases get_noun_phrases } ); dd( scalar $postagger->get_tag_counts( $tagged ) ); } ## end sub Main sub Lingua::EN::Tagger::get_tag_counts { #~ my( $self, $tagged ) = @_; my %counts; $counts{$1}++ while $_[1] =~ m{<([^>/]+)>}g; return wantarray ? %counts : \%counts; } __END__ { cc => 1, det => 2, in => 3, jj => 3, md => 1, nn => 6, pp => 1, ppc => 2, prp => 2, rb => 2, sym => 1, vbp => 2, vbz => 2, wp => 1, }
In reply to Re^5: Installing Lingua BrillTagger ( sub Lingua::EN::Tagger::get_tag_counts )
by Anonymous Monk
in thread Installing Lingua BrillTagger
by Mordan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |