use strict; use warnings; use HTML::TreeBuilder; my @goodWordsList = ( "mhm", "right", "well", "yeah", "sure", "good", "ah", "okay", "yep", "hm", "definitely", "alright", "'m'm", "oh", "my", "god", "wow", "uhuh", "exactly", "yup", "mkay", "i see", "ooh", "cool", "uh", "fine", "true", "hm'm", "hmm", "yes", "absolutely", "great", "um", "so", "mm", "weird", "ye-", "i mean", "i know", "i think so", "huh", "yay", "maybe", "eh", "obviously", "correct", "awesome", "really", "interesting", ); my %goodwords; @goodwords{@goodWordsList} = (1) x @goodWordsList; my $root = HTML::TreeBuilder->new (); $root->parse_file (*DATA); my %speakers; # Parse out speaker attributes for ($root->look_down ('_tag', 'strong')) { my $info = $_->right (); my $name = $_->as_text (); $speakers{$name}{info} = $info; for my $param (split /\s*(?:;\s*|$)/, $info) { my ($key, $value) = $param =~ /^:?\s*([^:]*):\s*(.*)/; $speakers{$name}{$key} = $value; } } my %stats; # Do the analysis for ($root->look_down ('_tag', 'p')) { my $line = $_->as_text ();; my ($name) = $line =~ /(\w+):/; # Preform analysis on paragraph here } #### __DATA__ S1: Native-Speaker Status: Native speaker, American English; Academic Role: Senior Undergraduate; Gender: Male; Age: 17-23; Restriction: None
S2: Native-Speaker Status: Native speaker, American English; Academic Role: Researcher; Gender: Male; Age: 31-50; Restriction: Cite
S3: Native-Speaker Status: Native speaker, American English; Academic Role: Junior Undergraduate; Gender: Female; Age: 17-23; Restriction: None
S4: Native-Speaker Status: Native speaker, American English; Academic Role: Senior Undergraduate; Gender: Female; Age: 17-23; Restriction: None
S5: Native-Speaker Status: Native speaker, American English; Academic Role: Junior Undergraduate; Gender: Female; Age: 17-23; Restriction: None
SS: Native-Speaker Status: Native speaker, American English; Academic Role: Unknown; Gender: Male; Age: Unknown; Restriction: None

S1: it was presented to them by Chuck D and Public Enemy. [S2: mhm ] and the rest of th- Public Enemy and you know and and Chuck D's f- publicly gets up and says you know they were with us from the beginning and, [S2: mhm ] all that now wheth- whether or not you know that he was reading a TelePrompTer, [S2: mhm ] or or not i i think is uh

S2: or if he was trying to make nice because of the fact that Public Enemy hasn't sold records lately, [S1: right ] and he doesn't wanna look like some kinda old sourpuss