Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Installing Lingua BrillTagger ( sub Lingua::EN::Tagger::get_tag_counts )

by Anonymous Monk
on Jan 21, 2014 at 02:37 UTC ( #1071416=note: print w/replies, xml ) Need Help??


in reply to Re^4: Installing Lingua BrillTagger
in thread Installing Lingua BrillTagger

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, }
  • Comment on Re^5: Installing Lingua BrillTagger ( sub Lingua::EN::Tagger::get_tag_counts )
  • Download Code

Replies are listed 'Best First'.
Re^6: Installing Lingua BrillTagger ( sub Lingua::EN::Tagger::get_tag_counts )
by Mordan (Initiate) on Jan 21, 2014 at 16:38 UTC
    Thank you!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1071416]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2022-08-08 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?