| 1 |
/* praat_TextGrid_init.cpp |
| 2 |
* |
| 3 |
* Copyright (C) 1992-2026 Paul Boersma, 2025-2026 Anastasia Shchupak |
| 4 |
* |
| 5 |
* This code is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 3 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
* See the GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include "CorpusEditor.h" |
| 20 |
#include "Pitch_AnyTier_to_PitchTier.h" |
| 21 |
#include "SpectrumEditor.h" |
| 22 |
#include "SpeechSynthesizer.h" |
| 23 |
#include "SpeechRecognizer.h" |
| 24 |
#include "SpellingChecker.h" |
| 25 |
#include "Strings_extensions.h" |
| 26 |
#include "TextGridEditor.h" |
| 27 |
#include "TextGrid_extensions.h" |
| 28 |
#include "TextGrid_Sound.h" |
| 29 |
#include "WordList.h" |
| 30 |
|
| 31 |
#include "praat_TimeTier.h" |
| 32 |
#include "praat_uvafon_init.h" |
| 33 |
|
| 34 |
static const conststring32 STRING_FROM_FREQUENCY_HZ = U"left Frequency range (Hz)"; |
| 35 |
static const conststring32 STRING_TO_FREQUENCY_HZ = U"right Frequency range (Hz)"; |
| 36 |
static const conststring32 STRING_TIER_NUMBER = U"Tier number"; |
| 37 |
static const conststring32 STRING_INTERVAL_NUMBER = U"Interval number"; |
| 38 |
static const conststring32 STRING_POINT_NUMBER = U"Point number"; |
| 39 |
|
| 40 |
// MARK: - ANYTIER (generic) |
| 41 |
|
| 42 |
DIRECT (NEW1_AnyTier_into_TextGrid) { |
| 43 |
COMBINE_ALL_TO_ONE (Function) |
| 44 |
autoTextGrid result = TextGrid_createWithoutTiers (1e308, -1e308); |
| 45 |
for (integer i = 1; i <= list.size; i ++) |
| 46 |
TextGrid_addTier_copy (result.get(), list.at [i]); |
| 47 |
COMBINE_ALL_TO_ONE_END (U"grid") |
| 48 |
} |
| 49 |
|
| 50 |
// MARK: - INTERVALTIER |
| 51 |
|
| 52 |
FORM (NEW_IntervalTier_downto_TableOfReal, U"IntervalTier: Down to TableOfReal", nullptr) { |
| 53 |
SENTENCE (label, U"Label", U"") |
| 54 |
OK |
| 55 |
DO |
| 56 |
CONVERT_EACH_TO_ONE (IntervalTier) |
| 57 |
autoTableOfReal result = IntervalTier_downto_TableOfReal (me, label); |
| 58 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 59 |
} |
| 60 |
|
| 61 |
DIRECT (NEW_IntervalTier_downto_TableOfReal_any) { |
| 62 |
CONVERT_EACH_TO_ONE (IntervalTier) |
| 63 |
autoTableOfReal result = IntervalTier_downto_TableOfReal_any (me); |
| 64 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 65 |
} |
| 66 |
|
| 67 |
FORM (NEW_IntervalTier_getCentrePoints, U"IntervalTier: Get centre points", nullptr) { |
| 68 |
SENTENCE (text, U"Text", U"") |
| 69 |
OK |
| 70 |
DO |
| 71 |
CONVERT_EACH_TO_ONE (IntervalTier) |
| 72 |
autoPointProcess result = IntervalTier_getCentrePoints (me, text); |
| 73 |
CONVERT_EACH_TO_ONE_END (text) |
| 74 |
} |
| 75 |
|
| 76 |
FORM (NEW_IntervalTier_getEndPoints, U"IntervalTier: Get end points", nullptr) { |
| 77 |
SENTENCE (text, U"Text", U"") |
| 78 |
OK |
| 79 |
DO |
| 80 |
CONVERT_EACH_TO_ONE (IntervalTier) |
| 81 |
autoPointProcess result = IntervalTier_getEndPoints (me, text); |
| 82 |
CONVERT_EACH_TO_ONE_END (text) |
| 83 |
} |
| 84 |
|
| 85 |
FORM (NEW_IntervalTier_getStartingPoints, U"IntervalTier: Get starting points", nullptr) { |
| 86 |
SENTENCE (text, U"Text", U"") |
| 87 |
OK |
| 88 |
DO |
| 89 |
CONVERT_EACH_TO_ONE (IntervalTier) |
| 90 |
autoPointProcess result = IntervalTier_getStartingPoints (me, text); |
| 91 |
CONVERT_EACH_TO_ONE_END (text) |
| 92 |
} |
| 93 |
|
| 94 |
DIRECT (HELP_IntervalTier_help) { |
| 95 |
HELP (U"IntervalTier") |
| 96 |
} |
| 97 |
|
| 98 |
FORM_SAVE (SAVE_IntervalTier_writeToXwaves, U"Xwaves label file", nullptr, nullptr) { |
| 99 |
SAVE_ONE (IntervalTier, U"save the selected IntervalTier object to the Xwaves label file") |
| 100 |
IntervalTier_writeToXwaves (me, file); |
| 101 |
SAVE_ONE_END |
| 102 |
} |
| 103 |
|
| 104 |
// MARK: - INTERVALTIER & POINTPROCESS |
| 105 |
|
| 106 |
FORM (NEW1_IntervalTier_PointProcess_startToCentre, U"From start to centre", U"IntervalTier & PointProcess: Start to centre...") { |
| 107 |
REAL (phase, U"Phase (0-1)", U"0.5") |
| 108 |
OK |
| 109 |
DO |
| 110 |
CONVERT_ONE_AND_ONE_TO_ONE (IntervalTier, PointProcess) |
| 111 |
autoPointProcess result = IntervalTier_PointProcess_startToCentre (me, you, phase); |
| 112 |
CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get(), U"_", Melder_iround (100.0 * phase)); |
| 113 |
} |
| 114 |
|
| 115 |
FORM (NEW1_IntervalTier_PointProcess_endToCentre, U"From end to centre", U"IntervalTier & PointProcess: End to centre...") { |
| 116 |
REAL (phase, U"Phase (0-1)", U"0.5") |
| 117 |
OK |
| 118 |
DO |
| 119 |
CONVERT_ONE_AND_ONE_TO_ONE (IntervalTier, PointProcess) |
| 120 |
autoPointProcess result = IntervalTier_PointProcess_endToCentre (me, you, phase); |
| 121 |
CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get(), U"_", Melder_iround (100.0 * phase)); |
| 122 |
} |
| 123 |
|
| 124 |
// MARK: - LABEL (obsolete) |
| 125 |
|
| 126 |
DIRECT (NEW1_Label_Sound_to_TextGrid) { |
| 127 |
CONVERT_ONE_AND_ONE_TO_ONE (Label, Sound) |
| 128 |
autoTextGrid result = Label_Function_to_TextGrid (me, you); |
| 129 |
CONVERT_ONE_AND_ONE_TO_ONE_END (your name.get()) |
| 130 |
} |
| 131 |
|
| 132 |
DIRECT (HINT_Label_Sound_to_TextGrid) { |
| 133 |
INFO_NONE |
| 134 |
Melder_information (U"This is an old-style Label object. To turn it into a TextGrid, U" |
| 135 |
"select it together with a Sound of the appropriate duration, and click \"To TextGrid\"."); |
| 136 |
INFO_NONE_END |
| 137 |
} |
| 138 |
|
| 139 |
// MARK: - PITCH & TEXTGRID |
| 140 |
|
| 141 |
FORM (GRAPHICS_TextGrid_Pitch_draw, U"TextGrid & Pitch: Draw", nullptr) { |
| 142 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 143 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 144 |
REAL (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"0.0") |
| 145 |
POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0") |
| 146 |
POSITIVE (fontSize, U"Font size (points)", U"18") |
| 147 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 148 |
OPTIONMENUx (textAlignment, U"Text alignment", 2, 0) OPTION (U"left") OPTION (U"centre") OPTION (U"right") |
| 149 |
BOOLEAN (garnish, U"Garnish", true) |
| 150 |
OK |
| 151 |
DO |
| 152 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 153 |
TextGrid_Pitch_draw (me, you, GRAPHICS, tierNumber, fromTime, toTime, fromFrequency, toFrequency, |
| 154 |
fontSize, useTextStyles, textAlignment, garnish, Pitch_speckle_NO, kPitch_unit::HERTZ); |
| 155 |
GRAPHICS_ONE_AND_ONE_END |
| 156 |
} |
| 157 |
|
| 158 |
FORM (GRAPHICS_TextGrid_Pitch_drawErb, U"TextGrid & Pitch: Draw erb", nullptr) { |
| 159 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 160 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 161 |
REAL (fromFrequency, U"left Frequency range (ERB)", U"0.0") |
| 162 |
REAL (toFrequency, U"right Frequency range (ERB)", U"10.0") |
| 163 |
POSITIVE (fontSize, U"Font size (points)", U"18") |
| 164 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 165 |
OPTIONMENUx (textAlignment, U"Text alignment", 2, 0) OPTION (U"left") OPTION (U"centre") OPTION (U"right") |
| 166 |
BOOLEAN (garnish, U"Garnish", true) |
| 167 |
OK |
| 168 |
DO |
| 169 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 170 |
TextGrid_Pitch_draw (me, you, GRAPHICS, tierNumber, fromTime, toTime, fromFrequency, toFrequency, |
| 171 |
fontSize, useTextStyles, textAlignment, garnish, Pitch_speckle_NO, kPitch_unit::ERB); |
| 172 |
GRAPHICS_ONE_AND_ONE_END |
| 173 |
} |
| 174 |
|
| 175 |
FORM (GRAPHICS_TextGrid_Pitch_drawLogarithmic, U"TextGrid & Pitch: Draw logarithmic", nullptr) { |
| 176 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 177 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 178 |
POSITIVE (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"50.0") |
| 179 |
POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0") |
| 180 |
POSITIVE (fontSize, U"Font size (points)", U"18") |
| 181 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 182 |
OPTIONMENUx (textAlignment, U"Text alignment", 2, 0) OPTION (U"left") OPTION (U"centre") OPTION (U"right") |
| 183 |
BOOLEAN (garnish, U"Garnish", true) |
| 184 |
OK |
| 185 |
DO |
| 186 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 187 |
TextGrid_Pitch_draw (me, you, GRAPHICS, tierNumber, fromTime, toTime, fromFrequency, toFrequency, |
| 188 |
fontSize, useTextStyles, textAlignment, garnish, Pitch_speckle_NO, kPitch_unit::HERTZ_LOGARITHMIC); |
| 189 |
GRAPHICS_ONE_AND_ONE_END |
| 190 |
} |
| 191 |
|
| 192 |
FORM (GRAPHICS_TextGrid_Pitch_drawMel, U"TextGrid & Pitch: Draw mel", nullptr) { |
| 193 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 194 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 195 |
REAL (fromFrequency, U"left Frequency range (mel)", U"0.0") |
| 196 |
REAL (toFrequency, U"right Frequency range (mel)", U"500.0") |
| 197 |
POSITIVE (fontSize, U"Font size (points)", U"18") |
| 198 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 199 |
OPTIONMENUx (textAlignment, U"Text alignment", 2, 0) OPTION (U"left") OPTION (U"centre") OPTION (U"right") |
| 200 |
BOOLEAN (garnish, U"Garnish", true) |
| 201 |
OK |
| 202 |
DO |
| 203 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 204 |
TextGrid_Pitch_draw (me, you, GRAPHICS, tierNumber, fromTime, toTime, fromFrequency, toFrequency, |
| 205 |
fontSize, useTextStyles, textAlignment, garnish, Pitch_speckle_NO, kPitch_unit::MEL); |
| 206 |
GRAPHICS_ONE_AND_ONE_END |
| 207 |
} |
| 208 |
|
| 209 |
FORM (GRAPHICS_TextGrid_Pitch_drawSemitones, U"TextGrid & Pitch: Draw semitones", nullptr) { |
| 210 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 211 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 212 |
COMMENT (U"Range in semitones re 100 hertz:") |
| 213 |
REAL (fromFrequency, U"left Frequency range (st)", U"-12.0") |
| 214 |
REAL (toFrequency, U"right Frequency range (st)", U"30.0") |
| 215 |
POSITIVE (fontSize, U"Font size (points)", U"18") |
| 216 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 217 |
OPTIONMENUx (textAlignment, U"Text alignment", 2, 0) OPTION (U"left") OPTION (U"centre") OPTION (U"right") |
| 218 |
BOOLEAN (garnish, U"Garnish", true) |
| 219 |
OK |
| 220 |
DO |
| 221 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 222 |
TextGrid_Pitch_draw (me, you, GRAPHICS, tierNumber, fromTime, toTime, fromFrequency, toFrequency, |
| 223 |
fontSize, useTextStyles, textAlignment, garnish, Pitch_speckle_NO, kPitch_unit::SEMITONES_100); |
| 224 |
GRAPHICS_ONE_AND_ONE_END |
| 225 |
} |
| 226 |
|
| 227 |
FORM (GRAPHICS_TextGrid_Pitch_drawSeparately, U"TextGrid & Pitch: Draw separately", nullptr) { |
| 228 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 229 |
REAL (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"0.0") |
| 230 |
REAL (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0") |
| 231 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 232 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 233 |
BOOLEAN (garnish, U"Garnish", true) |
| 234 |
OK |
| 235 |
DO |
| 236 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 237 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 238 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_NO, kPitch_unit::HERTZ); |
| 239 |
GRAPHICS_ONE_AND_ONE_END |
| 240 |
} |
| 241 |
|
| 242 |
FORM (GRAPHICS_TextGrid_Pitch_drawSeparatelyErb, U"TextGrid & Pitch: Draw separately erb", nullptr) { |
| 243 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 244 |
REAL (fromFrequency, U"left Frequency range (ERB)", U"0.0") |
| 245 |
REAL (toFrequency, U"right Frequency range (ERB)", U"10.0") |
| 246 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 247 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 248 |
BOOLEAN (garnish, U"Garnish", true) |
| 249 |
OK |
| 250 |
DO |
| 251 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 252 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 253 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_NO, kPitch_unit::ERB); |
| 254 |
GRAPHICS_ONE_AND_ONE_END |
| 255 |
} |
| 256 |
|
| 257 |
FORM (GRAPHICS_TextGrid_Pitch_drawSeparatelyLogarithmic, U"TextGrid & Pitch: Draw separately logarithmic", nullptr) { |
| 258 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 259 |
POSITIVE (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"50.0") |
| 260 |
POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0") |
| 261 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 262 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 263 |
BOOLEAN (garnish, U"Garnish", true) |
| 264 |
OK |
| 265 |
DO |
| 266 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 267 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 268 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_NO, kPitch_unit::HERTZ_LOGARITHMIC); |
| 269 |
GRAPHICS_ONE_AND_ONE_END |
| 270 |
} |
| 271 |
|
| 272 |
FORM (GRAPHICS_TextGrid_Pitch_drawSeparatelyMel, U"TextGrid & Pitch: Draw separately mel", nullptr) { |
| 273 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 274 |
REAL (fromFrequency, U"left Frequency range (mel)", U"0.0") |
| 275 |
REAL (toFrequency, U"right Frequency range (mel)", U"500.0") |
| 276 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 277 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 278 |
BOOLEAN (garnish, U"Garnish", true) |
| 279 |
OK |
| 280 |
DO |
| 281 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 282 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 283 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_NO, kPitch_unit::MEL); |
| 284 |
GRAPHICS_ONE_AND_ONE_END |
| 285 |
} |
| 286 |
|
| 287 |
FORM (GRAPHICS_TextGrid_Pitch_drawSeparatelySemitones, U"TextGrid & Pitch: Draw separately semitones", nullptr) { |
| 288 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 289 |
COMMENT (U"Range in semitones re 100 hertz:") |
| 290 |
REAL (fromFrequency, U"left Frequency range (st)", U"-12.0") |
| 291 |
REAL (toFrequency, U"right Frequency range (st)", U"30.0") |
| 292 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 293 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 294 |
BOOLEAN (garnish, U"Garnish", true) |
| 295 |
OK |
| 296 |
DO |
| 297 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 298 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 299 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_NO, kPitch_unit::SEMITONES_100); |
| 300 |
GRAPHICS_ONE_AND_ONE_END |
| 301 |
} |
| 302 |
|
| 303 |
FORM (GRAPHICS_TextGrid_Pitch_speckle, U"TextGrid & Pitch: Speckle", nullptr) { |
| 304 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 305 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 306 |
REAL (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"0.0") |
| 307 |
POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0") |
| 308 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 309 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 310 |
BOOLEAN (garnish, U"Garnish", true) |
| 311 |
OK |
| 312 |
DO |
| 313 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 314 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 315 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::HERTZ); |
| 316 |
GRAPHICS_ONE_AND_ONE_END |
| 317 |
} |
| 318 |
|
| 319 |
FORM (GRAPHICS_TextGrid_Pitch_speckleErb, U"TextGrid & Pitch: Speckle erb", nullptr) { |
| 320 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 321 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 322 |
REAL (fromFrequency, U"left Frequency range (ERB)", U"0.0") |
| 323 |
REAL (toFrequency, U"right Frequency range (ERB)", U"10.0") |
| 324 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 325 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 326 |
BOOLEAN (garnish, U"Garnish", true) |
| 327 |
OK |
| 328 |
DO |
| 329 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 330 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 331 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::ERB); |
| 332 |
GRAPHICS_ONE_AND_ONE_END |
| 333 |
} |
| 334 |
|
| 335 |
FORM (GRAPHICS_TextGrid_Pitch_speckleLogarithmic, U"TextGrid & Pitch: Speckle logarithmic", nullptr) { |
| 336 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 337 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 338 |
POSITIVE (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"50.0") |
| 339 |
POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0") |
| 340 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 341 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 342 |
BOOLEAN (garnish, U"Garnish", true) |
| 343 |
OK |
| 344 |
DO |
| 345 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 346 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 347 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::HERTZ_LOGARITHMIC); |
| 348 |
GRAPHICS_ONE_AND_ONE_END |
| 349 |
} |
| 350 |
|
| 351 |
FORM (GRAPHICS_TextGrid_Pitch_speckleMel, U"TextGrid & Pitch: Speckle mel", nullptr) { |
| 352 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 353 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 354 |
REAL (fromFrequency, U"left Frequency range (mel)", U"0.0") |
| 355 |
REAL (toFrequency, U"right Frequency range (mel)", U"500.0") |
| 356 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 357 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 358 |
BOOLEAN (garnish, U"Garnish", true) |
| 359 |
OK |
| 360 |
DO |
| 361 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 362 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 363 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::MEL); |
| 364 |
GRAPHICS_ONE_AND_ONE_END |
| 365 |
} |
| 366 |
|
| 367 |
FORM (GRAPHICS_TextGrid_Pitch_speckleSemitones, U"TextGrid & Pitch: Speckle semitones", nullptr) { |
| 368 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 369 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 370 |
COMMENT (U"Range in semitones re 100 hertz:") |
| 371 |
REAL (fromFrequency, U"left Frequency range (st)", U"-12.0") |
| 372 |
REAL (toFrequency, U"right Frequency range (st)", U"30.0") |
| 373 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 374 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 375 |
BOOLEAN (garnish, U"Garnish", true) |
| 376 |
OK |
| 377 |
DO |
| 378 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 379 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 380 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::SEMITONES_100); |
| 381 |
GRAPHICS_ONE_AND_ONE_END |
| 382 |
} |
| 383 |
|
| 384 |
FORM (GRAPHICS_TextGrid_Pitch_speckleSeparately, U"TextGrid & Pitch: Speckle separately", nullptr) { |
| 385 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 386 |
REAL (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"0.0") |
| 387 |
REAL (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0") |
| 388 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 389 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 390 |
BOOLEAN (garnish, U"Garnish", true) |
| 391 |
OK |
| 392 |
DO |
| 393 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 394 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 395 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::HERTZ); |
| 396 |
GRAPHICS_ONE_AND_ONE_END |
| 397 |
} |
| 398 |
|
| 399 |
FORM (GRAPHICS_TextGrid_Pitch_speckleSeparatelyErb, U"TextGrid & Pitch: Speckle separately erb", nullptr) { |
| 400 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 401 |
REAL (fromFrequency, U"left Frequency range (ERB)", U"0.0") |
| 402 |
REAL (toFrequency, U"right Frequency range (ERB)", U"10.0") |
| 403 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 404 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 405 |
BOOLEAN (garnish, U"Garnish", true) |
| 406 |
OK |
| 407 |
DO |
| 408 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 409 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 410 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::ERB); |
| 411 |
GRAPHICS_ONE_AND_ONE_END |
| 412 |
} |
| 413 |
|
| 414 |
FORM (GRAPHICS_TextGrid_Pitch_speckleSeparatelyLogarithmic, U"TextGrid & Pitch: Speckle separately logarithmic", nullptr) { |
| 415 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 416 |
POSITIVE (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"50.0") |
| 417 |
POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0") |
| 418 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 419 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 420 |
BOOLEAN (garnish, U"Garnish", true) |
| 421 |
OK |
| 422 |
DO |
| 423 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 424 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 425 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::HERTZ_LOGARITHMIC); |
| 426 |
GRAPHICS_ONE_AND_ONE_END |
| 427 |
} |
| 428 |
|
| 429 |
FORM (GRAPHICS_TextGrid_Pitch_speckleSeparatelyMel, U"TextGrid & Pitch: Speckle separately mel", nullptr) { |
| 430 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 431 |
REAL (fromFrequency, U"left Frequency range (mel)", U"0.0") |
| 432 |
REAL (toFrequency, U"right Frequency range (mel)", U"500.0") |
| 433 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 434 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 435 |
BOOLEAN (garnish, U"Garnish", true) |
| 436 |
OK |
| 437 |
DO |
| 438 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 439 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 440 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::MEL); |
| 441 |
GRAPHICS_ONE_AND_ONE_END |
| 442 |
} |
| 443 |
|
| 444 |
FORM (GRAPHICS_TextGrid_Pitch_speckleSeparatelySemitones, U"TextGrid & Pitch: Speckle separately semitones", nullptr) { |
| 445 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 446 |
COMMENT (U"Range in semitones re 100 hertz:") |
| 447 |
REAL (fromFrequency, U"left Frequency range (st)", U"-12.0") |
| 448 |
REAL (toFrequency, U"right Frequency range (st)", U"30.0") |
| 449 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 450 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 451 |
BOOLEAN (garnish, U"Garnish", true) |
| 452 |
OK |
| 453 |
DO |
| 454 |
GRAPHICS_ONE_AND_ONE (TextGrid, Pitch) |
| 455 |
TextGrid_Pitch_drawSeparately (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, |
| 456 |
showBoundaries, useTextStyles, garnish, Pitch_speckle_YES, kPitch_unit::MEL); |
| 457 |
GRAPHICS_ONE_AND_ONE_END |
| 458 |
} |
| 459 |
|
| 460 |
// MARK: - PITCH & TEXTTIER |
| 461 |
|
| 462 |
FORM (NEW1_Pitch_TextTier_to_PitchTier, U"Pitch & TextTier to PitchTier", U"Pitch & TextTier: To PitchTier...") { |
| 463 |
CHOICEx (unvoicedStrategy, U"Unvoiced strategy", 3, 0) |
| 464 |
OPTION (U"zero") |
| 465 |
OPTION (U"error") |
| 466 |
OPTION (U"interpolate") |
| 467 |
OK |
| 468 |
DO |
| 469 |
CONVERT_ONE_AND_ONE_TO_ONE (Pitch, TextTier) |
| 470 |
autoPitchTier result = Pitch_AnyTier_to_PitchTier (me, you->asAnyTier(), unvoicedStrategy); |
| 471 |
CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get()) |
| 472 |
} |
| 473 |
|
| 474 |
// MARK: - SOUND & TEXTGRID |
| 475 |
|
| 476 |
FORM (GRAPHICS_TextGrid_Sound_draw, U"TextGrid & Sound: Draw...", nullptr) { |
| 477 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 478 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 479 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 480 |
BOOLEAN (garnish, U"Garnish", true) |
| 481 |
OK |
| 482 |
DO |
| 483 |
GRAPHICS_ONE_AND_ONE (TextGrid, Sound) |
| 484 |
TextGrid_Sound_draw (me, you, GRAPHICS, fromTime, toTime, showBoundaries, useTextStyles, garnish); |
| 485 |
GRAPHICS_ONE_AND_ONE_END |
| 486 |
} |
| 487 |
|
| 488 |
FORM (NEW1_TextGrid_Sound_extractAllIntervals, U"TextGrid & Sound: Extract all intervals", nullptr) { |
| 489 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 490 |
BOOLEAN (preserveTimes, U"Preserve times", false) |
| 491 |
OK |
| 492 |
DO |
| 493 |
CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, Sound) |
| 494 |
autoSoundList result = TextGrid_Sound_extractAllIntervals (me, you, tierNumber, preserveTimes); |
| 495 |
result -> classInfo = classCollection; // YUCK, in order to force automatic unpacking |
| 496 |
CONVERT_ONE_AND_ONE_TO_ONE_END (U"dummy") |
| 497 |
} |
| 498 |
|
| 499 |
FORM (NEW1_TextGrid_Sound_extractNonemptyIntervals, U"TextGrid & Sound: Extract non-empty intervals", nullptr) { |
| 500 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 501 |
BOOLEAN (preserveTimes, U"Preserve times", false) |
| 502 |
OK |
| 503 |
DO |
| 504 |
CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, Sound) |
| 505 |
autoSoundList result = TextGrid_Sound_extractNonemptyIntervals (me, you, tierNumber, preserveTimes); |
| 506 |
result -> classInfo = classCollection; // YUCK, in order to force automatic unpacking |
| 507 |
CONVERT_ONE_AND_ONE_TO_ONE_END (U"dummy") |
| 508 |
} |
| 509 |
|
| 510 |
FORM (NEW1_TextGrid_Sound_extractIntervals, U"TextGrid & Sound: Extract intervals", nullptr) { |
| 511 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 512 |
BOOLEAN (preserveTimes, U"Preserve times", false) |
| 513 |
SENTENCE (labelText, U"Label text", U"") |
| 514 |
OK |
| 515 |
DO |
| 516 |
CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, Sound) |
| 517 |
autoSoundList result = TextGrid_Sound_extractIntervalsWhere (me, you, |
| 518 |
tierNumber, kMelder_string::EQUAL_TO, labelText, preserveTimes); |
| 519 |
result -> classInfo = classCollection; // YUCK, in order to force automatic unpacking |
| 520 |
CONVERT_ONE_AND_ONE_TO_ONE_END (U"dummy") |
| 521 |
} |
| 522 |
|
| 523 |
FORM (NEW1_TextGrid_Sound_extractIntervalsWhere, U"TextGrid & Sound: Extract intervals", nullptr) { |
| 524 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 525 |
BOOLEAN (preserveTimes, U"Preserve times", false) |
| 526 |
OPTIONMENU_ENUM (kMelder_string, extractEveryIntervalWhoseLabel___, |
| 527 |
U"Extract every interval whose label...", kMelder_string::DEFAULT) |
| 528 |
SENTENCE (__theText, U"...the text", U"") |
| 529 |
OK |
| 530 |
DO |
| 531 |
CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, Sound) |
| 532 |
autoSoundList result = TextGrid_Sound_extractIntervalsWhere (me, you, tierNumber, |
| 533 |
extractEveryIntervalWhoseLabel___, __theText, preserveTimes); |
| 534 |
result -> classInfo = classCollection; // YUCK, in order to force automatic unpacking |
| 535 |
CONVERT_ONE_AND_ONE_TO_ONE_END (U"dummy") |
| 536 |
} |
| 537 |
|
| 538 |
FORM (MODIFY_TextGrid_Sound_alignInterval, U"TextGrid & Sound: Align interval", nullptr) { |
| 539 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 540 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"1") |
| 541 |
OPTIONMENUSTR (language, U"Language", (int) NUMfindFirst (theSpeechSynthesizerLanguageNames, U"English (Great Britain)")) |
| 542 |
for (integer i = 1; i <= theSpeechSynthesizerLanguageNames.size; i ++) |
| 543 |
OPTION (theSpeechSynthesizerLanguageNames [i]); |
| 544 |
BOOLEAN (includeWords, U"Include words", true) |
| 545 |
BOOLEAN (includePhonemes, U"Include phonemes", true) |
| 546 |
OK |
| 547 |
DO |
| 548 |
MODIFY_FIRST_OF_ONE_AND_ONE (TextGrid, Sound) |
| 549 |
TextGrid_anySound_alignInterval (me, you, tierNumber, intervalNumber, language, includeWords, includePhonemes); |
| 550 |
MODIFY_FIRST_OF_ONE_AND_ONE_END |
| 551 |
} |
| 552 |
|
| 553 |
DIRECT (MODIFY_TextGrid_Sound_scaleTimes) { |
| 554 |
MODIFY_FIRST_OF_ONE_AND_ONE (TextGrid, Sound) |
| 555 |
Function_scaleXTo (me, your xmin, your xmax); |
| 556 |
MODIFY_FIRST_OF_ONE_AND_ONE_END |
| 557 |
} |
| 558 |
|
| 559 |
FORM (MODIFY_TextGrid_Sound_transcribeInterval, U"TextGrid & Sound: Transcribe interval", U"TextGrid & Sound: Transcribe interval...") { |
| 560 |
HEADING (U"TextGrid...") |
| 561 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 562 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"1") |
| 563 |
HEADING (U"Transcription...") |
| 564 |
LISTNUMSTR (modelIndex, modelName, U"Whisper model", constSTRVEC(), 1) |
| 565 |
OPTIONMENUSTR (languageName, U"Language", |
| 566 |
(int) NUMfindFirst (theSpeechRecognizerLanguageNames(), TranscriptionDefaults::languageName)) |
| 567 |
for (integer i = 1; i <= theSpeechRecognizerLanguageNames().size; i ++) |
| 568 |
OPTION (theSpeechRecognizerLanguageNames() [i]) |
| 569 |
BOOLEAN (includeWords, U"Include words", TranscriptionDefaults::includeWords) |
| 570 |
HEADING (U"Non-speech detection...") |
| 571 |
BOOLEAN (useVad, U"Detect non-speech", TranscriptionDefaults::useVad) |
| 572 |
NONNEGATIVE (speechProbabilityThreshold, U"Speech probability threshold (0-1)", VadDefaults::speechThreshold) |
| 573 |
NONNEGATIVE (minNonSpeechDuration, U"Min. gap between speech segments (s)", VadDefaults::minNonSpeechDuration) |
| 574 |
NONNEGATIVE (minSpeechDuration, U"Min. speech segment (s)", VadDefaults::minSpeechDuration) |
| 575 |
NONNEGATIVE (speechPad, U"Padding around speech segments (s)", VadDefaults::speechPad) |
| 576 |
HEADING (U"Diarization...") |
| 577 |
BOOLEAN (includeDiarization, U"Include diarization", TranscriptionDefaults::includeDiarization) |
| 578 |
NATURAL (maxNumSpeakers, U"Max. number of speakers (≥ 2)", DiarizationDefaults::maxNumSpeakers) |
| 579 |
BOOLEAN (allowSpeakersOverlap, U"Allow speakers to overlap", DiarizationDefaults::allowOverlap) |
| 580 |
POSITIVE (clusterThreshold, U"Clustering threshold (0-2)", DiarizationDefaults::clusterThreshold) |
| 581 |
POSITIVE (segmentationStep, U"Segmentation step (0-1)", DiarizationDefaults::segmentationStep) |
| 582 |
OK |
| 583 |
static autoSTRVEC modelNames; |
| 584 |
modelNames = copy_STRVEC (theCurrentSpeechRecognizerModelNames()); // cannot be called twice in the same scope |
| 585 |
|
| 586 |
Melder_require (modelNames.size > 0, |
| 587 |
U"Found no Whisper-cpp models to do speech recognition with.\n" |
| 588 |
U"You can install them into the subfolders “whispercpp” of the folder “models” in the Praat preferences folder." |
| 589 |
); |
| 590 |
|
| 591 |
SET_LIST (modelIndex, modelName, modelNames.get (), NUMfindFirst (modelNames.get (), TranscriptionDefaults::modelName)) |
| 592 |
DO |
| 593 |
MODIFY_FIRST_OF_ONE_AND_ONE (TextGrid, Sound) |
| 594 |
TextGrid_Sound_transcribeInterval (me, you, tierNumber, intervalNumber, modelName, languageName, includeWords, |
| 595 |
useVad, speechProbabilityThreshold, minNonSpeechDuration, minSpeechDuration, speechPad, |
| 596 |
includeDiarization, maxNumSpeakers, allowSpeakersOverlap, clusterThreshold, segmentationStep); |
| 597 |
MODIFY_FIRST_OF_ONE_AND_ONE_END |
| 598 |
} |
| 599 |
|
| 600 |
FORM (MODIFY_TextGrid_Sound_diarizeInterval, U"TextGrid & Sound: Diarize interval", U"TextGrid & Sound: Diarize interval...") { |
| 601 |
HEADING (U"TextGrid...") |
| 602 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 603 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"1") |
| 604 |
HEADING (U"Diarization...") |
| 605 |
NATURAL (maxNumSpeakers, U"Max. number of speakers (≥ 2)", DiarizationDefaults::maxNumSpeakers) |
| 606 |
BOOLEAN (allowSpeakersOverlap, U"Allow speakers to overlap", DiarizationDefaults::allowOverlap) |
| 607 |
WORD (nonSpeechLabel, U"Non-speech interval label", DiarizationDefaults::nonSpeechLabel) |
| 608 |
WORD (speechLabel, U"Speech interval label", DiarizationDefaults::speechLabel) |
| 609 |
POSITIVE (clusterThreshold, U"Clustering threshold (0-2)", DiarizationDefaults::clusterThreshold) |
| 610 |
POSITIVE (segmentationStep, U"Segmentation step (0-1)", DiarizationDefaults::segmentationStep) |
| 611 |
OK |
| 612 |
DO |
| 613 |
MODIFY_FIRST_OF_ONE_AND_ONE (TextGrid, Sound) |
| 614 |
TextGrid_Sound_diarizeInterval (me, you, tierNumber, intervalNumber, |
| 615 |
maxNumSpeakers, allowSpeakersOverlap, nonSpeechLabel, speechLabel, |
| 616 |
clusterThreshold, segmentationStep); |
| 617 |
MODIFY_FIRST_OF_ONE_AND_ONE_END |
| 618 |
} |
| 619 |
|
| 620 |
DIRECT (MODIFY_TextGrid_Sound_cloneTimeDomain) { |
| 621 |
MODIFY_FIRST_OF_ONE_AND_ONE (Sound, TextGrid) |
| 622 |
my x1 += your xmin - your xmin; |
| 623 |
my xmin = your xmin; |
| 624 |
my xmax = your xmax; |
| 625 |
MODIFY_FIRST_OF_ONE_AND_ONE_END |
| 626 |
} |
| 627 |
|
| 628 |
// MARK: - SPELLINGCHECKER |
| 629 |
|
| 630 |
FORM (MODIFY_SpellingChecker_addNewWord, U"Add word to user dictionary", U"SpellingChecker") { |
| 631 |
SENTENCE (newWord, U"New word", U"") |
| 632 |
OK |
| 633 |
DO |
| 634 |
MODIFY_EACH (SpellingChecker) |
| 635 |
SpellingChecker_addNewWord (me, newWord); |
| 636 |
MODIFY_EACH_END |
| 637 |
} |
| 638 |
|
| 639 |
FORM (WINDOW_SpellingChecker_viewAndEdit, U"Edit spelling checker", U"SpellingChecker") { |
| 640 |
COMMENT (U"-- Syntax --") |
| 641 |
SENTENCE (forbiddenStrings, U"Forbidden strings", U"") |
| 642 |
BOOLEAN (checkMatchingParentheses, U"Check matching parentheses", false) |
| 643 |
SENTENCE (separatingCharacters, U"Separating characters", U"") |
| 644 |
BOOLEAN (allowAllParenthesized, U"Allow all parenthesized", false) |
| 645 |
COMMENT (U"-- Capitals --") |
| 646 |
BOOLEAN (allowAllNames, U"Allow all names", false) |
| 647 |
SENTENCE (namePrefixes, U"Name prefixes", U"") |
| 648 |
BOOLEAN (allowAllAbbreviations, U"Allow all abbreviations", false) |
| 649 |
COMMENT (U"-- Capitalization --") |
| 650 |
BOOLEAN (allowCapsSentenceInitially, U"Allow caps sentence-initially", false) |
| 651 |
BOOLEAN (allowCapsAfterColon, U"Allow caps after colon", false) |
| 652 |
COMMENT (U"-- Word parts --") |
| 653 |
SENTENCE (allowAllWordsContaining, U"Allow all words containing", U"") |
| 654 |
SENTENCE (allowAllWordsStartingWith, U"Allow all words starting with", U"") |
| 655 |
SENTENCE (allowAllWordsEndingIn, U"Allow all words ending in", U"") |
| 656 |
OK |
| 657 |
FIND_ONE (SpellingChecker) |
| 658 |
SET_STRING (forbiddenStrings, my forbiddenStrings.get()) |
| 659 |
SET_BOOLEAN (checkMatchingParentheses, my checkMatchingParentheses) |
| 660 |
SET_STRING (separatingCharacters, my separatingCharacters.get()) |
| 661 |
SET_BOOLEAN (allowAllParenthesized, my allowAllParenthesized) |
| 662 |
SET_BOOLEAN (allowAllNames, my allowAllNames) |
| 663 |
SET_STRING (namePrefixes, my namePrefixes.get()) |
| 664 |
SET_BOOLEAN (allowAllAbbreviations, my allowAllAbbreviations) |
| 665 |
SET_BOOLEAN (allowCapsSentenceInitially, my allowCapsSentenceInitially) |
| 666 |
SET_BOOLEAN (allowCapsAfterColon, my allowCapsAfterColon) |
| 667 |
SET_STRING (allowAllWordsContaining, my allowAllWordsContaining.get()) |
| 668 |
SET_STRING (allowAllWordsStartingWith, my allowAllWordsStartingWith.get()) |
| 669 |
SET_STRING (allowAllWordsEndingIn, my allowAllWordsEndingIn.get()) |
| 670 |
DO |
| 671 |
MODIFY_EACH (SpellingChecker) |
| 672 |
my forbiddenStrings = Melder_dup (forbiddenStrings); |
| 673 |
my checkMatchingParentheses = checkMatchingParentheses; |
| 674 |
my separatingCharacters = Melder_dup (separatingCharacters); |
| 675 |
my allowAllParenthesized = allowAllParenthesized; |
| 676 |
my allowAllNames = allowAllNames; |
| 677 |
my namePrefixes = Melder_dup (namePrefixes); |
| 678 |
my allowAllAbbreviations = allowAllAbbreviations; |
| 679 |
my allowCapsSentenceInitially = allowCapsSentenceInitially; |
| 680 |
my allowCapsAfterColon = allowCapsAfterColon; |
| 681 |
my allowAllWordsContaining = Melder_dup (allowAllWordsContaining); |
| 682 |
my allowAllWordsStartingWith = Melder_dup (allowAllWordsStartingWith); |
| 683 |
my allowAllWordsEndingIn = Melder_dup (allowAllWordsEndingIn); |
| 684 |
MODIFY_EACH_END |
| 685 |
} |
| 686 |
|
| 687 |
DIRECT (NEW_SpellingChecker_extractWordList) { |
| 688 |
CONVERT_EACH_TO_ONE (SpellingChecker) |
| 689 |
autoWordList result = SpellingChecker_extractWordList (me); |
| 690 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 691 |
} |
| 692 |
|
| 693 |
DIRECT (NEW_SpellingChecker_extractUserDictionary) { |
| 694 |
CONVERT_EACH_TO_ONE (SpellingChecker) |
| 695 |
autoStringSet result = SpellingChecker_extractUserDictionary (me); |
| 696 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 697 |
} |
| 698 |
|
| 699 |
FORM (BOOLEAN_SpellingChecker_isWordAllowed, U"Is word allowed?", U"SpellingChecker") { |
| 700 |
SENTENCE (word, U"Word", U"") |
| 701 |
OK |
| 702 |
DO |
| 703 |
QUERY_ONE_FOR_REAL (SpellingChecker) |
| 704 |
integer result = SpellingChecker_isWordAllowed (me, word); |
| 705 |
QUERY_ONE_FOR_REAL_END (result ? U" (allowed)" : U" (not allowed)") |
| 706 |
} |
| 707 |
|
| 708 |
FORM (STRING_SpellingChecker_nextNotAllowedWord, U"Next not allowed word?", U"SpellingChecker") { |
| 709 |
TEXTFIELD (sentence, U"Sentence", U"", 10) |
| 710 |
INTEGER (startingCharacter, U"Starting character", U"0") |
| 711 |
OK |
| 712 |
DO |
| 713 |
QUERY_ONE_FOR_STRING (SpellingChecker) |
| 714 |
if (startingCharacter < 0) |
| 715 |
Melder_throw (U"Your starting character should be 0 or positive."); |
| 716 |
if (startingCharacter > Melder_length (sentence)) |
| 717 |
Melder_throw (U"Your starting character should not exceed the end of the sentence."); |
| 718 |
conststring32 result = SpellingChecker_nextNotAllowedWord (me, sentence, & startingCharacter); |
| 719 |
QUERY_ONE_FOR_STRING_END |
| 720 |
} |
| 721 |
|
| 722 |
DIRECT (MODIFY_SpellingChecker_replaceWordList) { |
| 723 |
MODIFY_FIRST_OF_ONE_AND_ONE (SpellingChecker, WordList) |
| 724 |
SpellingChecker_replaceWordList (me, you); |
| 725 |
MODIFY_FIRST_OF_ONE_AND_ONE_END |
| 726 |
} |
| 727 |
|
| 728 |
DIRECT (HINT_SpellingChecker_replaceWordList_help) { |
| 729 |
INFO_NONE |
| 730 |
Melder_information (U"To replace the checker's word list\nby the contents of a Strings object:\n" |
| 731 |
U"1. select the Strings;\n2. convert to a WordList object;\n3. select the SpellingChecker and the WordList;\n" |
| 732 |
U"4. choose Replace."); |
| 733 |
INFO_NONE_END |
| 734 |
} |
| 735 |
|
| 736 |
DIRECT (MODIFY_SpellingChecker_replaceUserDictionary) { |
| 737 |
MODIFY_FIRST_OF_ONE_AND_ONE (SpellingChecker, StringSet) |
| 738 |
SpellingChecker_replaceUserDictionary (me, you); |
| 739 |
MODIFY_FIRST_OF_ONE_AND_ONE_END |
| 740 |
} |
| 741 |
|
| 742 |
// MARK: - TEXTGRID |
| 743 |
|
| 744 |
// MARK: New |
| 745 |
|
| 746 |
FORM (NEW1_TextGrid_create, U"Create TextGrid", U"Create TextGrid...") { |
| 747 |
COMMENT (U"Hint: to label or segment an existing Sound,") |
| 748 |
COMMENT (U"select that Sound and choose \"To TextGrid...\".") |
| 749 |
REAL (startTime, U"Start time (s)", U"0.0") |
| 750 |
REAL (endTime, U"End time (s)", U"1.0") |
| 751 |
SENTENCE (allTierNames, U"All tier names", U"Mary John bell") |
| 752 |
SENTENCE (whichOfTheseArePointTiers, U"Which of these are point tiers?", U"bell") |
| 753 |
OK |
| 754 |
DO |
| 755 |
if (endTime <= startTime) |
| 756 |
Melder_throw (U"The end time should be greater than the start time"); |
| 757 |
CREATE_ONE |
| 758 |
autoTextGrid result = TextGrid_create (startTime, endTime, allTierNames, whichOfTheseArePointTiers); |
| 759 |
CREATE_ONE_END (allTierNames) |
| 760 |
} |
| 761 |
|
| 762 |
// MARK: Save |
| 763 |
|
| 764 |
FORM_SAVE (SAVE_TextGrid_writeToChronologicalTextFile, U"Text file", nullptr, nullptr) { |
| 765 |
SAVE_ONE (TextGrid, U"save the selected TextGrid object to the chronological text file") |
| 766 |
TextGrid_writeToChronologicalTextFile (me, file); |
| 767 |
SAVE_ONE_END |
| 768 |
} |
| 769 |
|
| 770 |
// MARK: Help |
| 771 |
|
| 772 |
DIRECT (HELP_TextGrid_help) { |
| 773 |
HELP (U"TextGrid") |
| 774 |
} |
| 775 |
|
| 776 |
// MARK: View & Edit |
| 777 |
|
| 778 |
static void cb_TextGridEditor_publication (Editor /* editor */, autoDaata publication) { |
| 779 |
/* |
| 780 |
Keep the gate for error handling. |
| 781 |
*/ |
| 782 |
try { |
| 783 |
bool isaSpectralSlice = Thing_isa (publication.get(), classSpectrum) && str32equ (Thing_getName (publication.get()), U"slice"); |
| 784 |
praat_new (publication.move()); |
| 785 |
praat_updateSelection (); |
| 786 |
if (isaSpectralSlice) { |
| 787 |
integer IOBJECT; |
| 788 |
FIND_ONE_WITH_IOBJECT (Spectrum) |
| 789 |
autoSpectrumEditor editor2 = SpectrumEditor_create (ID_AND_FULL_NAME, me); |
| 790 |
praat_installEditor (editor2.get(), IOBJECT); |
| 791 |
editor2.releaseToUser(); |
| 792 |
} |
| 793 |
} catch (MelderError) { |
| 794 |
Melder_flushError (); |
| 795 |
} |
| 796 |
} |
| 797 |
DIRECT (EDITOR_ONE_WITH_ONE_TextGrid_viewAndEdit) { |
| 798 |
EDITOR_ONE_WITH_ONE (a,TextGrid, Sound) // Sound may be null |
| 799 |
autoTextGridEditor editor = TextGridEditor_create (ID_AND_FULL_NAME, me, you, nullptr, nullptr); |
| 800 |
Editor_setPublicationCallback (editor.get(), cb_TextGridEditor_publication); |
| 801 |
EDITOR_ONE_WITH_ONE_END |
| 802 |
} |
| 803 |
|
| 804 |
FORM (EDITOR_ONE_WITH_ONE_TextGrid_viewAndEditWithCallback, U"TextGrid: View & Edit with callback", nullptr) { |
| 805 |
SENTENCE (callbackText, U"Callback text", U"r1") |
| 806 |
OK |
| 807 |
DO |
| 808 |
EDITOR_ONE_WITH_ONE (a,TextGrid, Sound) // Sound may be null |
| 809 |
autoTextGridEditor editor = TextGridEditor_create (ID_AND_FULL_NAME, me, you, nullptr, callbackText); |
| 810 |
Editor_setPublicationCallback (editor.get(), cb_TextGridEditor_publication); |
| 811 |
EDITOR_ONE_WITH_ONE_END |
| 812 |
} |
| 813 |
|
| 814 |
DIRECT (WINDOW_TextGrid_LongSound_viewAndEdit) { |
| 815 |
if (theCurrentPraatApplication -> batch) |
| 816 |
Melder_throw (U"Cannot view or edit a TextGrid from batch."); |
| 817 |
LongSound longSound = nullptr; |
| 818 |
integer ilongSound = 0; |
| 819 |
LOOP { |
| 820 |
if (CLASS == classLongSound) |
| 821 |
longSound = (LongSound) OBJECT, ilongSound = IOBJECT; |
| 822 |
} |
| 823 |
Melder_assert (ilongSound != 0); |
| 824 |
LOOP if (CLASS == classTextGrid) { |
| 825 |
iam_LOOP (TextGrid); |
| 826 |
autoTextGridEditor editor = TextGridEditor_create (ID_AND_FULL_NAME, me, longSound, nullptr, nullptr); |
| 827 |
Editor_setPublicationCallback (editor.get(), cb_TextGridEditor_publication); |
| 828 |
praat_installEditor (editor.get(), IOBJECT); |
| 829 |
editor.releaseToUser(); |
| 830 |
} |
| 831 |
END_NO_NEW_DATA |
| 832 |
} |
| 833 |
|
| 834 |
DIRECT (WINDOW_TextGrid_SpellingChecker_viewAndEdit) { |
| 835 |
if (theCurrentPraatApplication -> batch) |
| 836 |
Melder_throw (U"Cannot view or edit a TextGrid from batch."); |
| 837 |
SpellingChecker spellingChecker = nullptr; |
| 838 |
integer ispellingChecker = 0; |
| 839 |
Sound sound = nullptr; |
| 840 |
LOOP { |
| 841 |
if (CLASS == classSpellingChecker) |
| 842 |
spellingChecker = (SpellingChecker) OBJECT, ispellingChecker = IOBJECT; |
| 843 |
if (CLASS == classSound) |
| 844 |
sound = (Sound) OBJECT; // may stay null |
| 845 |
} |
| 846 |
Melder_assert (ispellingChecker != 0); |
| 847 |
LOOP if (CLASS == classTextGrid) { |
| 848 |
iam_LOOP (TextGrid); |
| 849 |
autoTextGridEditor editor = TextGridEditor_create (ID_AND_FULL_NAME, me, sound, spellingChecker, nullptr); |
| 850 |
praat_installEditor2 (editor.get(), IOBJECT, ispellingChecker); |
| 851 |
editor.releaseToUser(); |
| 852 |
} |
| 853 |
END_NO_NEW_DATA |
| 854 |
} |
| 855 |
|
| 856 |
DIRECT (WINDOW_TextGrid_LongSound_SpellingChecker_viewAndEdit) { |
| 857 |
if (theCurrentPraatApplication -> batch) |
| 858 |
Melder_throw (U"Cannot view or edit a TextGrid from batch."); |
| 859 |
LongSound longSound = nullptr; |
| 860 |
SpellingChecker spellingChecker = nullptr; |
| 861 |
integer ilongSound = 0, ispellingChecker = 0; |
| 862 |
LOOP { |
| 863 |
if (CLASS == classLongSound) |
| 864 |
longSound = (LongSound) OBJECT, ilongSound = IOBJECT; |
| 865 |
if (CLASS == classSpellingChecker) |
| 866 |
spellingChecker = (SpellingChecker) OBJECT, ispellingChecker = IOBJECT; |
| 867 |
} |
| 868 |
Melder_assert (ilongSound != 0 && ispellingChecker != 0); |
| 869 |
LOOP if (CLASS == classTextGrid) { |
| 870 |
iam_LOOP (TextGrid); |
| 871 |
autoTextGridEditor editor = TextGridEditor_create (ID_AND_FULL_NAME, me, longSound, spellingChecker, nullptr); |
| 872 |
praat_installEditor2 (editor.get(), IOBJECT, ispellingChecker); |
| 873 |
editor.releaseToUser(); |
| 874 |
} |
| 875 |
END_NO_NEW_DATA |
| 876 |
} |
| 877 |
|
| 878 |
DIRECT (HINT_TextGrid_Sound_viewAndEdit) { |
| 879 |
INFO_NONE |
| 880 |
Melder_information (U"To include a copy of a Sound in your TextGrid window:\n" |
| 881 |
U" select a TextGrid and a Sound, and click \"View & Edit\"."); |
| 882 |
INFO_NONE_END |
| 883 |
} |
| 884 |
|
| 885 |
// MARK: Draw |
| 886 |
|
| 887 |
FORM (GRAPHICS_TextGrid_draw, U"TextGrid: Draw", nullptr) { |
| 888 |
praat_TimeFunction_RANGE (fromTime, toTime) |
| 889 |
BOOLEAN (showBoundaries, U"Show boundaries", true) |
| 890 |
BOOLEAN (useTextStyles, U"Use text styles", true) |
| 891 |
BOOLEAN (garnish, U"Garnish", true) |
| 892 |
OK |
| 893 |
DO |
| 894 |
GRAPHICS_EACH (TextGrid) |
| 895 |
TextGrid_Sound_draw (me, nullptr, GRAPHICS, fromTime, toTime, showBoundaries, useTextStyles, garnish); |
| 896 |
GRAPHICS_EACH_END |
| 897 |
} |
| 898 |
|
| 899 |
DIRECT (HINT_TextGrid_Sound_draw) { |
| 900 |
INFO_NONE |
| 901 |
Melder_information (U"You can draw a TextGrid together with a Sound after selecting them both."); |
| 902 |
INFO_NONE_END |
| 903 |
} |
| 904 |
|
| 905 |
DIRECT (HINT_TextGrid_Pitch_draw) { |
| 906 |
INFO_NONE |
| 907 |
Melder_information (U"You can draw a TextGrid together with a Pitch after selecting them both."); |
| 908 |
INFO_NONE_END |
| 909 |
} |
| 910 |
|
| 911 |
// MARK: Tabulate |
| 912 |
|
| 913 |
FORM (LIST_TextGrid_list, U"TextGrid: List", nullptr) { |
| 914 |
BOOLEAN (includeLineNumber, U"Include line number", false) |
| 915 |
NATURAL (timeDecimals, U"Time decimals", U"6") |
| 916 |
BOOLEAN (includeTierNames, U"Include tier names", true) |
| 917 |
BOOLEAN (includeEmptyIntervals, U"Include empty intervals", false) |
| 918 |
OK |
| 919 |
DO |
| 920 |
INFO_ONE (TextGrid) |
| 921 |
TextGrid_list (me, includeLineNumber, timeDecimals, includeTierNames, includeEmptyIntervals); |
| 922 |
INFO_ONE_END |
| 923 |
} |
| 924 |
|
| 925 |
FORM (NEW_TextGrid_downto_Table, U"TextGrid: Down to Table", nullptr) { |
| 926 |
BOOLEAN (includeLineNumber, U"Include line number", false) |
| 927 |
NATURAL (timeDecimals, U"Time decimals", U"6") |
| 928 |
BOOLEAN (includeTierNames, U"Include tier names", true) |
| 929 |
BOOLEAN (includeEmptyIntervals, U"Include empty intervals", false) |
| 930 |
OK |
| 931 |
DO |
| 932 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 933 |
autoTable result = TextGrid_downto_Table (me, includeLineNumber, timeDecimals, |
| 934 |
includeTierNames, includeEmptyIntervals); |
| 935 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 936 |
} |
| 937 |
|
| 938 |
FORM (NEW_TextGrid_tabulateOccurrences, U"TextGrid: Tabulate occurrences", nullptr) { |
| 939 |
REALVECTOR (searchTiers, U"Search tiers", WHITESPACE_SEPARATED_, U"1 2") |
| 940 |
OPTIONMENU_ENUM (kMelder_string, listEveryLabelThat___, |
| 941 |
U"List every label that...", kMelder_string::DEFAULT) |
| 942 |
SENTENCE (___theText, U"...the text", U"hello") |
| 943 |
BOOLEAN (caseSensitive, U"Case-sensitive", false) |
| 944 |
OK |
| 945 |
DO |
| 946 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 947 |
autoTable result = TextGrid_tabulateOccurrences (me, searchTiers, listEveryLabelThat___, ___theText, caseSensitive); |
| 948 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", ___theText) |
| 949 |
} |
| 950 |
|
| 951 |
|
| 952 |
// MARK: Query |
| 953 |
|
| 954 |
DIRECT (INTEGER_TextGrid_getNumberOfTiers) { |
| 955 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 956 |
integer result = my tiers->size; |
| 957 |
QUERY_ONE_FOR_REAL_END (U" tiers") |
| 958 |
} |
| 959 |
|
| 960 |
inline static void pr_TextGrid_checkTierNumber (TextGrid me, integer tierNumber) { |
| 961 |
if (tierNumber > my tiers->size) |
| 962 |
Melder_throw (U"Your tier number (", tierNumber, |
| 963 |
U") should not be greater than the number of tiers (", my tiers->size, U")."); |
| 964 |
} |
| 965 |
|
| 966 |
inline static Function pr_TextGrid_peekTier (TextGrid me, integer tierNumber) { |
| 967 |
pr_TextGrid_checkTierNumber (me, tierNumber); |
| 968 |
return my tiers->at [tierNumber]; |
| 969 |
} |
| 970 |
|
| 971 |
FORM (STRING_TextGrid_getTierName, U"TextGrid: Get tier name", nullptr) { |
| 972 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 973 |
OK |
| 974 |
DO |
| 975 |
QUERY_ONE_FOR_STRING (TextGrid) |
| 976 |
Function tier = pr_TextGrid_peekTier (me, tierNumber); |
| 977 |
conststring32 result = tier -> name.get(); |
| 978 |
QUERY_ONE_FOR_STRING_END |
| 979 |
} |
| 980 |
|
| 981 |
FORM (BOOLEAN_TextGrid_isIntervalTier, U"TextGrid: Is interval tier?", nullptr) { |
| 982 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 983 |
OK |
| 984 |
DO |
| 985 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 986 |
Function tier = pr_TextGrid_peekTier (me, tierNumber); |
| 987 |
integer result = ( tier -> classInfo == classIntervalTier ); |
| 988 |
QUERY_ONE_FOR_REAL_END (result ? U" (yes, tier " : U" (no, tier ", tierNumber, |
| 989 |
result ? U" is an interval tier)" : U" is a point tier)") |
| 990 |
} |
| 991 |
|
| 992 |
static IntervalTier pr_TextGrid_peekIntervalTier (TextGrid me, integer tierNumber) { |
| 993 |
Function tier = pr_TextGrid_peekTier (me, tierNumber); |
| 994 |
if (tier -> classInfo != classIntervalTier) |
| 995 |
Melder_throw (U"Your tier should be an interval tier."); |
| 996 |
return (IntervalTier) tier; |
| 997 |
} |
| 998 |
|
| 999 |
FORM (INTEGER_TextGrid_getNumberOfIntervals, U"TextGrid: Get number of intervals", nullptr) { |
| 1000 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1001 |
OK |
| 1002 |
DO |
| 1003 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1004 |
IntervalTier intervalTier = pr_TextGrid_peekIntervalTier (me, tierNumber); |
| 1005 |
integer result = intervalTier -> intervals.size; |
| 1006 |
QUERY_ONE_FOR_REAL_END (U" intervals") |
| 1007 |
} |
| 1008 |
|
| 1009 |
static TextInterval pr_TextGrid_peekInterval (TextGrid me, integer tierNumber, integer intervalNumber) { |
| 1010 |
IntervalTier intervalTier = pr_TextGrid_peekIntervalTier (me, tierNumber); |
| 1011 |
if (intervalNumber > intervalTier -> intervals.size) Melder_throw (U"Interval number too large."); |
| 1012 |
return intervalTier -> intervals.at [intervalNumber]; |
| 1013 |
} |
| 1014 |
|
| 1015 |
FORM (REAL_TextGrid_getStartTimeOfInterval, U"TextGrid: Get start time of interval", nullptr) { |
| 1016 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1017 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"1") |
| 1018 |
OK |
| 1019 |
DO |
| 1020 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1021 |
TextInterval interval = pr_TextGrid_peekInterval (me, tierNumber, intervalNumber); |
| 1022 |
double result = interval -> xmin; |
| 1023 |
QUERY_ONE_FOR_REAL_END (U" seconds") |
| 1024 |
} |
| 1025 |
|
| 1026 |
FORM (REAL_TextGrid_getEndTimeOfInterval, U"TextGrid: Get end time of interval", nullptr) { |
| 1027 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1028 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"1") |
| 1029 |
OK |
| 1030 |
DO |
| 1031 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1032 |
TextInterval interval = pr_TextGrid_peekInterval (me, tierNumber, intervalNumber); |
| 1033 |
double result = interval -> xmax; |
| 1034 |
QUERY_ONE_FOR_REAL_END (U" seconds") |
| 1035 |
} |
| 1036 |
|
| 1037 |
FORM (STRING_TextGrid_getLabelOfInterval, U"TextGrid: Get label of interval", nullptr) { |
| 1038 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1039 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"1") |
| 1040 |
OK |
| 1041 |
DO |
| 1042 |
QUERY_ONE_FOR_STRING (TextGrid) |
| 1043 |
TextInterval interval = pr_TextGrid_peekInterval (me, tierNumber, intervalNumber); |
| 1044 |
conststring32 result = interval -> text.get(); |
| 1045 |
QUERY_ONE_FOR_STRING_END |
| 1046 |
} |
| 1047 |
|
| 1048 |
FORM (INTEGER_TextGrid_getIntervalAtTime, U"TextGrid: Get interval at time", nullptr) { |
| 1049 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1050 |
REAL (time, U"Time (s)", U"0.5") |
| 1051 |
OK |
| 1052 |
DO |
| 1053 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1054 |
IntervalTier intervalTier = pr_TextGrid_peekIntervalTier (me, tierNumber); |
| 1055 |
integer result = IntervalTier_timeToIndex (intervalTier, time); |
| 1056 |
QUERY_ONE_FOR_REAL_END (U" (interval number)") |
| 1057 |
} |
| 1058 |
|
| 1059 |
FORM (INTEGER_TextGrid_getLowIntervalAtTime, U"TextGrid: Get low interval at time", nullptr) { |
| 1060 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1061 |
REAL (time, U"Time (s)", U"0.5") |
| 1062 |
OK |
| 1063 |
DO |
| 1064 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1065 |
IntervalTier intervalTier = pr_TextGrid_peekIntervalTier (me, tierNumber); |
| 1066 |
integer result = IntervalTier_timeToHighIndex (intervalTier, time); |
| 1067 |
QUERY_ONE_FOR_REAL_END (U" (low interval)") |
| 1068 |
} |
| 1069 |
|
| 1070 |
FORM (INTEGER_TextGrid_getHighIntervalAtTime, U"TextGrid: Get high interval at time", nullptr) { |
| 1071 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1072 |
REAL (time, U"Time (s)", U"0.5") |
| 1073 |
OK |
| 1074 |
DO |
| 1075 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1076 |
IntervalTier intervalTier = pr_TextGrid_peekIntervalTier (me, tierNumber); |
| 1077 |
integer result = IntervalTier_timeToLowIndex (intervalTier, time); |
| 1078 |
QUERY_ONE_FOR_REAL_END (U" (high interval)") |
| 1079 |
} |
| 1080 |
|
| 1081 |
FORM (INTEGER_TextGrid_getIntervalEdgeFromTime, U"TextGrid: Get interval edge from time", nullptr) { |
| 1082 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1083 |
REAL (time, U"Time (s)", U"0.5") |
| 1084 |
OK |
| 1085 |
DO |
| 1086 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1087 |
IntervalTier intervalTier = pr_TextGrid_peekIntervalTier (me, tierNumber); |
| 1088 |
integer result = IntervalTier_hasTime (intervalTier, time); |
| 1089 |
QUERY_ONE_FOR_REAL_END (U" (interval edge)") |
| 1090 |
} |
| 1091 |
|
| 1092 |
FORM (INTEGER_TextGrid_getIntervalBoundaryFromTime, U"TextGrid: Get interval boundary from time", nullptr) { |
| 1093 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1094 |
REAL (time, U"Time (s)", U"0.5") |
| 1095 |
OK |
| 1096 |
DO |
| 1097 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1098 |
IntervalTier intervalTier = pr_TextGrid_peekIntervalTier (me, tierNumber); |
| 1099 |
integer result = IntervalTier_hasBoundary (intervalTier, time); |
| 1100 |
QUERY_ONE_FOR_REAL_END (U" (interval boundary)") |
| 1101 |
} |
| 1102 |
|
| 1103 |
FORM (INTEGER_TextGrid_countIntervalsWhere, U"Count intervals", U"TextGrid: Count intervals where...") { |
| 1104 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1105 |
OPTIONMENU_ENUM (kMelder_string, countIntervalsWhoseLabel___, |
| 1106 |
U"Count intervals whose label...", kMelder_string::DEFAULT) |
| 1107 |
SENTENCE (___theText, U"...the text", U"hi") |
| 1108 |
OK |
| 1109 |
DO |
| 1110 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1111 |
integer result = TextGrid_countIntervalsWhere (me, tierNumber, countIntervalsWhoseLabel___, ___theText); |
| 1112 |
QUERY_ONE_FOR_REAL_END (U" intervals containing ", ___theText); |
| 1113 |
} |
| 1114 |
|
| 1115 |
static TextTier pr_TextGrid_peekTextTier (TextGrid me, integer tierNumber) { |
| 1116 |
Function tier = pr_TextGrid_peekTier (me, tierNumber); |
| 1117 |
if (! tier) return nullptr; |
| 1118 |
if (tier -> classInfo != classTextTier) Melder_throw (U"Your tier should be a point tier (TextTier)."); |
| 1119 |
return (TextTier) tier; |
| 1120 |
} |
| 1121 |
|
| 1122 |
FORM (INTEGER_TextGrid_getNumberOfPoints, U"TextGrid: Get number of points", nullptr) { |
| 1123 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1124 |
OK |
| 1125 |
DO |
| 1126 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1127 |
TextTier textTier = pr_TextGrid_peekTextTier (me, tierNumber); |
| 1128 |
integer result = textTier -> points.size; |
| 1129 |
QUERY_ONE_FOR_REAL_END (U" (points") |
| 1130 |
} |
| 1131 |
|
| 1132 |
static TextPoint pr_TextGrid_peekPoint (TextGrid me, integer tierNumber, integer pointNumber) { |
| 1133 |
TextTier textTier = pr_TextGrid_peekTextTier (me, tierNumber); |
| 1134 |
if (pointNumber > textTier -> points.size) Melder_throw (U"Point number too large."); |
| 1135 |
return textTier -> points.at [pointNumber]; |
| 1136 |
} |
| 1137 |
|
| 1138 |
FORM (REAL_TextGrid_getTimeOfPoint, U"TextGrid: Get time of point", nullptr) { |
| 1139 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1140 |
NATURAL (pointNumber, STRING_POINT_NUMBER, U"1") |
| 1141 |
OK |
| 1142 |
DO |
| 1143 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1144 |
TextPoint point = pr_TextGrid_peekPoint (me, tierNumber, pointNumber); |
| 1145 |
double result = point -> number; |
| 1146 |
QUERY_ONE_FOR_REAL_END (U" seconds") |
| 1147 |
} |
| 1148 |
|
| 1149 |
FORM (STRING_TextGrid_getLabelOfPoint, U"TextGrid: Get label of point", nullptr) { |
| 1150 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1151 |
NATURAL (pointNumber, STRING_POINT_NUMBER, U"1") |
| 1152 |
OK |
| 1153 |
DO |
| 1154 |
QUERY_ONE_FOR_STRING (TextGrid) |
| 1155 |
TextPoint point = pr_TextGrid_peekPoint (me, tierNumber, pointNumber); |
| 1156 |
conststring32 result = point -> mark.get(); |
| 1157 |
QUERY_ONE_FOR_STRING_END |
| 1158 |
} |
| 1159 |
|
| 1160 |
FORM (INTEGER_TextGrid_getLowIndexFromTime, U"Get low index", U"AnyTier: Get low index from time...") { |
| 1161 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1162 |
REAL (time, U"Time (s)", U"0.5") |
| 1163 |
OK |
| 1164 |
DO |
| 1165 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1166 |
TextTier textTier = pr_TextGrid_peekTextTier (me, tierNumber); |
| 1167 |
integer result = AnyTier_timeToLowIndex (textTier->asAnyTier(), time); |
| 1168 |
QUERY_ONE_FOR_REAL_END (U" (low index)") |
| 1169 |
} |
| 1170 |
|
| 1171 |
FORM (INTEGER_TextGrid_getHighIndexFromTime, U"Get high index", U"AnyTier: Get high index from time...") { |
| 1172 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1173 |
REAL (time, U"Time (s)", U"0.5") |
| 1174 |
OK |
| 1175 |
DO |
| 1176 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1177 |
TextTier textTier = pr_TextGrid_peekTextTier (me, tierNumber); |
| 1178 |
integer result = AnyTier_timeToHighIndex (textTier->asAnyTier(), time); |
| 1179 |
QUERY_ONE_FOR_REAL_END (U" (high index)") |
| 1180 |
} |
| 1181 |
|
| 1182 |
FORM (INTEGER_TextGrid_getNearestIndexFromTime, U"Get nearest index", U"AnyTier: Get nearest index from time...") { |
| 1183 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1184 |
REAL (time, U"Time (s)", U"0.5") |
| 1185 |
OK |
| 1186 |
DO |
| 1187 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1188 |
TextTier textTier = pr_TextGrid_peekTextTier (me, tierNumber); |
| 1189 |
integer result = AnyTier_timeToNearestIndex (textTier->asAnyTier(), time); |
| 1190 |
QUERY_ONE_FOR_REAL_END (U" (nearest index)") |
| 1191 |
} |
| 1192 |
|
| 1193 |
FORM (INTEGER_TextGrid_countPointsWhere, U"Count points", U"TextGrid: Count points where...") { |
| 1194 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1195 |
OPTIONMENU_ENUM (kMelder_string, countPointsWhoseLabel___, |
| 1196 |
U"Count points whose label...", kMelder_string::DEFAULT) |
| 1197 |
SENTENCE (___theText, U"...the text", U"hi") |
| 1198 |
OK |
| 1199 |
DO |
| 1200 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1201 |
integer result = TextGrid_countPointsWhere (me, tierNumber, countPointsWhoseLabel___, ___theText); |
| 1202 |
QUERY_ONE_FOR_REAL_END (U" points containing ", ___theText); |
| 1203 |
} |
| 1204 |
|
| 1205 |
FORM (INTEGER_TextGrid_countLabels, U"Count labels", U"TextGrid: Count labels...") { |
| 1206 |
INTEGER (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1207 |
SENTENCE (labelText, U"Label text", U"a") |
| 1208 |
OK |
| 1209 |
DO |
| 1210 |
QUERY_ONE_FOR_REAL (TextGrid) |
| 1211 |
integer result = TextGrid_countLabels (me, tierNumber, labelText); |
| 1212 |
QUERY_ONE_FOR_REAL_END (U" labels ", labelText) |
| 1213 |
} |
| 1214 |
|
| 1215 |
// MARK: Modify |
| 1216 |
|
| 1217 |
DIRECT (MODIFY_TextGrid_convertToBackslashTrigraphs) { |
| 1218 |
MODIFY_EACH (TextGrid) |
| 1219 |
TextGrid_convertToBackslashTrigraphs (me); |
| 1220 |
MODIFY_EACH_END |
| 1221 |
} |
| 1222 |
|
| 1223 |
DIRECT (MODIFY_TextGrid_convertToUnicode) { |
| 1224 |
MODIFY_EACH (TextGrid) |
| 1225 |
TextGrid_convertToUnicode (me); |
| 1226 |
MODIFY_EACH_END |
| 1227 |
} |
| 1228 |
|
| 1229 |
FORM (MODIFY_TextGrid_insertIntervalTier, U"TextGrid: Insert interval tier", nullptr) { |
| 1230 |
NATURAL (position, U"Position", U"1 (= at top)") |
| 1231 |
WORD (name, U"Name", U"") |
| 1232 |
OK |
| 1233 |
DO |
| 1234 |
MODIFY_EACH (TextGrid) |
| 1235 |
{// scope |
| 1236 |
autoIntervalTier tier = IntervalTier_create (my xmin, my xmax); |
| 1237 |
Melder_clipRight (& position, my tiers->size + 1); |
| 1238 |
Thing_setName (tier.get(), name); |
| 1239 |
my tiers -> addItemAtPosition_move (tier.move(), position); |
| 1240 |
} |
| 1241 |
MODIFY_EACH_END |
| 1242 |
} |
| 1243 |
|
| 1244 |
FORM (MODIFY_TextGrid_insertPointTier, U"TextGrid: Insert point tier", nullptr) { |
| 1245 |
NATURAL (position, U"Position", U"1 (= at top)") |
| 1246 |
WORD (name, U"Name", U"") |
| 1247 |
OK |
| 1248 |
DO |
| 1249 |
MODIFY_EACH (TextGrid) |
| 1250 |
{// scope |
| 1251 |
autoTextTier tier = TextTier_create (my xmin, my xmax); |
| 1252 |
Melder_clipRight (& position, my tiers->size + 1); |
| 1253 |
Thing_setName (tier.get(), name); |
| 1254 |
my tiers -> addItemAtPosition_move (tier.move(), position); |
| 1255 |
} |
| 1256 |
MODIFY_EACH_END |
| 1257 |
} |
| 1258 |
|
| 1259 |
FORM (MODIFY_TextGrid_duplicateTier, U"TextGrid: Duplicate tier", nullptr) { |
| 1260 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1261 |
NATURAL (position, U"Position", U"1 (= at top)") |
| 1262 |
WORD (name, U"Name", U"") |
| 1263 |
OK |
| 1264 |
DO |
| 1265 |
MODIFY_EACH (TextGrid) |
| 1266 |
Melder_clipRight (& tierNumber, my tiers->size); |
| 1267 |
{// scope |
| 1268 |
autoFunction newTier = Data_copy (my tiers->at [tierNumber]); |
| 1269 |
Thing_setName (newTier.get(), name); |
| 1270 |
my tiers -> addItemAtPosition_move (newTier.move(), position); |
| 1271 |
} |
| 1272 |
MODIFY_EACH_END |
| 1273 |
} |
| 1274 |
|
| 1275 |
FORM (MODIFY_TextGrid_removeTier, U"TextGrid: Remove tier", nullptr) { |
| 1276 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1277 |
OK |
| 1278 |
DO |
| 1279 |
MODIFY_EACH (TextGrid) |
| 1280 |
if (my tiers->size <= 1) |
| 1281 |
Melder_throw (U"Sorry, I refuse to remove the last tier."); |
| 1282 |
Melder_clipRight (& tierNumber, my tiers->size); |
| 1283 |
my tiers -> removeItem (tierNumber); |
| 1284 |
MODIFY_EACH_END |
| 1285 |
} |
| 1286 |
|
| 1287 |
FORM (MODIFY_TextGrid_insertBoundary, U"TextGrid: Insert boundary", nullptr) { |
| 1288 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1289 |
REAL (time, U"Time (s)", U"0.5") |
| 1290 |
OK |
| 1291 |
DO |
| 1292 |
MODIFY_EACH (TextGrid) |
| 1293 |
TextGrid_insertBoundary (me, tierNumber, time); |
| 1294 |
MODIFY_EACH_END |
| 1295 |
} |
| 1296 |
|
| 1297 |
FORM (MODIFY_TextGrid_removeLeftBoundary, U"TextGrid: Remove left boundary", nullptr) { |
| 1298 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1299 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"2") |
| 1300 |
OK |
| 1301 |
DO |
| 1302 |
MODIFY_EACH (TextGrid) |
| 1303 |
IntervalTier intervalTier; |
| 1304 |
if (tierNumber > my tiers->size) |
| 1305 |
Melder_throw (U"You cannot remove a boundary from tier ", tierNumber, U" of ", me, |
| 1306 |
U", because that TextGrid has only ", my tiers->size, U" tiers."); |
| 1307 |
intervalTier = (IntervalTier) my tiers->at [tierNumber]; |
| 1308 |
if (intervalTier -> classInfo != classIntervalTier) |
| 1309 |
Melder_throw (U"You cannot remove a boundary from tier ", tierNumber, U" of ", me, |
| 1310 |
U", because that tier is a point tier instead of an interval tier."); |
| 1311 |
if (intervalNumber > intervalTier -> intervals.size) |
| 1312 |
Melder_throw (U"You cannot remove a boundary from interval ", intervalNumber, U" of tier ", tierNumber, U" of ", me, |
| 1313 |
U", because that tier has only ", intervalTier -> intervals.size, U" intervals."); |
| 1314 |
if (intervalNumber == 1) |
| 1315 |
Melder_throw (U"You cannot remove the left boundary from interval 1 of tier ", tierNumber, U" of ", me, |
| 1316 |
U", because this is at the left edge of the tier."); |
| 1317 |
IntervalTier_removeLeftBoundary (intervalTier, intervalNumber); |
| 1318 |
MODIFY_EACH_END |
| 1319 |
} |
| 1320 |
|
| 1321 |
FORM (MODIFY_TextGrid_removeRightBoundary, U"TextGrid: Remove right boundary", nullptr) { |
| 1322 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1323 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"2") |
| 1324 |
OK |
| 1325 |
DO |
| 1326 |
MODIFY_EACH (TextGrid) |
| 1327 |
IntervalTier intervalTier; |
| 1328 |
if (tierNumber > my tiers->size) |
| 1329 |
Melder_throw (U"You cannot remove a boundary from tier ", tierNumber, U" of ", me, |
| 1330 |
U", because that TextGrid has only ", my tiers->size, U" tiers."); |
| 1331 |
intervalTier = (IntervalTier) my tiers->at [tierNumber]; |
| 1332 |
if (intervalTier -> classInfo != classIntervalTier) |
| 1333 |
Melder_throw (U"You cannot remove a boundary from tier ", tierNumber, U" of ", me, |
| 1334 |
U", because that tier is a point tier instead of an interval tier."); |
| 1335 |
if (intervalNumber > intervalTier -> intervals.size) |
| 1336 |
Melder_throw (U"You cannot remove a boundary from interval ", intervalNumber, U" of tier ", tierNumber, U" of ", me, |
| 1337 |
U", because that tier has only ", intervalTier -> intervals.size, U" intervals."); |
| 1338 |
if (intervalNumber == intervalTier -> intervals.size) |
| 1339 |
Melder_throw (U"You cannot remove the right boundary from interval ", intervalNumber, U" of tier ", tierNumber, U" of ", me, |
| 1340 |
U", because this is at the right edge of the tier."); |
| 1341 |
IntervalTier_removeLeftBoundary (intervalTier, intervalNumber + 1); |
| 1342 |
MODIFY_EACH_END |
| 1343 |
} |
| 1344 |
|
| 1345 |
FORM (MODIFY_TextGrid_removeBoundaryAtTime, U"TextGrid: Remove boundary at time", nullptr) { |
| 1346 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1347 |
REAL (time, U"Time (s)", U"0.5") |
| 1348 |
OK |
| 1349 |
DO |
| 1350 |
MODIFY_EACH (TextGrid) |
| 1351 |
TextGrid_removeBoundaryAtTime (me, tierNumber, time); |
| 1352 |
MODIFY_EACH_END |
| 1353 |
} |
| 1354 |
|
| 1355 |
FORM (MODIFY_TextGrid_setIntervalText, U"TextGrid: Set interval text", nullptr) { |
| 1356 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1357 |
NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"1") |
| 1358 |
TEXTFIELD (text, U"Text", U"", 10) |
| 1359 |
OK |
| 1360 |
DO |
| 1361 |
MODIFY_EACH (TextGrid) |
| 1362 |
TextGrid_setIntervalText (me, tierNumber, intervalNumber, text); |
| 1363 |
MODIFY_EACH_END |
| 1364 |
} |
| 1365 |
|
| 1366 |
FORM (MODIFY_TextGrid_insertPoint, U"TextGrid: Insert point", nullptr) { |
| 1367 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1368 |
REAL (time, U"Time (s)", U"0.5") |
| 1369 |
TEXTFIELD (text, U"Text", U"", 10) |
| 1370 |
OK |
| 1371 |
DO |
| 1372 |
MODIFY_EACH (TextGrid) |
| 1373 |
TextGrid_insertPoint (me, tierNumber, time, text); |
| 1374 |
MODIFY_EACH_END |
| 1375 |
} |
| 1376 |
|
| 1377 |
FORM (MODIFY_TextGrid_removePoint, U"TextGrid: Remove point", nullptr) { |
| 1378 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1379 |
NATURAL (pointNumber, STRING_POINT_NUMBER, U"2") |
| 1380 |
OK |
| 1381 |
DO |
| 1382 |
MODIFY_EACH (TextGrid) |
| 1383 |
TextTier pointTier; |
| 1384 |
if (tierNumber > my tiers->size) |
| 1385 |
Melder_throw (U"You cannot remove a point from tier ", tierNumber, U" of ", me, |
| 1386 |
U", because that TextGrid has only ", my tiers->size, U" tiers."); |
| 1387 |
pointTier = (TextTier) my tiers->at [tierNumber]; |
| 1388 |
if (pointTier -> classInfo != classTextTier) |
| 1389 |
Melder_throw (U"You cannot remove a point from tier ", tierNumber, U" of ", me, |
| 1390 |
U", because that tier is an interval tier instead of a point tier."); |
| 1391 |
if (pointNumber > pointTier -> points.size) |
| 1392 |
Melder_throw (U"You cannot remove point ", pointNumber, U" from tier ", tierNumber, U" of ", me, |
| 1393 |
U", because that tier has only ", pointTier -> points.size, U" points."); |
| 1394 |
TextTier_removePoint (pointTier, pointNumber); |
| 1395 |
MODIFY_EACH_END |
| 1396 |
} |
| 1397 |
|
| 1398 |
FORM (MODIFY_TextGrid_removePoints, U"Remove points", nullptr) { |
| 1399 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1400 |
OPTIONMENU_ENUM (kMelder_string, removeEveryPointWhoseLabel___, |
| 1401 |
U"Remove every point whose label...", kMelder_string::DEFAULT) |
| 1402 |
SENTENCE (___theText, U"...the text", U"hi") |
| 1403 |
OK |
| 1404 |
DO |
| 1405 |
MODIFY_EACH (TextGrid) |
| 1406 |
TextGrid_removePoints (me, tierNumber, removeEveryPointWhoseLabel___, ___theText); |
| 1407 |
MODIFY_EACH_END |
| 1408 |
} |
| 1409 |
|
| 1410 |
FORM (MODIFY_TextGrid_setPointText, U"TextGrid: Set point text", nullptr) { |
| 1411 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1412 |
NATURAL (pointNumber, STRING_POINT_NUMBER, U"1") |
| 1413 |
TEXTFIELD (text, U"Text", U"", 10) |
| 1414 |
OK |
| 1415 |
DO |
| 1416 |
MODIFY_EACH (TextGrid) |
| 1417 |
TextGrid_setPointText (me, tierNumber, pointNumber, text); |
| 1418 |
MODIFY_EACH_END |
| 1419 |
} |
| 1420 |
|
| 1421 |
// MARK: Analyse |
| 1422 |
|
| 1423 |
FORM (NEW1_TextGrid_extractOneTier, U"TextGrid: Extract one tier", nullptr) { |
| 1424 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1425 |
OK |
| 1426 |
DO |
| 1427 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1428 |
Function tier = pr_TextGrid_peekTier (me, tierNumber); |
| 1429 |
autoTextGrid result = TextGrid_createWithoutTiers (1e308, -1e308); |
| 1430 |
TextGrid_addTier_copy (result.get(), tier); // no transfer of tier ownership, because a copy is made |
| 1431 |
CONVERT_EACH_TO_ONE_END (tier -> name.get()) |
| 1432 |
} |
| 1433 |
|
| 1434 |
FORM (NEW1_TextGrid_extractTier, U"TextGrid: Extract tier", nullptr) { |
| 1435 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1436 |
OK |
| 1437 |
DO |
| 1438 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1439 |
Function tier = pr_TextGrid_peekTier (me, tierNumber); |
| 1440 |
autoFunction result = Data_copy (tier); |
| 1441 |
CONVERT_EACH_TO_ONE_END (tier -> name.get()) |
| 1442 |
} |
| 1443 |
|
| 1444 |
FORM (NEW_TextGrid_extractPart, U"TextGrid: Extract part", nullptr) { |
| 1445 |
REAL (fromTime, U"left Time range (s)", U"0.0") |
| 1446 |
REAL (toTime, U"right Time range (s)", U"1.0") |
| 1447 |
BOOLEAN (preserveTimes, U"Preserve times", false) |
| 1448 |
OK |
| 1449 |
DO |
| 1450 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1451 |
autoTextGrid result = TextGrid_extractPart (me, fromTime, toTime, preserveTimes); |
| 1452 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_part") |
| 1453 |
} |
| 1454 |
|
| 1455 |
FORM (NEW_TextGrid_getStartingPoints, U"TextGrid: Get starting points", nullptr) { |
| 1456 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1457 |
OPTIONMENU_ENUM (kMelder_string, getStartingPointsWhoseLabel___, |
| 1458 |
U"Get starting points whose label...", kMelder_string::DEFAULT) |
| 1459 |
SENTENCE (___theText, U"...the text", U"hi") |
| 1460 |
OK |
| 1461 |
DO |
| 1462 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1463 |
autoPointProcess result = TextGrid_getStartingPoints (me, tierNumber, getStartingPointsWhoseLabel___, ___theText); |
| 1464 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", ___theText) |
| 1465 |
} |
| 1466 |
|
| 1467 |
FORM (NEW_TextGrid_getEndPoints, U"TextGrid: Get end points", nullptr) { |
| 1468 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1469 |
OPTIONMENU_ENUM (kMelder_string, getEndPointsWhoseLabel___, |
| 1470 |
U"Get end points whose label", kMelder_string::DEFAULT) |
| 1471 |
SENTENCE (___theText, U"...the text", U"hi") |
| 1472 |
OK |
| 1473 |
DO |
| 1474 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1475 |
autoPointProcess result = TextGrid_getEndPoints (me, tierNumber, getEndPointsWhoseLabel___, ___theText); |
| 1476 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", ___theText) |
| 1477 |
} |
| 1478 |
|
| 1479 |
FORM (NEW_TextGrid_getCentrePoints, U"TextGrid: Get centre points", nullptr) { |
| 1480 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1481 |
OPTIONMENU_ENUM (kMelder_string, getCentrePointsWhoseLabel___, |
| 1482 |
U"Get centre points whose label", kMelder_string::DEFAULT) |
| 1483 |
SENTENCE (___theText, U"...the text", U"hi") |
| 1484 |
OK |
| 1485 |
DO |
| 1486 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1487 |
autoPointProcess result = TextGrid_getCentrePoints (me, tierNumber, getCentrePointsWhoseLabel___, ___theText); |
| 1488 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", ___theText) |
| 1489 |
} |
| 1490 |
|
| 1491 |
FORM (NEW_TextGrid_getPoints, U"Get points", nullptr) { |
| 1492 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1493 |
OPTIONMENU_ENUM (kMelder_string, getPointsWhoseLabel___, |
| 1494 |
U"Get points whose label...", kMelder_string::DEFAULT) |
| 1495 |
SENTENCE (___theText, U"...the text", U"hi") |
| 1496 |
OK |
| 1497 |
DO |
| 1498 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1499 |
autoPointProcess result = TextGrid_getPoints (me, tierNumber, getPointsWhoseLabel___, ___theText); |
| 1500 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", ___theText) |
| 1501 |
} |
| 1502 |
|
| 1503 |
FORM (NEW_TextGrid_getPoints_preceded, U"Get points (preceded)", nullptr) { |
| 1504 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1505 |
OPTIONMENU_ENUM (kMelder_string, getPointsWhoseLabel___, |
| 1506 |
U"Get points whose label...", kMelder_string::DEFAULT) |
| 1507 |
SENTENCE (___theText, U"...the text", U"there") |
| 1508 |
OPTIONMENU_ENUM (kMelder_string, ___precededByALabelThat___, |
| 1509 |
U"...preceded by a label that...", kMelder_string::DEFAULT) |
| 1510 |
SENTENCE (____theText, U" ...the text", U"hi") |
| 1511 |
OK |
| 1512 |
DO |
| 1513 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1514 |
autoPointProcess result = TextGrid_getPoints_preceded (me, tierNumber, |
| 1515 |
(kMelder_string) getPointsWhoseLabel___, ___theText, ___precededByALabelThat___, ____theText); |
| 1516 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", ___theText) |
| 1517 |
} |
| 1518 |
|
| 1519 |
FORM (NEW_TextGrid_getPoints_followed, U"Get points (followed)", nullptr) { |
| 1520 |
NATURAL (tierNumber, STRING_TIER_NUMBER, U"1") |
| 1521 |
OPTIONMENU_ENUM (kMelder_string, getPointsWhoseLabel___, |
| 1522 |
U"Get points whose label...", kMelder_string::DEFAULT) |
| 1523 |
SENTENCE (___theText, U"...the text", U"hi") |
| 1524 |
OPTIONMENU_ENUM (kMelder_string, ___followedByALabelThat___, |
| 1525 |
U"...followed by a label that...", kMelder_string::DEFAULT) |
| 1526 |
SENTENCE (____theText, U" ...the text", U"there") |
| 1527 |
OK |
| 1528 |
DO |
| 1529 |
CONVERT_EACH_TO_ONE (TextGrid) |
| 1530 |
autoPointProcess result = TextGrid_getPoints_followed (me, tierNumber, |
| 1531 |
(kMelder_string) getPointsWhoseLabel___, ___theText, ___followedByALabelThat___, ____theText); |
| 1532 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", ___theText) |
| 1533 |
} |
| 1534 |
|
| 1535 |
// MARK: Synthesize |
| 1536 |
|
| 1537 |
DIRECT (NEW1_TextGrids_merge_OLD) { |
| 1538 |
COMBINE_ALL_TO_ONE (TextGrid) |
| 1539 |
autoTextGrid result = TextGrids_merge (& list, false); |
| 1540 |
COMBINE_ALL_TO_ONE_END (U"merged") |
| 1541 |
} |
| 1542 |
FORM (NEW1_TextGrids_merge, U"TextGrids: Merge", U"TextGrids: Merge...") { |
| 1543 |
BOOLEAN (equalizeDomains, U"Equalize domains", 1) |
| 1544 |
OK |
| 1545 |
DO |
| 1546 |
COMBINE_ALL_TO_ONE (TextGrid) |
| 1547 |
autoTextGrid result = TextGrids_merge (& list, equalizeDomains); |
| 1548 |
COMBINE_ALL_TO_ONE_END (U"merged") |
| 1549 |
} |
| 1550 |
|
| 1551 |
DIRECT (NEW1_TextGrids_concatenate) { |
| 1552 |
COMBINE_ALL_TO_ONE (TextGrid) |
| 1553 |
autoTextGrid result = TextGrids_concatenate (& list); |
| 1554 |
COMBINE_ALL_TO_ONE_END (U"chain") |
| 1555 |
} |
| 1556 |
|
| 1557 |
// MARK: - TEXTGRID & ANYTIER |
| 1558 |
|
| 1559 |
DIRECT (NEW1_TextGrid_IntervalTier_append) { |
| 1560 |
CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, IntervalTier) |
| 1561 |
autoTextGrid result = Data_copy (me); |
| 1562 |
TextGrid_addTier_copy (result.get(), you); |
| 1563 |
CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get()) |
| 1564 |
} |
| 1565 |
|
| 1566 |
DIRECT (NEW1_TextGrid_TextTier_append) { |
| 1567 |
CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, TextTier) |
| 1568 |
autoTextGrid result = Data_copy (me); |
| 1569 |
TextGrid_addTier_copy (result.get(), you); |
| 1570 |
CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get()) |
| 1571 |
} |
| 1572 |
|
| 1573 |
// MARK: - TEXTGRID & LONGSOUND |
| 1574 |
|
| 1575 |
DIRECT (MODIFY_TextGrid_LongSound_scaleTimes) { |
| 1576 |
MODIFY_FIRST_OF_ONE_AND_ONE (TextGrid, LongSound) |
| 1577 |
Function_scaleXTo (me, your xmin, your xmax); |
| 1578 |
MODIFY_FIRST_OF_ONE_AND_ONE_END |
| 1579 |
} |
| 1580 |
|
| 1581 |
// MARK: - TEXTTIER |
| 1582 |
|
| 1583 |
FORM (MODIFY_TextTier_addPoint, U"TextTier: Add point", U"TextTier: Add point...") { |
| 1584 |
REAL (time, U"Time (s)", U"0.5") |
| 1585 |
SENTENCE (text, U"Text", U"") |
| 1586 |
OK |
| 1587 |
DO |
| 1588 |
MODIFY_EACH (TextTier) |
| 1589 |
TextTier_addPoint (me, time, text); |
| 1590 |
MODIFY_EACH_END |
| 1591 |
} |
| 1592 |
|
| 1593 |
DIRECT (NEW_TextTier_downto_PointProcess) { |
| 1594 |
CONVERT_EACH_TO_ONE (TextTier) |
| 1595 |
autoPointProcess result = AnyTier_downto_PointProcess (me->asAnyTier()); |
| 1596 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 1597 |
} |
| 1598 |
|
| 1599 |
FORM (NEW_TextTier_downto_TableOfReal, U"TextTier: Down to TableOfReal", nullptr) { |
| 1600 |
SENTENCE (label, U"Label", U"") |
| 1601 |
OK |
| 1602 |
DO |
| 1603 |
CONVERT_EACH_TO_ONE (TextTier) |
| 1604 |
autoTableOfReal result = TextTier_downto_TableOfReal (me, label); |
| 1605 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 1606 |
} |
| 1607 |
|
| 1608 |
DIRECT (NEW_TextTier_downto_TableOfReal_any) { |
| 1609 |
CONVERT_EACH_TO_ONE (TextTier) |
| 1610 |
autoTableOfReal result = TextTier_downto_TableOfReal_any (me); |
| 1611 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 1612 |
} |
| 1613 |
|
| 1614 |
FORM (STRING_TextTier_getLabelOfPoint, U"Get label of point", nullptr) { |
| 1615 |
NATURAL (pointNumber, U"Point number", U"1") |
| 1616 |
OK |
| 1617 |
DO |
| 1618 |
QUERY_ONE_FOR_STRING (TextTier) |
| 1619 |
if (pointNumber > my points.size) |
| 1620 |
Melder_throw (U"No such point."); |
| 1621 |
TextPoint point = my points.at [pointNumber]; |
| 1622 |
conststring32 result = point -> mark.get(); |
| 1623 |
QUERY_ONE_FOR_STRING_END |
| 1624 |
} |
| 1625 |
|
| 1626 |
FORM (NEW_TextTier_getPoints, U"Get points", nullptr) { |
| 1627 |
SENTENCE (text, U"Text", U"") |
| 1628 |
OK |
| 1629 |
DO |
| 1630 |
CONVERT_EACH_TO_ONE (TextTier) |
| 1631 |
autoPointProcess result = TextTier_getPoints (me, text); |
| 1632 |
CONVERT_EACH_TO_ONE_END (text) |
| 1633 |
} |
| 1634 |
|
| 1635 |
DIRECT (HELP_TextTier_help) { |
| 1636 |
HELP (U"TextTier") |
| 1637 |
} |
| 1638 |
|
| 1639 |
// MARK: - WORDLIST |
| 1640 |
|
| 1641 |
FORM (BOOLEAN_WordList_hasWord, U"Does word occur in list?", U"WordList") { |
| 1642 |
SENTENCE (word, U"Word", U"") |
| 1643 |
OK |
| 1644 |
DO |
| 1645 |
QUERY_ONE_FOR_REAL (WordList) |
| 1646 |
integer result = WordList_hasWord (me, word); |
| 1647 |
QUERY_ONE_FOR_REAL_END (result ? U" (present)" : U" (absent)") |
| 1648 |
} |
| 1649 |
|
| 1650 |
DIRECT (NEW_WordList_to_Strings) { |
| 1651 |
CONVERT_EACH_TO_ONE (WordList) |
| 1652 |
autoStrings result = WordList_to_Strings (me); |
| 1653 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 1654 |
} |
| 1655 |
|
| 1656 |
DIRECT (NEW_WordList_upto_SpellingChecker) { |
| 1657 |
CONVERT_EACH_TO_ONE (WordList) |
| 1658 |
autoSpellingChecker result = WordList_upto_SpellingChecker (me); |
| 1659 |
CONVERT_EACH_TO_ONE_END (my name.get()) |
| 1660 |
} |
| 1661 |
|
| 1662 |
// MARK: - CORPUS |
| 1663 |
|
| 1664 |
// MARK: New |
| 1665 |
|
| 1666 |
FORM (NEW1_Corpus_create, U"Create Corpus", U"Create Corpus...") { |
| 1667 |
WORD (name, U"Name", U"myCorpus") |
| 1668 |
FOLDER (folderWithSoundFiles, U"Folder with sound files", U"") |
| 1669 |
WORD (soundFileExtension, U"Sound file extension", U"wav") |
| 1670 |
FOLDER (folderWithAnnotationFiles, U"Folder with annotation files", U"") |
| 1671 |
WORD (annotationFileExtension, U"Annotation file extension", U"TextGrid") |
| 1672 |
OK |
| 1673 |
DO |
| 1674 |
CREATE_ONE |
| 1675 |
autoCorpus result = Corpus_create (folderWithSoundFiles, soundFileExtension, folderWithAnnotationFiles, annotationFileExtension); |
| 1676 |
CREATE_ONE_END (name) |
| 1677 |
} |
| 1678 |
|
| 1679 |
// MARK: Open |
| 1680 |
|
| 1681 |
FORM (READ_ONE__TextGrid_readFromEspsLabelFile, U"Read TextGrid from ESPS label file", U"Read TextGrid from ESPS label file...") { |
| 1682 |
INFILE (soundFilePath, U"Sound file path", U"") |
| 1683 |
BOOLEAN (tiersArePointTiers, U"Tiers are point tiers", false) |
| 1684 |
INTEGER (overrideNumberOfTiers, U"Override number of tiers", U"0 (= don't override)") |
| 1685 |
OK |
| 1686 |
DO |
| 1687 |
CREATE_ONE |
| 1688 |
structMelderFile file { }; |
| 1689 |
Melder_relativePathToFile (soundFilePath, & file); |
| 1690 |
autoTextGrid result = TextGrid_readFromEspsLabelFile (& file, tiersArePointTiers, overrideNumberOfTiers); |
| 1691 |
CREATE_ONE_END (U"") |
| 1692 |
} |
| 1693 |
|
| 1694 |
FORM (NEW_Sound_readWithAdjacentAnnotationFiles_buckeye, U"Read with adjacent annotations (Buckeye)", U"Read with adjacent annotation files (Buckeye)...") { |
| 1695 |
INFILE (soundFileName, U"Sound file name", U"/Volumes/Buckeye/s01/s0101a/s0101a.wav") |
| 1696 |
OK |
| 1697 |
DO |
| 1698 |
CREATE_MULTIPLE |
| 1699 |
autoTextGrid textgrid; |
| 1700 |
autoSound sound = Sound_readWithAdjacentAnnotationFiles_buckeye (soundFileName, & textgrid); |
| 1701 |
praat_new (sound.move()); |
| 1702 |
praat_new (textgrid.move()); |
| 1703 |
CREATE_MULTIPLE_END |
| 1704 |
} |
| 1705 |
|
| 1706 |
FORM (NEW_Sound_readWithAdjacentAnnotationFiles_timit, U"Read with adjacent annotations (TIMIT)", U"Read with adjacent annotation files (TIMIT)...") { |
| 1707 |
INFILE (soundFileName, U"Sound file name", U"/Volumes/TIMIT/train/dr1/fcjf0/sa1.wav") |
| 1708 |
OK |
| 1709 |
DO |
| 1710 |
CREATE_MULTIPLE |
| 1711 |
autoTextGrid textgrid; |
| 1712 |
autoSound sound = Sound_readWithAdjacentAnnotationFiles_timit (soundFileName, & textgrid); |
| 1713 |
praat_newWithFile (sound.move(), nullptr, soundFileName); |
| 1714 |
praat_newWithFile (textgrid.move(), nullptr, soundFileName); |
| 1715 |
CREATE_MULTIPLE_END |
| 1716 |
} |
| 1717 |
|
| 1718 |
FORM (NEW_Sound_readWithAdjacentAnnotationFiles_cgn, U"Read with adjacent annotations (CGN)", U"Read with adjacent annotation files (CGN)...") { |
| 1719 |
INFILE (soundFileName, U"Sound file name", U"/Volumes/CGN_2.0.3/comp-a/vl/fv400061.wav") |
| 1720 |
OK |
| 1721 |
DO |
| 1722 |
CREATE_MULTIPLE |
| 1723 |
autoSound sound; |
| 1724 |
autoTextGrid textgrid = TextGrid_Sound_readFromCorpusGesprokenNederlands (soundFileName, & sound); |
| 1725 |
praat_newWithFile (sound.move(), nullptr, soundFileName); |
| 1726 |
praat_newWithFile (textgrid.move(), nullptr, soundFileName); |
| 1727 |
CREATE_MULTIPLE_END |
| 1728 |
} |
| 1729 |
|
| 1730 |
FORM (NEW_Corpus_importFromCGN, U"Import Corpus from CGN", U"Import Corpus from CGN...") { |
| 1731 |
FOLDER (folderName, U"CGN folder name", U"/Volumes/CGN_2.0.3") |
| 1732 |
OK |
| 1733 |
DO |
| 1734 |
CREATE_ONE |
| 1735 |
autoCorpus result = Corpus_importFromCGN (folderName); |
| 1736 |
CREATE_ONE_END (U"CGN") |
| 1737 |
} |
| 1738 |
|
| 1739 |
// MARK: View & Edit |
| 1740 |
|
| 1741 |
DIRECT (EDITOR_ONE_Corpus_edit) { |
| 1742 |
EDITOR_ONE (a,Corpus) |
| 1743 |
autoCorpusEditor editor = CorpusEditor_create (Melder_cat (ID_AND_FULL_NAME, U" – overview"), me); |
| 1744 |
EDITOR_ONE_END |
| 1745 |
} |
| 1746 |
|
| 1747 |
DIRECT (EDITOR_ONE_Corpus_editSpeakers) { |
| 1748 |
EDITOR_ONE (a,Corpus) |
| 1749 |
autoTableEditor editor = TableEditor_create (Melder_cat (ID_AND_FULL_NAME, U" – speakers"), my speakers.get()); |
| 1750 |
EDITOR_ONE_END |
| 1751 |
} |
| 1752 |
|
| 1753 |
// MARK: Query |
| 1754 |
|
| 1755 |
DIRECT (QUERY_ONE_FOR_INTEGER__Corpus_getNumberOfRecordings) { |
| 1756 |
QUERY_ONE_FOR_INTEGER (Corpus) |
| 1757 |
const integer result = ( my recordings ? my recordings -> rows.size : 0 ); |
| 1758 |
QUERY_ONE_FOR_INTEGER_END (U" recordings") |
| 1759 |
} |
| 1760 |
|
| 1761 |
DIRECT (QUERY_ONE_FOR_INTEGER__Corpus_getNumberOfSpeakers) { |
| 1762 |
QUERY_ONE_FOR_INTEGER (Corpus) |
| 1763 |
const integer result = ( my speakers ? my speakers -> rows.size : 0 ); |
| 1764 |
QUERY_ONE_FOR_INTEGER_END (U" speakers") |
| 1765 |
} |
| 1766 |
|
| 1767 |
// MARK: Extract |
| 1768 |
|
| 1769 |
FORM (NEW_Corpus_extractTextGrid_number, U"Corpus: Extract TextGrid (number)", U"Corpus: Extract TextGrid (number)") { |
| 1770 |
NATURAL (recordingNumber, U"Recording number", U"1") |
| 1771 |
OK |
| 1772 |
DO |
| 1773 |
CONVERT_EACH_TO_ONE (Corpus) |
| 1774 |
autoTextGrid result = Corpus_extractTextGrid_number (me, recordingNumber); |
| 1775 |
autostring32 textgridName = Melder_dup (result -> name.get()); |
| 1776 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", textgridName.get()) |
| 1777 |
} |
| 1778 |
|
| 1779 |
FORM (NEW_Corpus_extractSound_number, U"Corpus: Extract Sound (number)", U"Corpus: Extract Sound (number)") { |
| 1780 |
NATURAL (recordingNumber, U"Recording number", U"1") |
| 1781 |
OK |
| 1782 |
DO |
| 1783 |
CONVERT_EACH_TO_ONE (Corpus) |
| 1784 |
autoSound result = Corpus_extractSound_number (me, recordingNumber); |
| 1785 |
autostring32 textgridName = Melder_dup (result -> name.get()); |
| 1786 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", textgridName.get()) |
| 1787 |
} |
| 1788 |
|
| 1789 |
DIRECT (NEW_Corpus_extractSpeakersTable) { |
| 1790 |
CONVERT_EACH_TO_ONE (Corpus) |
| 1791 |
autoTable result = Data_copy (my speakers.get()); |
| 1792 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_speakers") |
| 1793 |
} |
| 1794 |
|
| 1795 |
FORM (NEW_Corpus_extractComponents, U"Corpus: Extract components", U"Corpus: Extract components") { |
| 1796 |
BOOLEAN (comp_a, U"comp-a", true) |
| 1797 |
BOOLEAN (comp_b, U"comp-b", true) |
| 1798 |
BOOLEAN (comp_c, U"comp-c", false) |
| 1799 |
BOOLEAN (comp_d, U"comp-d", false) |
| 1800 |
BOOLEAN (comp_e, U"comp-e", false) |
| 1801 |
BOOLEAN (comp_f, U"comp-f", false) |
| 1802 |
BOOLEAN (comp_g, U"comp-g", false) |
| 1803 |
BOOLEAN (comp_h, U"comp-h", false) |
| 1804 |
BOOLEAN (comp_i, U"comp-i", false) |
| 1805 |
BOOLEAN (comp_j, U"comp-j", false) |
| 1806 |
BOOLEAN (comp_k, U"comp-k", false) |
| 1807 |
BOOLEAN (comp_l, U"comp-l", false) |
| 1808 |
BOOLEAN (comp_m, U"comp-m", false) |
| 1809 |
BOOLEAN (comp_n, U"comp-n", false) |
| 1810 |
BOOLEAN (comp_o, U"comp-o", false) |
| 1811 |
OK |
| 1812 |
DO |
| 1813 |
CONVERT_EACH_TO_ONE (Corpus) |
| 1814 |
autoCorpus result = Corpus_extractComponents (me, comp_a, comp_b, comp_c, comp_d, comp_e, comp_f, comp_g, |
| 1815 |
comp_h, comp_i, comp_j, comp_k, comp_l, comp_m, comp_n, comp_o); |
| 1816 |
autoMelderString componentList; |
| 1817 |
if (comp_a) |
| 1818 |
MelderString_appendCharacter (& componentList, U'a'); |
| 1819 |
if (comp_b) |
| 1820 |
MelderString_appendCharacter (& componentList, U'b'); |
| 1821 |
if (comp_c) |
| 1822 |
MelderString_appendCharacter (& componentList, U'c'); |
| 1823 |
if (comp_d) |
| 1824 |
MelderString_appendCharacter (& componentList, U'd'); |
| 1825 |
if (comp_e) |
| 1826 |
MelderString_appendCharacter (& componentList, U'e'); |
| 1827 |
if (comp_f) |
| 1828 |
MelderString_appendCharacter (& componentList, U'f'); |
| 1829 |
if (comp_g) |
| 1830 |
MelderString_appendCharacter (& componentList, U'g'); |
| 1831 |
if (comp_h) |
| 1832 |
MelderString_appendCharacter (& componentList, U'h'); |
| 1833 |
if (comp_i) |
| 1834 |
MelderString_appendCharacter (& componentList, U'i'); |
| 1835 |
if (comp_j) |
| 1836 |
MelderString_appendCharacter (& componentList, U'j'); |
| 1837 |
if (comp_k) |
| 1838 |
MelderString_appendCharacter (& componentList, U'k'); |
| 1839 |
if (comp_l) |
| 1840 |
MelderString_appendCharacter (& componentList, U'l'); |
| 1841 |
if (comp_m) |
| 1842 |
MelderString_appendCharacter (& componentList, U'm'); |
| 1843 |
if (comp_n) |
| 1844 |
MelderString_appendCharacter (& componentList, U'n'); |
| 1845 |
if (comp_o) |
| 1846 |
MelderString_appendCharacter (& componentList, U'o'); |
| 1847 |
CONVERT_EACH_TO_ONE_END (my name.get(), U"_", componentList.string) |
| 1848 |
} |
| 1849 |
|
| 1850 |
FORM (NEW_Corpus_extractEducationRegions, U"Corpus: Extract education regions", U"Corpus: Extract education regions") { |
| 1851 |
BOOLEAN (sHolland, Corpus_CGN_regions_short [0], false) |
| 1852 |
BOOLEAN (nHolland, Corpus_CGN_regions_short [1], false) |
| 1853 |
BOOLEAN (wUtrecht, Corpus_CGN_regions_short [2], false) |
| 1854 |
BOOLEAN (zeeland, Corpus_CGN_regions_short [3], false) |
| 1855 |
BOOLEAN (eUtrecht, Corpus_CGN_regions_short [4], false) |
| 1856 |
BOOLEAN (guelders, Corpus_CGN_regions_short [5], true) |
| 1857 |
BOOLEAN (veluwe, Corpus_CGN_regions_short [6], false) |
| 1858 |
BOOLEAN (wFriesland, Corpus_CGN_regions_short [7], false) |
| 1859 |
BOOLEAN (polders, Corpus_CGN_regions_short [8], false) |
| 1860 |
BOOLEAN (achterhoek, Corpus_CGN_regions_short [9], false) |
| 1861 |
BOOLEAN (overijssel, Corpus_CGN_regions_short [10], false) |
| 1862 |
BOOLEAN (drenthe, Corpus_CGN_regions_short [11], false) |
| 1863 |
BOOLEAN (groningen, Corpus_CGN_regions_short [12], false) |
| 1864 |
BOOLEAN (frisia, Corpus_CGN_regions_short [13], true) |
| 1865 |
BOOLEAN (nBrabant, Corpus_CGN_regions_short [14], false) |
| 1866 |
BOOLEAN (eLimburg, Corpus_CGN_regions_short [15], true) |
| 1867 |
BOOLEAN (netherlands, Corpus_CGN_regions_short [16], false) |
| 1868 |
BOOLEAN (sBrabant, Corpus_CGN_regions_short [17], false) |
| 1869 |
BOOLEAN (eFlanders, Corpus_CGN_regions_short [18], false) |
| 1870 |
BOOLEAN (wFlanders, Corpus_CGN_regions_short [19], true) |
| 1871 |
BOOLEAN (wLimburg, Corpus_CGN_regions_short [20], true) |
| 1872 |
BOOLEAN (nBelgium, Corpus_CGN_regions_short [21], false) |
| 1873 |
BOOLEAN (sBelgium, Corpus_CGN_regions_short [22], false) |
| 1874 |
BOOLEAN (reg_other, Corpus_CGN_regions_short [23], false) |
| 1875 |
BOOLEAN (reg_unknown, Corpus_CGN_regions_short [24], false) |
| 1876 |
OK |
| 1877 |
DO |
| 1878 |
CONVERT_EACH_TO_ONE (Corpus) |
| 1879 |
autoCorpus result = Corpus_extractEducationRegions (me, |
| 1880 |
sHolland, nHolland, wUtrecht, zeeland, eUtrecht, |
| 1881 |
guelders, veluwe, wFriesland, polders, achterhoek, |
| 1882 |
overijssel, drenthe, groningen, frisia, nBrabant, |
| 1883 |
eLimburg, netherlands, sBrabant, eFlanders, wFlanders, |
| 1884 |
wLimburg, nBelgium, sBelgium, reg_other, reg_unknown |
| 1885 |
); |
| 1886 |
autoMelderString regionList; |
| 1887 |
if (sHolland) |
| 1888 |
MelderString_append (& regionList, U"_SH"); |
| 1889 |
if (nHolland) |
| 1890 |
MelderString_append (& regionList, U"_NH"); |
| 1891 |
if (wUtrecht) |
| 1892 |
MelderString_append (& regionList, U"_WU"); |
| 1893 |
if (zeeland) |
| 1894 |
MelderString_append (& regionList, U"_Ze"); |
| 1895 |
if (eUtrecht) |
| 1896 |
MelderString_append (& regionList, U"_EU"); |
| 1897 |
if (guelders) |
| 1898 |
MelderString_append (& regionList, U"_Ge"); |
| 1899 |
if (veluwe) |
| 1900 |
MelderString_append (& regionList, U"_Ve"); |
| 1901 |
if (wFriesland) |
| 1902 |
MelderString_append (& regionList, U"_WF"); |
| 1903 |
if (polders) |
| 1904 |
MelderString_append (& regionList, U"_Po"); |
| 1905 |
if (achterhoek) |
| 1906 |
MelderString_append (& regionList, U"_Ac"); |
| 1907 |
if (overijssel) |
| 1908 |
MelderString_append (& regionList, U"_Ov"); |
| 1909 |
if (drenthe) |
| 1910 |
MelderString_append (& regionList, U"_Dr"); |
| 1911 |
if (groningen) |
| 1912 |
MelderString_append (& regionList, U"_Gr"); |
| 1913 |
if (frisia) |
| 1914 |
MelderString_append (& regionList, U"_Fr"); |
| 1915 |
if (nBrabant) |
| 1916 |
MelderString_append (& regionList, U"_NB"); |
| 1917 |
if (eLimburg) |
| 1918 |
MelderString_append (& regionList, U"_EL"); |
| 1919 |
if (netherlands) |
| 1920 |
MelderString_append (& regionList, U"_Nl"); |
| 1921 |
if (sBrabant) |
| 1922 |
MelderString_append (& regionList, U"_SB"); |
| 1923 |
if (eFlanders) |
| 1924 |
MelderString_append (& regionList, U"_EV"); |
| 1925 |
if (wFlanders) |
| 1926 |
MelderString_append (& regionList, U"_WV"); |
| 1927 |
if (wLimburg) |
| 1928 |
MelderString_append (& regionList, U"_WL"); |
| 1929 |
if (nBelgium) |
| 1930 |
MelderString_append (& regionList, U"_No"); |
| 1931 |
if (sBelgium) |
| 1932 |
MelderString_append (& regionList, U"_So"); |
| 1933 |
if (reg_other) |
| 1934 |
MelderString_append (& regionList, U"_ot"); |
| 1935 |
if (reg_unknown) |
| 1936 |
MelderString_append (& regionList, U"_un"); |
| 1937 |
CONVERT_EACH_TO_ONE_END (my name.get(), regionList.string) |
| 1938 |
} |
| 1939 |
|
| 1940 |
|
| 1941 |
/***** buttons *****/ |
| 1942 |
|
| 1943 |
void praat_uvafon_TextGrid_init () { |
| 1944 |
Thing_recognizeClassesByName (classTextPoint, classTextInterval, classTextTier, |
| 1945 |
classIntervalTier, classTextGrid, classWordList, classSpellingChecker, |
| 1946 |
classCorpus); |
| 1947 |
Thing_recognizeClassByOtherName (classTextTier, U"MarkTier"); |
| 1948 |
|
| 1949 |
structTextGridArea :: f_preferences (); |
| 1950 |
|
| 1951 |
structTextGridEditor :: f_preferences (); |
| 1952 |
|
| 1953 |
praat_addMenuCommand (U"Objects", U"New", U"-- new textgrid --", |
| 1954 |
nullptr, 0, nullptr); |
| 1955 |
praat_addMenuCommand (U"Objects", U"New", U"Create TextGrid...", |
| 1956 |
nullptr, 0, NEW1_TextGrid_create); |
| 1957 |
praat_addMenuCommand (U"Objects", U"New", U"Create Corpus...", |
| 1958 |
nullptr, 0, NEW1_Corpus_create); |
| 1959 |
|
| 1960 |
praat_addMenuCommand (U"Objects", U"Open", U"-- open textgrid --", nullptr, 0, nullptr); |
| 1961 |
praat_addMenuCommand (U"Objects", U"Open", U"Read from special annotation file...", nullptr, 0, nullptr); |
| 1962 |
praat_addMenuCommand (U"Objects", U"Open", U"Read TextGrid from Xwaves... || Read TextGrid from ESPS label file...", |
| 1963 |
nullptr, 1, READ_ONE__TextGrid_readFromEspsLabelFile); |
| 1964 |
praat_addMenuCommand (U"Objects", U"Open", U"Read Sound with adjacent annotation files...", nullptr, 0, nullptr); |
| 1965 |
praat_addMenuCommand (U"Objects", U"Open", U"Read Sound with adjacent annotation files (Buckeye)...", |
| 1966 |
nullptr, 1, NEW_Sound_readWithAdjacentAnnotationFiles_buckeye); |
| 1967 |
praat_addMenuCommand (U"Objects", U"Open", U"Read Sound with adjacent annotation files (TIMIT)...", |
| 1968 |
nullptr, 1, NEW_Sound_readWithAdjacentAnnotationFiles_timit); |
| 1969 |
praat_addMenuCommand (U"Objects", U"Open", U"Read Sound with adjacent annotation files (Corpus Gesproken Nederlands)...", |
| 1970 |
nullptr, 1, NEW_Sound_readWithAdjacentAnnotationFiles_cgn); |
| 1971 |
praat_addMenuCommand (U"Objects", U"Open", U"Import Corpus...", nullptr, 0, nullptr); |
| 1972 |
praat_addMenuCommand (U"Objects", U"Open", U"Import Corpus from CGN...", |
| 1973 |
nullptr, 1, NEW_Corpus_importFromCGN); |
| 1974 |
|
| 1975 |
praat_addAction1 (classCorpus, 1, U"View & Edit", nullptr, GuiMenu_ATTRACTIVE, EDITOR_ONE_Corpus_edit); |
| 1976 |
praat_addAction1 (classCorpus, 1, U"View & Edit speakers", nullptr, 0, EDITOR_ONE_Corpus_editSpeakers); |
| 1977 |
praat_addAction1 (classCorpus, 0, U"Query -", nullptr, 0, nullptr); |
| 1978 |
praat_addAction1 (classCorpus, 1, U"Get number of recordings", |
| 1979 |
nullptr, 1, QUERY_ONE_FOR_INTEGER__Corpus_getNumberOfRecordings); |
| 1980 |
praat_addAction1 (classCorpus, 1, U"Get number of speakers", |
| 1981 |
nullptr, 1, QUERY_ONE_FOR_INTEGER__Corpus_getNumberOfSpeakers); |
| 1982 |
praat_addAction1 (classCorpus, 0, U"Extract -", nullptr, 0, nullptr); |
| 1983 |
praat_addAction1 (classCorpus, 1, U"Extract TextGrid (number)...", |
| 1984 |
nullptr, 1, NEW_Corpus_extractTextGrid_number); |
| 1985 |
praat_addAction1 (classCorpus, 1, U"Extract Sound (number)...", |
| 1986 |
nullptr, 1, NEW_Corpus_extractSound_number); |
| 1987 |
praat_addAction1 (classCorpus, 1, U"Extract speakers Table", |
| 1988 |
nullptr, 1, NEW_Corpus_extractSpeakersTable); |
| 1989 |
praat_addAction1 (classCorpus, 1, U"-- create subcorpus --", nullptr, 1, nullptr); |
| 1990 |
praat_addAction1 (classCorpus, 1, U"Extract components...", |
| 1991 |
nullptr, 1, NEW_Corpus_extractComponents); |
| 1992 |
praat_addAction1 (classCorpus, 1, U"Extract education regions...", |
| 1993 |
nullptr, 1, NEW_Corpus_extractEducationRegions); |
| 1994 |
|
| 1995 |
praat_addAction1 (classIntervalTier, 1, U"Save as Xwaves label file... || Write to Xwaves label file...", nullptr, 0, SAVE_IntervalTier_writeToXwaves); |
| 1996 |
// alternative COMPATIBILITY <= 2011 |
| 1997 |
praat_addAction1 (classIntervalTier, 0, U"IntervalTier help", nullptr, 0, HELP_IntervalTier_help); |
| 1998 |
praat_addAction1 (classIntervalTier, 0, U"Collect", nullptr, 0, nullptr); |
| 1999 |
praat_addAction1 (classIntervalTier, 0, U"Into TextGrid", nullptr, 0, NEW1_AnyTier_into_TextGrid); |
| 2000 |
praat_addAction1 (classIntervalTier, 0, U"Analyse", nullptr, 0, nullptr); |
| 2001 |
praat_addAction1 (classIntervalTier, 0, U"Get starting points...", nullptr, 0, NEW_IntervalTier_getStartingPoints); |
| 2002 |
praat_addAction1 (classIntervalTier, 0, U"Get centre points...", nullptr, 0, NEW_IntervalTier_getCentrePoints); |
| 2003 |
praat_addAction1 (classIntervalTier, 0, U"Get end points...", nullptr, 0, NEW_IntervalTier_getEndPoints); |
| 2004 |
praat_addAction1 (classIntervalTier, 0, U"Convert", nullptr, 0, nullptr); |
| 2005 |
praat_addAction1 (classIntervalTier, 0, U"Down to TableOfReal (any)", nullptr, 0, NEW_IntervalTier_downto_TableOfReal_any); |
| 2006 |
praat_addAction1 (classIntervalTier, 0, U"Down to TableOfReal...", nullptr, 0, NEW_IntervalTier_downto_TableOfReal); |
| 2007 |
|
| 2008 |
praat_addAction1 (classLabel, 0, U"& Sound: To TextGrid?", nullptr, 0, HINT_Label_Sound_to_TextGrid); |
| 2009 |
|
| 2010 |
praat_addAction1 (classSpellingChecker, 1, U"View & Edit... || Edit...", nullptr, GuiMenu_ATTRACTIVE, WINDOW_SpellingChecker_viewAndEdit); |
| 2011 |
// alternative COMPATIBILITY <= 2011 |
| 2012 |
praat_addAction1 (classSpellingChecker, 0, U"Query", nullptr, 0, nullptr); |
| 2013 |
praat_addAction1 (classSpellingChecker, 1, U"Is word allowed...", nullptr, 0, BOOLEAN_SpellingChecker_isWordAllowed); |
| 2014 |
praat_addAction1 (classSpellingChecker, 1, U"Next not allowed word...", nullptr, 0, STRING_SpellingChecker_nextNotAllowedWord); |
| 2015 |
praat_addAction1 (classSpellingChecker, 0, U"Modify", nullptr, 0, nullptr); |
| 2016 |
praat_addAction1 (classSpellingChecker, 0, U"Add new word...", nullptr, 0, MODIFY_SpellingChecker_addNewWord); |
| 2017 |
praat_addAction1 (classSpellingChecker, 0, U"Analyze", nullptr, 0, nullptr); |
| 2018 |
praat_addAction1 (classSpellingChecker, 0, U"Extract WordList", nullptr, 0, NEW_SpellingChecker_extractWordList); |
| 2019 |
praat_addAction1 (classSpellingChecker, 0, U"Extract user dictionary", nullptr, 0, NEW_SpellingChecker_extractUserDictionary); |
| 2020 |
|
| 2021 |
praat_addAction1 (classTextGrid, 1, U"Save as chronological text file...", nullptr, 0, SAVE_TextGrid_writeToChronologicalTextFile); |
| 2022 |
praat_addAction1 (classTextGrid, 1, U"Write to chronological text file...", nullptr, GuiMenu_HIDDEN, SAVE_TextGrid_writeToChronologicalTextFile); |
| 2023 |
praat_addAction1 (classTextGrid, 0, U"TextGrid help", nullptr, 0, HELP_TextGrid_help); |
| 2024 |
praat_addAction1 (classTextGrid, 1, U"View & Edit alone || View & Edit || Edit", nullptr, 0, EDITOR_ONE_WITH_ONE_TextGrid_viewAndEdit); |
| 2025 |
// alternative COMPATIBILITY <= 2011 |
| 2026 |
praat_addAction1 (classTextGrid, 1, U"View & Edit with Sound?", nullptr, GuiMenu_ATTRACTIVE | GuiMenu_NO_API, HINT_TextGrid_Sound_viewAndEdit); |
| 2027 |
praat_addAction1 (classTextGrid, 0, U"Draw -", nullptr, 0, nullptr); |
| 2028 |
praat_addAction1 (classTextGrid, 0, U"Draw...", nullptr, 1, GRAPHICS_TextGrid_draw); |
| 2029 |
praat_addAction1 (classTextGrid, 1, U"Draw with Sound?", nullptr, 1, HINT_TextGrid_Sound_draw); |
| 2030 |
praat_addAction1 (classTextGrid, 1, U"Draw with Pitch?", nullptr, 1, HINT_TextGrid_Pitch_draw); |
| 2031 |
praat_addAction1 (classTextGrid, 1, U"Tabulate -", nullptr, 0, nullptr); |
| 2032 |
praat_addAction1 (classTextGrid, 0, U"Down to Table...", nullptr, 1, NEW_TextGrid_downto_Table); |
| 2033 |
praat_addAction1 (classTextGrid, 1, U"List...", nullptr, 1, LIST_TextGrid_list); |
| 2034 |
praat_addAction1 (classTextGrid, 0, U"Tabulate occurrences...", nullptr, 1, NEW_TextGrid_tabulateOccurrences); |
| 2035 |
praat_addAction1 (classTextGrid, 0, U"Query -", nullptr, 0, nullptr); |
| 2036 |
praat_TimeFunction_query_init (classTextGrid); |
| 2037 |
praat_addAction1 (classTextGrid, 1, U"-- query textgrid --", nullptr, 1, nullptr); |
| 2038 |
praat_addAction1 (classTextGrid, 1, U"Get number of tiers", nullptr, 1, INTEGER_TextGrid_getNumberOfTiers); |
| 2039 |
praat_addAction1 (classTextGrid, 1, U"Get tier name...", nullptr, 1, STRING_TextGrid_getTierName); |
| 2040 |
praat_addAction1 (classTextGrid, 1, U"Is interval tier...", nullptr, 1, BOOLEAN_TextGrid_isIntervalTier); |
| 2041 |
praat_addAction1 (classTextGrid, 1, U"-- query tier --", nullptr, 1, nullptr); |
| 2042 |
praat_addAction1 (classTextGrid, 1, U"Query interval tier", nullptr, 1, nullptr); |
| 2043 |
praat_addAction1 (classTextGrid, 1, U"Get number of intervals...", nullptr, GuiMenu_DEPTH_2, INTEGER_TextGrid_getNumberOfIntervals); |
| 2044 |
praat_addAction1 (classTextGrid, 1, U"Get start time of interval... || Get starting point... || Get start point...", nullptr, GuiMenu_DEPTH_2, |
| 2045 |
REAL_TextGrid_getStartTimeOfInterval); // alternatives COMPATIBLITY < 2016 |
| 2046 |
praat_addAction1 (classTextGrid, 1, U"Get end time of interval... || Get end point...", nullptr, GuiMenu_DEPTH_2, |
| 2047 |
REAL_TextGrid_getEndTimeOfInterval); // alternatives COMPATIBLITY < 2016 |
| 2048 |
praat_addAction1 (classTextGrid, 1, U"Get label of interval...", nullptr, GuiMenu_DEPTH_2, STRING_TextGrid_getLabelOfInterval); |
| 2049 |
praat_addAction1 (classTextGrid, 1, U"-- query interval from time --", nullptr, GuiMenu_DEPTH_2, nullptr); |
| 2050 |
praat_addAction1 (classTextGrid, 1, U"Get interval at time...", nullptr, 2, INTEGER_TextGrid_getIntervalAtTime); |
| 2051 |
praat_addAction1 (classTextGrid, 1, U"Get low interval at time...", nullptr, 2, INTEGER_TextGrid_getLowIntervalAtTime); |
| 2052 |
praat_addAction1 (classTextGrid, 1, U"Get high interval at time...", nullptr, 2, INTEGER_TextGrid_getHighIntervalAtTime); |
| 2053 |
praat_addAction1 (classTextGrid, 1, U"Get interval edge from time...", nullptr, 2, INTEGER_TextGrid_getIntervalEdgeFromTime); |
| 2054 |
praat_addAction1 (classTextGrid, 1, U"Get interval boundary from time...", nullptr, 2, INTEGER_TextGrid_getIntervalBoundaryFromTime); |
| 2055 |
praat_addAction1 (classTextGrid, 1, U"-- query interval labels --", nullptr, 2, nullptr); |
| 2056 |
praat_addAction1 (classTextGrid, 1, U"Count intervals where...", nullptr, 2, INTEGER_TextGrid_countIntervalsWhere); |
| 2057 |
praat_addAction1 (classTextGrid, 1, U"Query point tier", nullptr, 1, nullptr); |
| 2058 |
praat_addAction1 (classTextGrid, 1, U"Get number of points...", nullptr, 2, INTEGER_TextGrid_getNumberOfPoints); |
| 2059 |
praat_addAction1 (classTextGrid, 1, U"Get time of point...", nullptr, 2, REAL_TextGrid_getTimeOfPoint); |
| 2060 |
praat_addAction1 (classTextGrid, 1, U"Get label of point...", nullptr, 2, STRING_TextGrid_getLabelOfPoint); |
| 2061 |
praat_addAction1 (classTextGrid, 1, U"-- query point from time --", nullptr, 2, nullptr); |
| 2062 |
praat_addAction1 (classTextGrid, 1, U"Get low index from time...", nullptr, 2, INTEGER_TextGrid_getLowIndexFromTime); |
| 2063 |
praat_addAction1 (classTextGrid, 1, U"Get high index from time...", nullptr, 2, INTEGER_TextGrid_getHighIndexFromTime); |
| 2064 |
praat_addAction1 (classTextGrid, 1, U"Get nearest index from time...", nullptr, 2, INTEGER_TextGrid_getNearestIndexFromTime); |
| 2065 |
praat_addAction1 (classTextGrid, 1, U"-- query point labels --", nullptr, 2, nullptr); |
| 2066 |
praat_addAction1 (classTextGrid, 1, U"Count points where...", nullptr, 2, INTEGER_TextGrid_countPointsWhere); |
| 2067 |
praat_addAction1 (classTextGrid, 1, U"-- query labels --", nullptr, GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2015, nullptr); |
| 2068 |
praat_addAction1 (classTextGrid, 1, U"Count labels...", nullptr, GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2015, INTEGER_TextGrid_countLabels); |
| 2069 |
// replace with Count intervals where... or Count points where... |
| 2070 |
praat_addAction1 (classTextGrid, 0, U"Modify -", nullptr, 0, nullptr); |
| 2071 |
praat_addAction1 (classTextGrid, 0, U"Convert to backslash trigraphs", nullptr, 1, MODIFY_TextGrid_convertToBackslashTrigraphs); |
| 2072 |
praat_addAction1 (classTextGrid, 0, U"Convert to Unicode", nullptr, 1, MODIFY_TextGrid_convertToUnicode); |
| 2073 |
praat_TimeFunction_modify_init (classTextGrid); |
| 2074 |
praat_addAction1 (classTextGrid, 0, U"-- modify tiers --", nullptr, 1, nullptr); |
| 2075 |
praat_addAction1 (classTextGrid, 0, U"Insert interval tier...", nullptr, 1, MODIFY_TextGrid_insertIntervalTier); |
| 2076 |
praat_addAction1 (classTextGrid, 0, U"Insert point tier...", nullptr, 1, MODIFY_TextGrid_insertPointTier); |
| 2077 |
praat_addAction1 (classTextGrid, 0, U"Duplicate tier...", nullptr, 1, MODIFY_TextGrid_duplicateTier); |
| 2078 |
praat_addAction1 (classTextGrid, 0, U"Remove tier...", nullptr, 1, MODIFY_TextGrid_removeTier); |
| 2079 |
praat_addAction1 (classTextGrid, 1, U"-- modify tier --", nullptr, 1, nullptr); |
| 2080 |
praat_addAction1 (classTextGrid, 0, U"Modify interval tier", nullptr, 1, nullptr); |
| 2081 |
praat_addAction1 (classTextGrid, 0, U"Insert boundary...", nullptr, 2, MODIFY_TextGrid_insertBoundary); |
| 2082 |
praat_addAction1 (classTextGrid, 0, U"Remove left boundary...", nullptr, 2, MODIFY_TextGrid_removeLeftBoundary); |
| 2083 |
praat_addAction1 (classTextGrid, 0, U"Remove right boundary...", nullptr, 2, MODIFY_TextGrid_removeRightBoundary); |
| 2084 |
praat_addAction1 (classTextGrid, 0, U"Remove boundary at time...", nullptr, 2, MODIFY_TextGrid_removeBoundaryAtTime); |
| 2085 |
praat_addAction1 (classTextGrid, 0, U"Set interval text...", nullptr, 2, MODIFY_TextGrid_setIntervalText); |
| 2086 |
praat_addAction1 (classTextGrid, 0, U"Modify point tier", nullptr, 1, nullptr); |
| 2087 |
praat_addAction1 (classTextGrid, 0, U"Insert point...", nullptr, 2, MODIFY_TextGrid_insertPoint); |
| 2088 |
praat_addAction1 (classTextGrid, 0, U"Remove point...", nullptr, 2, MODIFY_TextGrid_removePoint); |
| 2089 |
praat_addAction1 (classTextGrid, 0, U"Remove points...", nullptr, 2, MODIFY_TextGrid_removePoints); |
| 2090 |
praat_addAction1 (classTextGrid, 0, U"Set point text...", nullptr, 2, MODIFY_TextGrid_setPointText); |
| 2091 |
praat_addAction1 (classTextGrid, 0, U"Analyse", nullptr, 0, nullptr); |
| 2092 |
praat_addAction1 (classTextGrid, 0, U"Extract one tier...", nullptr, 0, NEW1_TextGrid_extractOneTier); |
| 2093 |
praat_addAction1 (classTextGrid, 0, U"Extract tier...", nullptr, GuiMenu_DEPRECATED_2010, |
| 2094 |
NEW1_TextGrid_extractTier); // replace imprecisely with Extract one tier... |
| 2095 |
praat_addAction1 (classTextGrid, 0, U"Extract part...", nullptr, 0, NEW_TextGrid_extractPart); |
| 2096 |
praat_addAction1 (classTextGrid, 0, U"Analyse interval tier -", nullptr, 0, nullptr); |
| 2097 |
praat_addAction1 (classTextGrid, 0, U"Get starting points...", nullptr, 1, NEW_TextGrid_getStartingPoints); |
| 2098 |
praat_addAction1 (classTextGrid, 0, U"Get end points...", nullptr, 1, NEW_TextGrid_getEndPoints); |
| 2099 |
praat_addAction1 (classTextGrid, 0, U"Get centre points...", nullptr, 1, NEW_TextGrid_getCentrePoints); |
| 2100 |
praat_addAction1 (classTextGrid, 0, U"Analyse point tier -", nullptr, 0, nullptr); |
| 2101 |
praat_addAction1 (classTextGrid, 0, U"Get points...", nullptr, 1, NEW_TextGrid_getPoints); |
| 2102 |
praat_addAction1 (classTextGrid, 0, U"Get points (preceded)...", nullptr, 1, NEW_TextGrid_getPoints_preceded); |
| 2103 |
praat_addAction1 (classTextGrid, 0, U"Get points (followed)...", nullptr, 1, NEW_TextGrid_getPoints_followed); |
| 2104 |
praat_addAction1 (classTextGrid, 0, U"Synthesize", nullptr, 0, nullptr); |
| 2105 |
praat_addAction1 (classTextGrid, 0, U"Merge", nullptr, GuiMenu_DEPRECATED_2025, NEW1_TextGrids_merge_OLD); |
| 2106 |
praat_addAction1 (classTextGrid, 0, U"Merge...", nullptr, 0, NEW1_TextGrids_merge); |
| 2107 |
praat_addAction1 (classTextGrid, 0, U"Concatenate", nullptr, 0, NEW1_TextGrids_concatenate); |
| 2108 |
|
| 2109 |
praat_addAction1 (classTextTier, 0, U"TextTier help", nullptr, 0, HELP_TextTier_help); |
| 2110 |
praat_addAction1 (classTextTier, 0, U"Query -", nullptr, 0, nullptr); |
| 2111 |
praat_TimeTier_query_init (classTextTier); |
| 2112 |
praat_addAction1 (classTextTier, 0, U"Get label of point...", nullptr, 1, STRING_TextTier_getLabelOfPoint); |
| 2113 |
praat_addAction1 (classTextTier, 0, U"Modify -", nullptr, 0, nullptr); |
| 2114 |
praat_TimeTier_modify_init (classTextTier); |
| 2115 |
praat_addAction1 (classTextTier, 0, U"Add point...", nullptr, 1, MODIFY_TextTier_addPoint); |
| 2116 |
praat_addAction1 (classTextTier, 0, U"Analyse", nullptr, 0, nullptr); |
| 2117 |
praat_addAction1 (classTextTier, 0, U"Get points...", nullptr, 0, NEW_TextTier_getPoints); |
| 2118 |
praat_addAction1 (classTextTier, 0, U"Collect", nullptr, 0, nullptr); |
| 2119 |
praat_addAction1 (classTextTier, 0, U"Into TextGrid", nullptr, 0, NEW1_AnyTier_into_TextGrid); |
| 2120 |
praat_addAction1 (classTextTier, 0, U"Convert", nullptr, 0, nullptr); |
| 2121 |
praat_addAction1 (classTextTier, 0, U"Down to PointProcess", nullptr, 0, NEW_TextTier_downto_PointProcess); |
| 2122 |
praat_addAction1 (classTextTier, 0, U"Down to TableOfReal (any)", nullptr, 0, NEW_TextTier_downto_TableOfReal_any); |
| 2123 |
praat_addAction1 (classTextTier, 0, U"Down to TableOfReal...", nullptr, 0, NEW_TextTier_downto_TableOfReal); |
| 2124 |
|
| 2125 |
praat_addAction1 (classWordList, 0, U"Query", nullptr, 0, nullptr); |
| 2126 |
praat_addAction1 (classWordList, 1, U"Has word...", nullptr, 0, BOOLEAN_WordList_hasWord); |
| 2127 |
praat_addAction1 (classWordList, 0, U"Analyze", nullptr, 0, nullptr); |
| 2128 |
praat_addAction1 (classWordList, 0, U"To Strings", nullptr, 0, NEW_WordList_to_Strings); |
| 2129 |
praat_addAction1 (classWordList, 0, U"Synthesize", nullptr, 0, nullptr); |
| 2130 |
praat_addAction1 (classWordList, 0, U"Up to SpellingChecker", nullptr, 0, NEW_WordList_upto_SpellingChecker); |
| 2131 |
|
| 2132 |
praat_addAction2 (classIntervalTier, 1, classPointProcess, 1, U"Start to centre...", nullptr, 0, NEW1_IntervalTier_PointProcess_startToCentre); |
| 2133 |
praat_addAction2 (classIntervalTier, 1, classPointProcess, 1, U"End to centre...", nullptr, 0, NEW1_IntervalTier_PointProcess_endToCentre); |
| 2134 |
praat_addAction2 (classIntervalTier, 0, classTextTier, 0, U"Collect", nullptr, 0, nullptr); |
| 2135 |
praat_addAction2 (classIntervalTier, 0, classTextTier, 0, U"Into TextGrid", nullptr, 0, NEW1_AnyTier_into_TextGrid); |
| 2136 |
praat_addAction2 (classLabel, 1, classSound, 1, U"To TextGrid", nullptr, 0, NEW1_Label_Sound_to_TextGrid); |
| 2137 |
praat_addAction2 (classLongSound, 1, classTextGrid, 1, U"View & Edit || Edit", nullptr, GuiMenu_ATTRACTIVE, |
| 2138 |
WINDOW_TextGrid_LongSound_viewAndEdit); // alternative COMPATIBILITY <= 2011 |
| 2139 |
praat_addAction2 (classLongSound, 1, classTextGrid, 1, U"Scale times", nullptr, 0, MODIFY_TextGrid_LongSound_scaleTimes); |
| 2140 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw -", nullptr, 0, nullptr); |
| 2141 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw...", nullptr, 1, GRAPHICS_TextGrid_Pitch_draw); |
| 2142 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw logarithmic...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawLogarithmic); |
| 2143 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw semitones...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawSemitones); |
| 2144 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw mel...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawMel); |
| 2145 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw erb...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawErb); |
| 2146 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckle); |
| 2147 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle logarithmic...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleLogarithmic); |
| 2148 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle semitones...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleSemitones); |
| 2149 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle mel...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleMel); |
| 2150 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle erb...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleErb); |
| 2151 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"-- draw separately --", nullptr, 1, nullptr); |
| 2152 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw separately...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawSeparately); |
| 2153 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw separately (logarithmic)...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawSeparatelyLogarithmic); |
| 2154 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw separately (semitones)...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawSeparatelySemitones); |
| 2155 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw separately (mel)...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawSeparatelyMel); |
| 2156 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Draw separately (erb)...", nullptr, 1, GRAPHICS_TextGrid_Pitch_drawSeparatelyErb); |
| 2157 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle separately...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleSeparately); |
| 2158 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle separately (logarithmic)...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleSeparatelyLogarithmic); |
| 2159 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle separately (semitones)...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleSeparatelySemitones); |
| 2160 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle separately (mel)...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleSeparatelyMel); |
| 2161 |
praat_addAction2 (classPitch, 1, classTextGrid, 1, U"Speckle separately (erb)...", nullptr, 1, GRAPHICS_TextGrid_Pitch_speckleSeparatelyErb); |
| 2162 |
praat_addAction2 (classPitch, 1, classTextTier, 1, U"To PitchTier...", nullptr, 0, NEW1_Pitch_TextTier_to_PitchTier); |
| 2163 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"View & Edit || Edit", nullptr, GuiMenu_ATTRACTIVE, |
| 2164 |
EDITOR_ONE_WITH_ONE_TextGrid_viewAndEdit); // alternative COMPATIBILITY <= 2011 |
| 2165 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"View & Edit with callback...", nullptr, GuiMenu_HIDDEN, EDITOR_ONE_WITH_ONE_TextGrid_viewAndEditWithCallback); |
| 2166 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Draw...", nullptr, 0, GRAPHICS_TextGrid_Sound_draw); |
| 2167 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Extract -", nullptr, 0, nullptr); |
| 2168 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Extract all intervals...", nullptr, GuiMenu_DEPTH_1, NEW1_TextGrid_Sound_extractAllIntervals); |
| 2169 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Extract non-empty intervals...", nullptr, GuiMenu_DEPTH_1, NEW1_TextGrid_Sound_extractNonemptyIntervals); |
| 2170 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Extract intervals where...", nullptr, GuiMenu_DEPTH_1, |
| 2171 |
NEW1_TextGrid_Sound_extractIntervalsWhere); |
| 2172 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Extract intervals...", nullptr, GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2005, |
| 2173 |
NEW1_TextGrid_Sound_extractIntervals); // replace with Extract intervals where: arg1, arg2, "is equal to", arg3 |
| 2174 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Modify TextGrid", nullptr, 0, nullptr); |
| 2175 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Align interval...", nullptr, 0, MODIFY_TextGrid_Sound_alignInterval); |
| 2176 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Scale times", nullptr, 0, MODIFY_TextGrid_Sound_scaleTimes); |
| 2177 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Transcribe interval...", nullptr, 0, MODIFY_TextGrid_Sound_transcribeInterval); |
| 2178 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Diarize interval...", nullptr, 0, MODIFY_TextGrid_Sound_diarizeInterval); |
| 2179 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Modify Sound", nullptr, 0, nullptr); |
| 2180 |
praat_addAction2 (classSound, 1, classTextGrid, 1, U"Clone time domain", nullptr, 0, MODIFY_TextGrid_Sound_cloneTimeDomain); |
| 2181 |
praat_addAction2 (classSpellingChecker, 1, classWordList, 1, U"Replace WordList", nullptr, 0, MODIFY_SpellingChecker_replaceWordList); |
| 2182 |
praat_addAction2 (classSpellingChecker, 1, classStringSet, 1, U"Replace user dictionary", nullptr, 0, MODIFY_SpellingChecker_replaceUserDictionary); |
| 2183 |
praat_addAction2 (classSpellingChecker, 1, classStrings, 1, U"Replace word list?", nullptr, 0, HINT_SpellingChecker_replaceWordList_help); |
| 2184 |
praat_addAction2 (classSpellingChecker, 1, classTextGrid, 1, U"View & Edit || Edit", nullptr, GuiMenu_ATTRACTIVE, |
| 2185 |
WINDOW_TextGrid_SpellingChecker_viewAndEdit); // alternative COMPATIBILITY <= 2011 |
| 2186 |
praat_addAction2 (classTextGrid, 1, classIntervalTier, 1, U"Append", nullptr, 0, NEW1_TextGrid_IntervalTier_append); |
| 2187 |
praat_addAction2 (classTextGrid, 1, classTextTier, 1, U"Append", nullptr, 0, NEW1_TextGrid_TextTier_append); |
| 2188 |
|
| 2189 |
praat_addAction3 (classLongSound, 1, classSpellingChecker, 1, classTextGrid, 1, U"View & Edit || Edit", nullptr, GuiMenu_ATTRACTIVE, |
| 2190 |
WINDOW_TextGrid_LongSound_SpellingChecker_viewAndEdit); // alternative COMPATIBILITY <= 2011 |
| 2191 |
praat_addAction3 (classSound, 1, classSpellingChecker, 1, classTextGrid, 1, U"View & Edit || Edit", nullptr, GuiMenu_ATTRACTIVE, |
| 2192 |
WINDOW_TextGrid_SpellingChecker_viewAndEdit); // alternative COMPATIBILITY <= 2011 |
| 2193 |
} |
| 2194 |
|
| 2195 |
/* End of file praat_TextGrid_init.cpp */ |