Exercise 1
Tcl/Tk and Introduction JANUS objects

Introduction

The goal of Exercise 1 is to introduce you to the environment, which will be used during the speech laboratory. We assume here that you can handle Netscape and already collect some experience under UNIX. If not, please consult the UNIX introduction for a brief introduction.

After this introduction we will go into deeper detail about Tcl and doing first steps in Janus. All exercises can be solved using the information provided on the speech labs homepage , especially the Janus Tutorial and the the Tcl/Tk man pages .

Working Environment

All laboratories work will happen under the account janus . Ask the instructor for the password. Under ~janus you will find a directory isl-lab containing sub-directories named after yourself.

Create a working environment in your sub-directory, by creating two new directories tools and steps

> cd ~janus/isl-lab/{myfirstname}
> mkdir tools
> mkdir steps

Data

During the workshop we will work with a small database of English read speech. For the exercises you need these data. However it is NOT necessary to make a local copy of all these data. The only thing you need to do is making a symbolic link from the data directory to your directory.

Create a symbolic link from the directory containing the working data to your directory steps

> cd steps
> ln -s /nfs/penance6/janus/data .

Tcl

As you may already know form the JANUS-Tutorial Janus is designed to be object oriented, flexible, handled easily, and look nice, etc. For this purpose the script language Tcl/Tk was choosen as the programming language of Janus. Therefore we need to get familiar with Tcl/Tk in order to work with Janus. If you need some practice in Tcl/Tk, you can do now the first steps by browsing thru Tcl Basics in 5 minutes.
To run tcl commands you can either use tcl, wish or Janus.

To start Tcl type:
> tcl
To start Tcl/Tk type:
> wish
If your are using Janus instead, you start Tcl+Tk+Janus and thus will be able to use the up and down keys like in a UNIX-shell to get back to the commands you typed in before. To start Janus type:
> janusS

Tasks

Please apply now the lessons learned to solve
Task 1. Write a program which reads in a text file and counts the different words occuring in this text file. The program outputs the list of different words together with the number of occurences (separated by blanks). Save the program under your directory ~janus/isl-lab/{myfirstname} in tools/count.tcl
Use the file steps/data/transcripts as input text file. It contains the transcriptions of our database.
Caution: The first field in this text file contains a utterance-ID which should not be counted in the program.

Tip:
Use the sample below for your program, fill in the Authors and Remark field. Please use this sample for future scripts and save all your scripts in your directory tools.

# ===============================================================
#  JANUS-SR   Janus Speech Recognition Toolkit
#             ---------------------------------------------------
#             Advanced Lab Speech Recognition and Understanding
#
#  Author  : 
#  Module  : count.tcl
#  Date    : Feb 16 2001
# 
#  Remarks :
# ===============================================================
if { $argc != 1 || [lindex $argv 1] == "-help"} {
     puts stderr "USAGE: $argv0 'inputfile'"
     exit
}
set filename [lindex $argv 0]

# --------------------
#  read in text file
# --------------------

...
  if [info exists count($word)] {
     incr count($word)
  }

...

# --------------------
#  print sorted list
# --------------------

....

exit
Start this script by typing (assuming your pwd is ~janus/isl-lab/{myfirstname}):
janusS tools/count.tcl steps/data/transcripts

Task 1-1
Convert the dictionary steps/data/dict such that it does not contain the "{,}" and write it to ./newdict
You could do this by a simple perl oneliner:
more steps/data/dict | perl -pe 's/[{}]//g;' > newdict
Question 1-1: What is the output if you are using ./newdict as input file for count.tcl instead of transcripts?

Janus User Interface

This task is about first steps in Janus, about the generation of Janus objects and how to use them. We start with playing around with the Janus User Interface in order to get familiar with it.

Task 2 Start the interface by typing janusS and reproduce the output described in the Janus User Interface introduction.

Question 2-1: How many object classes do you have in your Janus?

Create a matrix m of type DMatrix (double float coefficients) of the following content: {{3 1 0} {-1 0 1} {1 0 0}}

Question 2-2: What's the semantic of this syntax?

Create the transponed matrix mt and the inverse matrix m-1 and build the new matrix k = m-1 * mt

Question 2-3: What's the resulting matrix k?

Question 2-4: Verify E = A * A-1 using your matrix m

FeatureSet object

One of Janus' objects is the FeatureSet. This can be used for preprocessing in speech recognition. For this purpose we are using two data structures:

short-vectors: for audio data in the time domain
float-matrices: result of a short time analysis (the rows correspond to the speech frames)

Vectors and matrices enhanced with additional information are called features. The features are sub-objects of the FeatureSet, which only can exist under the object FeatureSet. Vectors and Matrices are sub-objects of features.

Create two features by typing in the following lines:
FeatureSet fs
fs FMatrix m {{1 2 3} {4 5 6} {7 8 9}}
fs SVector s {1 2 3 4 5 6 7 8 9}

Question 2-5: What happens, i.e. what's the meaning of the following commands:

fs
fs :
fs:
fs.
fs:m
fs:m type
fs:m.
fs:m.data
fs:s.data
fs:s.data -help
fs:m.data := [fs:s.data]

Question 2-6: Are there more information in the features?

IF WE STILL HAVE TIME ... Vocabulary, Coverage, OOV-rate

Task 3
Write a script that outputs the number of words in the text file steps/data/transcripts which are not covered by the dictionary in steps/data/dict.reduced.

Question 3-1: How high is the OOV-rate?

Question 3-2: What are the different ways to define a vocabulary for a speech recognizer?

Last modified: Mon Dec 6 21:26:28 EST 2004
Maintainer: tanja@cs.cmu.edu.