#!/usr/local/bin/perl
#
# Extract those words from switchboard.lexicon that have at least 3 vowels
#

$file = "switchboard.lexicon";
open(items_in_file,$file);
@lines_in_file = <items_in_file>;
close(items_in_file);

print "Words from switchboard.lexicon that have at least 3 vowels\n";

foreach $line_in_file (@lines_in_file) {
    
    $line_in_file =~ /^(\S+)\s/;  
    $word = $1;                  
    if ($word =~ /^.*[AEIOUaeiou]+.*[AEIOUaeiou]+.*[AEIOUaeiou]+.*$/) {
 # a word with 3 + vowels
	printf "$word\n";
    }
}
