Home > data-import > load_speech.m

load_speech

PURPOSE ^

load the speech transcription file into a matlab structure

SYNOPSIS ^

function [speech] = load_speech(fname)

DESCRIPTION ^

 load the speech transcription file into a matlab structure 
  input: a transcription file name
  output: matlab data structure

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [speech] = load_speech(fname)
0002 % load the speech transcription file into a matlab structure
0003 %  input: a transcription file name
0004 %  output: matlab data structure
0005 %
0006   
0007 
0008 fp = fopen(fname);
0009 
0010 nsen = 1; % the # of spoken utterances
0011 
0012 
0013 while 1
0014   tline = fgetl(fp);
0015   if ~ischar(tline), break,end
0016   if (size(tline,2) > 1) 
0017     a = sscanf(tline,'%f');
0018     
0019     % the first two are bt and et timestamps
0020     speech(nsen).bt = a(1);
0021     speech(nsen).et = a(2);
0022     % the following items are words
0023     speech(nsen).words = a(3:end)';
0024     nsen = nsen + 1; 
0025   end;
0026 end;
0027 
0028 
0029

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005