Speech:Trans time.pl

Summary
Takes a transcript file as an argument and prints the number of lines, and outputs the time in seconds and hours.

Please note that this script does not take overlapping times into effect when counting and is meant to be a simple way to measure. Use corpusSize.pl if you want to account for overlap.

Author
Jared Rohrdanz

Code
use strict; use warnings;
 * 1) !/usr/bin/perl

my $file = $ARGV[0]; # perl stores all arguements in an array called $ARGV my $seconds = 0; my $lines = 0; open ('fh', '<', $file) or die $!; # open the file read only access while (my $row = ) { chomp $row;

my @splitrow = split(/ /, $row); $seconds = $seconds + ($splitrow[2] - $splitrow[1]); $lines++; } my $minutes = $seconds / 60; my $hours = $minutes / 60;

printf "$lines transcript entries. \n"; printf "Seconds: $seconds \n"; printf "Hours: $hours \n" ;