close window

Using Notes

it is useful for:

A level, which is defined as labfile, contains annotations that should be shown at a label type (level) of an other level.

usage:

The source level (labfile) must be defined within the template file. The target level (a label type) must be defined also.

The interface asks for the name of the template file (without extension), the target level (new label type), to which the annotations should be copied and the source level, from which the annotations should be copied. Pressing the START button starts the process for all utterances of the speech data base given by the template file name.

 

use as AutoBuild


package require emu-script

##########################
#This AutoBuild writes ann
otations of a level
#to a label type that is defined in the template file.
#There has to be a equal number of segments at both involved levels,
#that have the same time marks. Only these segments are copied to the label type.

proc copysegmentstolabeltype {hier level newlabeltype} {
  set possible 1
  set faultsegment ""
  set segnos [$hier segments $newlabeltype]
  set segnos2 [$hier segments $level]
  if {"[llength $segnos]" == "[llength $segnos2]"} {
    foreach segment1 $segnos segment2 $segnos2 {
      set timelist1 [$hier seginfo $segment1 times]
      set timelist2 [$hier seginfo $segment2 times]
      foreach time1 $timelist1 time2 $timelist2 {
        set segpossible 1
        if {$time1 != $time2} {
          lappend faultsegment [$hier seginfo $segment2 label $level]; set possible 0
          set segpossible 0
        }
      }
      if {$segpossible} {
        $hier seginfo $segment1 label $newlabeltype [$hier seginfo $segment2 label $level]
      }
    }
  }

   if {!$possible} {     tk_messageBox -message "Following segments aren't copied \n $faultsegments"   }
  $hier write [$hier basename]
}

proc AutoBuildInit {templ} {
}

proc AutoBuild {templ hier} {
  copysegmentstolabeltype $hier level labtype

}


Replace the red marked level names accordingly.

Download file

 

close window