Home > asr > sylFile2sylFile4sa.m

sylFile2sylFile4sa

PURPOSE ^

sylFile2sylFile4sa: Generate a .syl file (with confusing phones) from a given .syl file for speech assessment

SYNOPSIS ^

function sylFile2sylFile4sa(inputFile, outputFile)

DESCRIPTION ^

 sylFile2sylFile4sa: Generate a .syl file (with confusing phones) from a given .syl file for speech assessment
    Usage: sylFile2sylFile4sa(inputFile, outputFile)

    For example:

        inputFile='tian-qi-re-da-ha-qian.syl';
        outputFile='tian-qi-re-da-ha-qian.syl2';
        sylFile2sylFile4sa(inputFile, outputFile);
        fprintf('Contents of the input file %s:\n', inputFile);
        type(inputFile);
        fprintf('\nContents of the output file %s:\n', outputFile);
        type(outputFile);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function sylFile2sylFile4sa(inputFile, outputFile)
0002 % sylFile2sylFile4sa: Generate a .syl file (with confusing phones) from a given .syl file for speech assessment
0003 %    Usage: sylFile2sylFile4sa(inputFile, outputFile)
0004 %
0005 %    For example:
0006 %
0007 %        inputFile='tian-qi-re-da-ha-qian.syl';
0008 %        outputFile='tian-qi-re-da-ha-qian.syl2';
0009 %        sylFile2sylFile4sa(inputFile, outputFile);
0010 %        fprintf('Contents of the input file %s:\n', inputFile);
0011 %        type(inputFile);
0012 %        fprintf('\nContents of the output file %s:\n', outputFile);
0013 %        type(outputFile);
0014 
0015 %    Roger Jang, 20070215
0016 
0017 contents=textread(inputFile, '%s', 'delimiter', '\n', 'whitespace','');
0018 items=split(contents{1}, 9);
0019 sylSeq=items{1};
0020 syls=split(sylSeq, '-');
0021 sylNum=length(syls);
0022 output=syls2css(syls);        % Generated by rule. This can be changed to table lookup.
0023 fid=fopen(outputFile, 'w');
0024 %fprintf('input file = %s, output file = %s\n', inputFile, outputFile);
0025 for i=1:size(output, 1);
0026     fprintf(fid, '%s\t0\n', join(output(i,:), '-'));
0027 end
0028 fclose(fid);

Generated on Tue 01-Jun-2010 09:50:19 by m2html © 2003