Home > data-analysis > modules > speech > spot_objname.m

spot_objname

PURPOSE ^

find the object naming events in a speech transcription

SYNOPSIS ^

function [events stats] = spot_objname(speech, words)

DESCRIPTION ^

 find the object naming events in a speech transcription
  ignore the "stats" part for now

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [events stats] = spot_objname(speech, words)
0002 % find the object naming events in a speech transcription
0003 %  ignore the "stats" part for now
0004 %
0005 
0006 events = zeros(0, 3);
0007 nsit = size(speech,2);
0008 nevent = 0; 
0009 
0010 % count the # of object names
0011 stats.freq = zeros(size(words));
0012 stats.cooccur = zeros(size(words));
0013 stats.alone = zeros(size(words));
0014 stats.aloneP = zeros(size(words));
0015 
0016 for i = 1 : nsit
0017     nword = size(speech(i).words,2);
0018     
0019     for j = 1 : nword
0020         
0021         % this is an object name
0022         if (ismember(speech(i).words(j), words) == 1)
0023             
0024             % record the event
0025             nevent = nevent + 1;
0026             events(nevent,1) = speech(i).bt;
0027             events(nevent,2) = speech(i).et;
0028             events(nevent,3) = speech(i).words(j);
0029             
0030             % calculate the stats
0031             index = find(words == speech(i).words(j));
0032             stats.freq(index) = stats.freq(index) + 1;
0033             
0034             stats.cooccur(index) = stats.cooccur(index) + size(speech(i).words,2);
0035             if (size(speech(i).words,2) == 1)
0036                 stats.alone(index) = stats.alone(index) + 1; 
0037             end;
0038         end;
0039     end;
0040 end;
0041 
0042 % per occurrence
0043 stats.cooccur = stats.cooccur ./ stats.freq;
0044 stats.aloneP = stats.alone ./stats.freq; 
0045 
0046

Generated on Tue 23-May-2017 03:00:58 by m2html © 2005