Docsity

Practice Questions for Problem Set 2 - Speech Processing | CS 682, Assignments of Computer Science

Toggle sidebar
bg1
CS 682
MARIE ROCH
Problem Set 2 and Lab 1
See calendar for due dates
Problem Set 2
1. (20 points) Write a context free grammar to operate a cell phone.
2. (30 points) Using wavesrufer, record yourself saying the word poach .
a. Turn in a plot of the spectrogram and waveform zoomed in on your
diphthong /Using the time domain waveform, estimate your F0.
Show your work.
b. Turn in a the spectrogram of the whole word showing the markings
for where each phoneme begins and ends.
c. State the manner and place for the consonants in this word.
3. (10 points) Explain in your own words the role of the middle ear plays in
hearing (no more than a short paragraph).
Lab 1
In this lab exercise, you will create several N-gram language models and examine
their perplexity on transcriptions of oral speech. All resources referenced in these
instructions may be found on rohan.
Two transcription files may be found in ~mroch/lib/cs682/ngram: train.txt and
test.txt. Each transcription consists of one turn or phrase of a spoken conversation
stored on a single line. Consecutive lines are not necessarily from the same
conversation, and transcriptions contain disfluencies such as fragments or restarts.
Sample sentences:
really well there's been uh actually some pretty interesting interesting topics that i've had i've had
things from uh tax reform to baseball to fishing those are the three i've participated in
no okay yeah
yeah
yeah i- i think uh there could be a lot of peo- i thi- people close this is really we're
well the problem is that gas at a dollar a a gallon
These transcripts have already been preprocessed to remove punctuation (with the
exception of the hyphens which indicate a word that was not fully pronounced), and
case differences.
In this lab, you should write the following function to build your models:
function [models, counts] = ngram(order, filename, laplace)
% Generate an n-gram and appropriate counts of specified order
% inputs:
% order - build up to order N grams (e.g. order=2 --> unigram, bigram)
% filename - file containing training text
pf3

Partial preview of the text

Download Practice Questions for Problem Set 2 - Speech Processing | CS 682 and more Assignments Computer Science in PDF only on Docsity!

CS 682

MARIE ROCH

Problem Set 2 and Lab 1 See calendar for due dates

Problem Set 2

  1. (20 points) Write a context free grammar to operate a cell phone.
  2. (30 points) Using wavesrufer, record yourself saying the word poach . a. Turn in a plot of the spectrogram and waveform zoomed in on your diphthong /Using the time domain waveform, estimate your F0. Show your work. b. Turn in a the spectrogram of the whole word showing the markings for where each phoneme begins and ends. c. State the manner and place for the consonants in this word.
  3. (10 points) Explain in your own words the role of the middle ear plays in hearing (no more than a short paragraph). Lab 1 In this lab exercise, you will create several N-gram language models and examine their perplexity on transcriptions of oral speech. All resources referenced in these instructions may be found on rohan. Two transcription files may be found in ~mroch/lib/cs682/ngram: train.txt and test.txt. Each transcription consists of one turn or phrase of a spoken conversation stored on a single line. Consecutive lines are not necessarily from the same conversation, and transcriptions contain disfluencies such as fragments or restarts. Sample sentences:

really well there's been uh actually some pretty interesting interesting topics that i've had i've had things from uh tax reform to baseball to fishing those are the three i've participated in no okay yeah yeah yeah i- i think uh there could be a lot of peo- i thi- people close this is really we're well the problem is that gas at a dollar a a gallon These transcripts have already been preprocessed to remove punctuation (with the exception of the hyphens which indicate a word that was not fully pronounced), and case differences. In this lab, you should write the following function to build your models:

function [models, counts] = ngram(order, filename, laplace) % Generate an n-gram and appropriate counts of specified order % inputs: % order - build up to order N grams (e.g. order=2 --> unigram, bigram) % filename - file containing training text

CS 696 ACOUSTIC M ODELING

MARIE ROCH P. 2

% laplace - true|false: Use Laplace (additive) smoothing. % outputs: % models - cell array of probability models models{k} is the % order k model % counts - cell array of counts (similar)

Prior to Matlab 2008b, there is no intrinsic support for hash tables, which is an appropriate data structure for building an N-grams and counts. Conceptually, for the trigram “riding a bike,”, a natural representation would be to construct a three level hash table: hashtable[riding][a][bike], and it is suggested that you may wish to use this type of data structure when coding your solution. As Matlab permits one to integrate Java code, you can use a Java HashMap to create appropriate data structures for your code. Using Java in Matlab is reasonably straight forward, here are a few tips that can make life easier:

  • Imports must be specified, (e.g.: import java.util.HashMap;)
  • Constructors do not use the new keyword, here is an example of creating a HashMap instance: counts = HashMap();
  • Iterators work as in Java.
  • Matlab handles Java methods that return strongly typed arrays well, but has problems when generics (such as a HashMap) are used. The function javaCollectionToVector has been provided for you in the ngram directory. If one wanted to create a vector of values, one could execute v = javaCollectionToVector(hash_instance.values()). The keys could be obtained by converting them to an array: hash_instance.keySet().toArray(). The laplace flag controls whether or not additive smoothing should be used for n- grams with n > 1. When smoothing, your vocabulary size should not include the start and end symbols ( and respectively). Most of the Matlab functions that you need for this file are ones that you should know. Here are a few that you can lookup using Matlab’s help browser:

fopen, fclose, fgetl, strtok

Write the following function to evaluate the perplexity of your model.

function pp = perplexity(model, test_file) % Return the estimated perplexity of model as evaluated by test_file