• 沒有找到結果。

Editing Label Files

在文檔中 The HTK Book (頁 92-95)

6.4 Editing Label Files 86

6.4 Editing Label Files 87 labels on that line. Thus, for example, the command on the third line causes all occurrences of the labels pcl, tcl, kcl or qcl to be replaced by the label cl.

To illustrate the overall effect of the above HLEd command script on a complete label file, the following TIMIT format label file

0000 2241 h#

2241 2715 w 2715 4360 ow 4360 5478 bcl 5478 5643 b 5643 6360 iy 6360 7269 tcl 7269 8313 t 8313 11400 ay 11400 12950 dcl 12950 14360 dh 14360 14640 h#

would be converted by the above script to the following 0 1400625 sil

1400625 1696875 w 1696875 2725000 ow 2725000 3423750 vcl 3423750 3526875 b 3526875 3975000 iy 3975000 4543125 cl 4543125 5195625 t 5195625 7125000 ay 7125000 8093750 vcl 8093750 8975000 dh 8975000 9150000 sil

Notice that label boundaries in TIMIT format are given in terms of sample numbers (16kHz sample rate), whereas the edited output file is in HTK format in which all times are in absolute 100ns units.

As well as the Replace command, there is also a Merge command ME. This command is used to replace a sequence of labels by a single label. For example, the following commands would merge the closure and release labels in the previous TIMIT transcription into single labels

ME b bcl b ME d dcl dh ME t tcl t

As shown by this example, the label used for the merged sequence can be the same as occurs in the original but some care is needed since HLEd commands are normally applied in sequence. Thus, a command on line n is applied to the label sequence that remains after the commands on lines 1 to n − 1 have been applied.

There is one exception to the above rule of sequential edit command application. The Change command CH provides for context sensitive replacement. However, when a sequence of Change commands occur in a script, the sequence is applied as a block so that the contexts which apply for each command are those that existed just prior to the block being executed. The Change command takes 4 arguments X A Y B such that every occurrence of label Y in the context of A B is changed to the label X. The contexts A and B refer to sets of labels and are defined by separate Define Context commands DC. The CH and DC commands are primarily used for creating context sensitive labels. For example, suppose that a set of context-dependent phoneme models are needed for TIMIT. Rather than treat all possible contexts separately and build separate triphones for each (see below), the possible contexts will be grouped into just 5 broad classes: C (consonant), V (vowel), N (nasal), L (liquid) and S (silence). The goal then is to translate a label sequence such as sil b ah t iy n ... into sil+C S-b+V C-ah+C V-t+V C-iy+N V-n+ ... where the - and + symbols within a label are recognised by HTK as defining the left and right context, respectively. To perform this transformation, it is necessary to firstly use DC commands to define the 5 contexts, that is

6.4 Editing Label Files 88 DC V iy ah ae eh ix ...

DC C t k d k g dh ...

DC L l r w j ...

DC N n m ng ...

DC S h# #h epi ...

Having defined the required contexts, a change command must be written for each context depen-dent triphone, that is

CH V-ah+V V ah V CH V-ah+C V ah C CH V-ah+N V ah N CH V-ah+L V ah L

...

etc

This script will, of course, be rather long (25 × number of phonemes) but it can easily be generated automaticaly by a simple program or shell script.

The previous example shows how to transform a set of phonemes into a context dependent set in which the contexts are user-defined. For convenience, HLEd provides a set of global transformation commands for converting phonemic transcriptions to conventional left or right biphones, or full triphones. For example, a script containing the single Triphone Conversion command TC will convert phoneme files to regular triphones. As an illustration, applying the TC command to a file containing the sequence sil b ah t iy n ... would give the transformed sequence sil+b sil-b+ah b-ah+t ah-t+iy t-iy+n iy-n+ .... Notice that the first and last phonemes in the sequence cannot be transformed in the normal way. Hence, the left-most and right-most contexts of these start and end phonemes can be specified explicitly as arguments to the TC commands if required. For example, the command TC # # would give the sequence #-sil+b sil-b+ah b-ah+t ah-t+iy t-iy+n iy-n+ ... +#. Also, the contexts at pauses and word boundaries can be blocked using the WB command. For example, if WB sp was executed, the effect of a subsequent TC command on the sequence sil b ah t sp iy n ... would be to give the sequence sil+b sil-b+ah b-ah+t ah-t sp iy+n iy-n+ ..., where sp represents a short pause. Conversely, the NB command can be used to ignore a label as far as context is concerned. For example, if NB sp was executed, the effect of a subsequent TC command on the sequence sil b ah t sp iy n ... would be to give the sequence sil+b sil-b+ah b-ah+t ah-t+iy sp t-iy+n iy-n+ ....

When processing HTK format label files with multiple levels, only the level 1 (i.e. left-most) labels are affected. To process a higher level, the Move Level command ML should be used. For example, in the script

ML 2 RE one 1 RE two 2 ...

the Replace commands are applied to level 2 which is the first level above the basic level. The command ML 1 returns to the base level. A complete level can be deleted by the Delete Level command DL. This command can be given a numeric argument to delete a specific level or with no argument, the current level is deleted. Multiple levels can also be split into single level alternatives by using the Split Level command SL.

When processing HTK format files with multiple alternatives, each alternative is processed as though it were a separate file.

Remember also that in addition to the explicit HLEd commands, levels and alternatives can be filtered on input by setting the configuration variables TRANSLEV and TRANSALT (see section6.1).

Finally, it should be noted that most HTK tools require all HMMs used in a system to be defined in a HMM List. HLEd can be made to automatically generate such a list as a by-product of editing the label files by using the -n option. For example, the following command would apply the script timit.led to all files in the directory tlabs, write the converted files to the directory hlabs and also write out a list of all new labels in the edited files to tlist.

HLEd -n tlist -l hlabs -G TIMIT timit.led tlabs/*

Notice here that the -G option is used to inform HLEd that the format of the source files is TIMIT.

This could also be indicated by setting the configuration variable SOURCELABEL.

在文檔中 The HTK Book (頁 92-95)