1 /* manual_annotation.cpp
2  *
3  * Copyright (C) 1992-2011,2014-2017 Paul Boersma
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 2 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 "ManPagesM.h"
20 
21 void manual_annotation_init (ManPages me);
manual_annotation_init(ManPages me)22 void manual_annotation_init (ManPages me) {
23 
24 MAN_BEGIN (U"Create TextGrid...", U"ppgb", 20101228)
25 INTRO (U"A command to create a @TextGrid from scratch.")
26 ENTRY (U"Settings")
27 TAG (U"##Start time (s)")
28 DEFINITION (U"the start time, usually 0 seconds.")
29 TAG (U"##End time (s)")
30 DEFINITION (U"the end time in seconds, usually the duration.")
31 TAG (U"##Tier names")
32 DEFINITION (U"a list of the names of the tiers that you want to create, separated by spaces.")
33 TAG (U"##Point tiers")
34 DEFINITION (U"a list of the names of the tiers that you want to be %%point tiers%; "
35 	"the rest of the tiers will be %%interval tiers%.")
36 MAN_END
37 
38 MAN_BEGIN (U"PointProcess: To TextGrid...", U"ppgb", 19980113)
39 INTRO (U"A command to create an empty @TextGrid from every selected @PointProcess.")
40 NORMAL (U"The only information in the PointProcess that is used, is its starting and finishing times.")
41 ENTRY (U"Settings")
42 TAG (U"##Tier names")
43 DEFINITION (U"a list of the names of the tiers that you want to create, separated by spaces.")
44 TAG (U"##Point tiers")
45 DEFINITION (U"a list of the names of the tiers that you want to be %%point tiers%; "
46 	"the rest of the tiers will be %%interval tiers%.")
47 ENTRY (U"Example")
48 NORMAL (U"If ##Tier names# is \"a b c\", and ##Point tiers# is \"b\", "
49 	"the resulting TextGrid object will contain an interval tier named \"a\", "
50 	"a point tier named \"b\", and another interval tier named \"c\".")
51 MAN_END
52 
53 MAN_BEGIN (U"PointProcess: To TextGrid (vuv)...", U"ppgb", 19980210)
54 INTRO (U"A command to create a @TextGrid with voiced/unvoiced information "
55 	"from every selected @PointProcess.")
56 ENTRY (U"Settings")
57 TAG (U"##Maximum period (s)")
58 DEFINITION (U"the maximum interval that will be consider part of a larger voiced interval.")
59 TAG (U"##Mean period (s)")
60 DEFINITION (U"half of this value will be taken to be the amount to which a voiced interval "
61 	"will extend beyond its initial and final points. ##Mean period# should be less than "
62 	"##Maximum period#, or you may get intervals with negative durations.")
63 ENTRY (U"Example")
64 NORMAL (U"If ##Maximum period# is 0.02 s, and ##Mean period# is 0.01 s, "
65 	"and the point process is 0.1 seconds long, with points at 20, 28, 39, 61, and 72 milliseconds, "
66 	"the resulting TextGrid object will contain an interval tier "
67 	"with \"U\" intervals at [0 ms, 15 ms], [44 ms, 56 ms], and [77 ms, 100 ms], "
68 	"and \"V\" intervals at [15 ms, 44 ms] and [56 ms, 77 ms].")
69 MAN_END
70 
71 MAN_BEGIN (U"PointProcess: Up to TextGrid...", U"ppgb", 20101230)
72 INTRO (U"A command to promote every selected @PointProcess to a @TextGrid with a single text tier in it.")
73 ENTRY (U"Setting")
74 TAG (U"##Text")
75 DEFINITION (U"the text that will be placed in every point.")
76 ENTRY (U"Behaviour")
77 NORMAL (U"The times of all the points are trivially copied, and so is the time domain. "
78 	"The text information will be the same for every point.")
79 MAN_END
80 
81 MAN_BEGIN (U"Sound: To TextGrid...", U"ppgb", 19980730)
82 INTRO (U"A command to create a @TextGrid without any labels, copying the time domain from the selected @Sound.")
83 ENTRY (U"Settings")
84 TAG (U"%%Tier names")
85 DEFINITION (U"a list of the names of the tiers that you want to create, separated by spaces.")
86 TAG (U"%%Point tiers")
87 DEFINITION (U"a list of the names of the tiers that you want to be %%point tiers%; "
88 	"the rest of the tiers will be %%interval tiers%.")
89 ENTRY (U"Example")
90 NORMAL (U"If ##Tier names# is \"a b c\", and ##Point tiers# is \"b\", "
91 	"the resulting TextGrid object will contain an interval tier named \"a\", "
92 	"a point tier named \"b\", and another interval tier named \"c\".")
93 MAN_END
94 
95 MAN_BEGIN (U"SpellingChecker", U"ppgb", 20190616)
96 INTRO (U"One of the @@types of objects@ in Praat. For checking the spelling in texts and @TextGrid objects.")
97 ENTRY (U"1. How to create a SpellingChecker object")
98 NORMAL (U"You normally read in a SpellingChecker with @@Read from file...@ from the #Open menu.")
99 ENTRY (U"2. How to check the spelling of a @TextGrid")
100 NORMAL (U"A SpellingChecker object can be used fur purposes of spelling checking. In order "
101 	"to check the spellings in a @TextGrid object, you first view the TextGrid in an editor window by selecting "
102 	"the TextGrid together with the SpellingChecker object, and clicking ##View & Edit#. In most cases, you will also want "
103 	"to select a @Sound or @LongSound object before clicking ##View & Edit#, so that a representation of the sound "
104 	"is also visible (and audible) in the editor. Thus, you typically select three objects and click ##View & Edit#. "
105 	"The editor then allows you to check the spellings "
106 	"(commands ##Check spelling in tier# and ##Check spelling in interval# from the #Spell menu).")
107 ENTRY (U"3. How to create a SpellingChecker object for the first time")
108 NORMAL (U"If you are the maintainer of a word list for spelling checking, you will want "
109 	"to convert this list to a SpellingChecker object that you can distribute among the transcribers of your corpus.")
110 NORMAL (U"The first step is to create a @WordList object from your text file, as described on the @WordList man page. "
111 	"Then you simply click ##To SpellingChecker#. A button labelled ##View & Edit...# appears. "
112 	"This command allows you to set the following attributes of the SpellingChecker object:")
113 /*TAG (U"##Check matching parentheses")
114 DEFINITION (U"determines whether it is considered a spelling error if parentheses do not match, as in the string \"Hi) there\".")*/
115 TAG (U"##Allow all parenthesized")
116 DEFINITION (U"this flag determines whether text between parentheses is ignored in spelling checking. "
117 	"This would allow the transcriber to mark utterances in foreign languages, which cannot be found in the lexicon.")
118 TAG (U"##Separating characters")
119 DEFINITION (U"determines the set of characters (apart from the space character) that separate words. "
120 	"The standard is \".,;:()\". If a string like \"error-prone\" should be considered two separate words, "
121 	"you will like to change this to \".,;:()-\". "
122 	"For the Corpus of Spoken Dutch (CGN), the hyphen is not a separator, since words like \"mee-eter\" should be checked as a whole. "
123 	"If a string like \"Mary's\" should be considered two separate words, include the apostrophe.")
124 /*TAG (U"##Forbidden strings")
125 DEFINITION (U"this will mainly contain characters that are not allowed in your corpus. For the CGN, this is \": ; \\\" \".")*/
126 TAG (U"##Allow all names")
127 DEFINITION (U"determines whether all words that start with a capital are allowed. For the CGN, this is on, "
128 	"since the lexicon does not contain many names.")
129 TAG (U"##Name prefixes")
130 DEFINITION (U"a space-separated list that determines what small groups of characters can precede names. For the CGN, "
131 	"this is \"'s- d' l'\", since names like %%'s-Gravenhage%, %%d'Ancona%, and %%l'H\\o^pital% should be ignored by the spelling checker.")
132 TAG (U"##Allow all words containing")
133 DEFINITION (U"a space-separated list of strings that make a word correct even if not in the lexicon. "
134 	"For the CGN, this is \"* xxx\", since words like %%keuje*d% and %%verxxxing% should be ignored by the spelling checker.")
135 TAG (U"##Allow all words starting with")
136 DEFINITION (U"a space-separated list of prefixes that make a word correct even if not in the lexicon. "
137 	"For the CGN, this is empty.")
138 TAG (U"##Allow all words ending in")
139 DEFINITION (U"a space-separated list of suffixes that make a word correct even if not in the lexicon. "
140 	"For the CGN, this is \"-\", since the first word in %%verzekerings- en bankwezen% should be ignored by the spelling checker.")
141 MAN_END
142 
143 MAN_BEGIN (U"TextGrid", U"ppgb", 20110128)
144 INTRO (U"One of the @@types of objects@ in Praat, used for %annotation (segmentation and labelling). "
145 	"For tutorial information, see @@Intro 7. Annotation@.")
146 ENTRY (U"Description")
147 NORMAL (U"A #TextGrid object consists of a number of %tiers. There are two kinds of tiers: "
148 	"an %%interval tier% is a connected sequence of labelled intervals, with %boundaries in between. "
149 	"A %%point tier% is a sequence of labelled points.")
150 ENTRY (U"How to create a TextGrid")
151 TAG (U"From scratch:")
152 LIST_ITEM (U"@@Sound: To TextGrid...@ (takes the time domain from the Sound)")
153 LIST_ITEM (U"@@LongSound: To TextGrid...@ (takes the time domain from the LongSound)")
154 LIST_ITEM (U"@@PointProcess: To TextGrid...@ (takes the time domain from the PointProcess)")
155 LIST_ITEM (U"@@PointProcess: To TextGrid (vuv)...@ (labels voiced and unvoiced intervals)")
156 LIST_ITEM (U"@@Create TextGrid...@")
157 TAG (U"From merging existing TextGrids with each other:")
158 LIST_ITEM (U"@@TextGrids: Merge@")
159 ENTRY (U"How to edit a TextGrid")
160 NORMAL (U"You select a TextGrid alone or together with a @Sound or @LongSound, and click ##View & Edit#. "
161 	"A @TextGridEditor will appear on your screen, containing the TextGrid "
162 	"and an optional copy of the Sound or LongSound.")
163 ENTRY (U"How to draw a TextGrid")
164 TAG (U"You can draw a TextGrid to the @@Picture window@ with:")
165 LIST_ITEM (U"##TextGrid: Draw...")
166 LIST_ITEM (U"##TextGrid & Sound: Draw...")
167 LIST_ITEM (U"##TextGrid & Pitch: Draw...")
168 LIST_ITEM (U"##TextGrid & Pitch: Draw separately...")
169 MAN_END
170 
171 MAN_BEGIN (U"TextGrid: Count labels...", U"ppgb", 20140421)
172 INTRO (U"A command to ask the selected @TextGrid object how many of the specified labels "
173 	"it contains in the specified tier.")
174 ENTRY (U"Settings")
175 TAG (U"##Tier number")
176 DEFINITION (U"the number (1, 2, 3...) of the tier whose labels you want to investigate.")
177 TAG (U"##Label text")
178 DEFINITION (U"the text on the labels that you want to count.")
179 ENTRY (U"Behaviour")
180 NORMAL (U"The number of intervals or points with label %%Label text% in tier %%Tier number% "
181 	"is written into the @@Info window@. If the specified tier does not exist, the number will be 0.")
182 ENTRY (U"Scripting")
183 NORMAL (U"You can use this command to put the number into a script variable:")
184 CODE (U"selectObject: \"TextGrid hallo\"")
185 CODE (U"number_of_a = Count labels: 1, \"a\"")
186 NORMAL (U"In this case, the value will not be written into the Info window.")
187 MAN_END
188 
189 MAN_BEGIN (U"TextGrids: Merge", U"ppgb", 20101230)
190 INTRO (U"A command to merge all selected @TextGrid objects into a new @TextGrid.")
191 MAN_END
192 
193 MAN_BEGIN (U"TextGridEditor", U"ppgb", 20210228)
194 INTRO (U"One of the @Editors in Praat, for editing a @TextGrid object.")
195 NORMAL (U"You can optionally include a copy of a @Sound or @LongSound in this editor, "
196 	"by selecting both the TextGrid and the Sound or LongSound before clicking ##View & Edit#. "
197 	"The Sound or LongSound is shown in the upper part of the window, the tiers in the lower part. "
198 	"A text window at the top shows the text of the %#selected interval or point, "
199 	"i.e. the interval or point at the location of the cursor. "
200 	"All tiers are visible, and if you do not zoom in, all boundaries, points, and texts are visible, too. "
201 	"You can do many of the same things that you can do with a @SoundEditor or @LongSoundEditor.")
202 ENTRY (U"Positioning the cursor or the selection marks")
203 NORMAL (U"To position the cursor hair, @click in the #Sound, on a boundary, on a point, or inside an interval.")
204 NORMAL (U"To select any part of the time domain, use the @@time selection@ mechanism; "
205 	"if you do this by clicking in a tier, "
206 	"the selected time domain will snap to the nearest boundary or point.")
207 ENTRY (U"Creating new intervals, boundaries, points, or tiers")
208 NORMAL (U"To create a new interval, create a new boundary in an interval tier.")
209 NORMAL (U"To create a new boundary or point in a tier, @click inside the cursor circle in that tier, "
210 	"or choose one of the commands in the Boundary/Point menu to insert a boundary at the cursor time "
211 	"on the selected tier (shortcut: Enter) or on any tier (shortcuts: @@Keyboard shortcuts|Command-F1@ through @@Keyboard shortcuts|Command-F9@). The original text "
212 	"in the interval that is split, is divided up between the two resulting intervals, depending on "
213 	"the position of the text cursor in the text window.")
214 NORMAL (U"To create a new tier, choose ##Add interval tier# or ##Add point tier# from the #Tier menu.")
215 ENTRY (U"Playing an entire interval, or part of it")
216 NORMAL (U"As in many other editors, you can play a stretch of sound by clicking in any of the rectangles "
217 	"around the drawing area.")
218 NORMAL (U"To play an interval of an interval tier, you first @click inside it. This will make the interval %selected, "
219 	"which means that the visible part of the interval will be drawn in yellow. The cursor will be positioned "
220 	"at the start of the interval, and the time selection will comprise exactly the interval. This means that "
221 	"you can use the Tab key to play the interval. If you press it while a sound is playing, "
222 	"the Tab key will halt the playing sound, and the cursor will move to the time at which the sound stopped playing. "
223 	"This helps you to divide up a long sentence into parts that you can remember long enough to write them "
224 	"down.")
225 NORMAL (U"The Tab key will play the selected interval.")
226 ENTRY (U"Editing the text in an interval or at a point")
227 NORMAL (U"To edit the label text of an interval or point:")
228 LIST_ITEM (U"1. Select that interval or point by clicking in or on it. The text currently in the interval or point "
229 	"will appear in the text window.")
230 LIST_ITEM (U"2. Just type the text, and use the mouse and the arrow keys to navigate the text window. "
231 	"Everything you type will become visible immediately in the text window as well as in the selected "
232 	"interval or point.")
233 NORMAL (U"You can use all the @@Special symbols@ "
234 	"that you can use elsewhere in Praat, including mathematical symbols, Greek and Chinese letters, superscripts, "
235 	"and phonetic symbols.")
236 ENTRY (U"Selecting a tier")
237 NORMAL (U"To select a tier, click anywhere inside it. Its number and name will be drawn in red, "
238 	"and a pointing finger symbol (☞) will appear on its left.")
239 ENTRY (U"Selecting a boundary or point")
240 NORMAL (U"To select a boundary on an interval tier, @click in its vicinity or inside the following interval; "
241 	"the boundary will be drawn in red. The text in the interval will appear in the text window.")
242 NORMAL (U"To select a point on a point tier, @click in its vicinity; it will be drawn in red. "
243 	"The text of the point will appear in the text window.")
244 ENTRY (U"Moving one or more boundaries or points")
245 NORMAL (U"To move a boundary or point to another time position, @drag it with the mouse.")
246 NORMAL (U"To move all the boundaries and points with the same time (on different tiers) to another time position, "
247 	"@@Shift-drag@ them.")
248 NORMAL (U"To move boundaries or points to the exact time position of a boundary or point on an other tier, "
249 	"@drag them into that other tier and into the vicinity of that boundary or point.")
250 NORMAL (U"To move boundaries or points to the exact time position of the cursor, "
251 	"@drag them into the vicinity of the cursor.")
252 ENTRY (U"Removing a boundary, point, or tier")
253 NORMAL (U"To remove a selected #boundary, choose #Remove from the #Boundary menu. "
254 	"This creates a new interval which is the union of the two intervals originally adjoining the boundary; "
255 	"the new text of this interval is the concatenation of the two original texts, "
256 	"except if these were equal, in which case the new text equals both original texts.")
257 NORMAL (U"To remove a selected #point, choose #Remove from the #Point menu.")
258 NORMAL (U"To remove a selected #tier, choose ##Remove entire tier# from the #Tier menu.")
259 /*"To rename a selected tier, choose 'Rename...' from the 'Tier' menu. "*/
260 /*"To remove all the boundaries and labels in a selected tier, "
261 "   choose 'Clear entire tier' from the 'Tier' menu. "*/
262 ENTRY (U"Extracting a part of the sound")
263 NORMAL (U"To copy the selected part of the Sound or LongSound as a Sound to the @@List of Objects@, "
264 	"choose ##Extract sound selection# from the #File menu. You can specify whether you want "
265 	"the time domain of the resulting Sound to match the starting and finishing times of the "
266 	"selection or whether you want the time domain of the resulting Sound to start at zero seconds.")
267 NORMAL (U"If you are viewing a LongSound, you can save the selected part of it to a 16-bit sound file "
268 	"(AIFF, AIFC, WAV, NeXT/Sun, NIST) with a command from the File menu.")
269 ENTRY (U"Accelerations")
270 NORMAL (U"To save the @TextGrid object as a text file without going to the @@Object window@: "
271 	"choose ##Save TextGrid as text file...# from the #File menu.")
272 ENTRY (U"Searching")
273 NORMAL (U"The Search menu contains the command #Find (@@Keyboard shortcuts|Command-F@), which will allow you to specify "
274 	"a text whose first occurrence will then be looked for in the currently selected tier "
275 	"(starting from the currently selected text in the currently selected interval). "
276 	"The command ##Find again# (@@Keyboard shortcuts|Command-G@) will search for the next occurrence of the same search text.")
277 ENTRY (U"Checking the spelling")
278 NORMAL (U"You can check the spelling of the intervals in your tiers by including a @SpellingChecker "
279 	"object as you launch the editor: select TextGrid + (Long)Sound + SpellingChecker, "
280 	"then click ##View & Edit#. The #Spell menu will contain the commands ##Check spelling in tier# (@@Keyboard shortcuts|Command-N@), and ##Check spelling in interval# "
281 	"which will search for the next word in the tier or interval that does not occur in the lexicon.")
282 MAN_END
283 
284 MAN_BEGIN (U"WordList", U"ppgb", 20190616)
285 INTRO (U"One of the @@types of objects@ in Praat. "
286 	"An object of class WordList contains a sorted list of strings in a system-independent format. "
287 	"WordList objects can be used for spelling checking after conversion to a @SpellingChecker object.")
288 ENTRY (U"1. How to create a WordList object")
289 NORMAL (U"You will normally create a WordList object by reading a binary WordList file. "
290 	"You'll use the generic @@Read from file...@ command from the #Open menu.")
291 NORMAL (U"See below under 3 for how to create such a file.")
292 ENTRY (U"2. What you can do with a Wordlist object")
293 NORMAL (U"The main functionality of a WordList is its ability to tell you whether it contains a certain string. "
294 	"If you select a WordList, you can query the existence of a specific word by using the ##Has word# "
295 	"command. You supply the word and press OK. If the WordList does contain the word, "
296 	"the value \"1\" will be written to the Info window; otherwise, the value \"0\" will be written.")
297 ENTRY (U"3. How to create a binary WordList file")
298 NORMAL (U"You can create a binary WordList file from a simple text file that contains a long list of words. "
299 	"Perhaps such a text file has been supplied by a lexicographic institution in your country; "
300 	"because of copyright issues, such word lists cannot be distributed with the Praat program. "
301 	"To convert the simple text file into a compressed WordList file, you basically take the following steps:")
302 CODE (U"Read Strings from raw text file: \"lexicon.txt\"")
303 CODE (U"Sort")
304 CODE (U"To WordList")
305 CODE (U"Save as binary file: \"lexicon.WordList\"")
306 NORMAL (U"I'll explain these steps in detail. "
307 	"For instance, a simple text file may contain the following list of words:")
308 CODE (U"cook")
309 CODE (U"cooked")
310 CODE (U"cookie")
311 CODE (U"cookies")
312 CODE (U"cooking")
313 CODE (U"cooks")
314 CODE (U"Copenhagen")
315 CODE (U"Købnhavn")
316 CODE (U"München")
317 CODE (U"Munich")
318 CODE (U"ångström")
319 NORMAL (U"These are just 11 words, but the procedure will work fine if you have a million of them, "
320 	"and enough memory in your computer.")
321 NORMAL (U"You can read the file into a @Strings object with @@Read Strings from raw text file...@ "
322 	"from the #Open menu in the Objects window. The resulting @Strings object contains 11 strings in the above order, "
323 	"as you can verify by viewing them with @Inspect.")
324 NORMAL (U"If you select the Strings, you can click the ##To WordList# button. "
325 	"However, you will get the following complaint:")
326 CODE1 (U"String \"Copenhagen\" not sorted. Please sort first.")
327 NORMAL (U"This complaint means that the strings have not been sorted in Unicode sorting order. "
328 	"So you click #Sort, and the Strings object becomes:")
329 CODE (U"Copenhagen")
330 CODE (U"Købnhavn")
331 CODE (U"Munich")
332 CODE (U"München")
333 CODE (U"cook")
334 CODE (U"cooked")
335 CODE (U"cookie")
336 CODE (U"cookies")
337 CODE (U"cooking")
338 CODE (U"cooks")
339 CODE (U"ångström")
340 NORMAL (U"The strings are now in Unicode sorting order, in which capitals come before lower-case letters, "
341 	"and composite characters follow the latter.")
342 NORMAL (U"Clicking ##To WordList# now succeeds, and a WordList object appears in the list. "
343 	"If you save it to a text file (with the Save menu), you will get the following file:")
344 CODE (U"File type = \"ooTextFile\"")
345 CODE (U"Object class = \"WordList\"")
346 CODE (U"")
347 CODE (U"string = \"Copenhagen")
348 CODE (U"Købnhavn")
349 CODE (U"Munich")
350 CODE (U"München")
351 CODE (U"cook")
352 CODE (U"cooked")
353 CODE (U"cookie")
354 CODE (U"cookies")
355 CODE (U"cooking")
356 CODE (U"cooks")
357 CODE (U"ångström\\\" ")
358 NORMAL (U"Note that any double quotes (\\\" ) that appear inside the strings, will be doubled, "
359 	"as is done everywhere inside strings in Praat text files.")
360 NORMAL (U"After you have created a WordList text file, you can create a WordList object just by reading this file "
361 	"with @@Read from file...@ from the #Open menu.")
362 NORMAL (U"The WordList object has the advantage over the Strings object that it won't take up more "
363 	"memory than the original word list. This is because the WordList is stored as a single string: "
364 	"a contiguous list of strings, separated by new-line symbols.")
365 MAN_END
366 
367 /*
368 longSound = selected ("LongSound")
369 longSoundNaam$ = selected$ ("LongSound")
370 textGrid = selected ("TextGrid")
371 select 'textGrid'
372 aantalIntervallen = Get number of intervals... 1
373 for interval to aantalIntervallen
374    select 'textGrid'
375    begintijd = Get starting point... 1 interval
376    eindtijd = Get end point... 1 interval
377    select 'longSound'
378    Extract part... begintijd eindtijd no
379    Save as WAV file... C:\Geluiden\'longSoundNaam$'_'interval'.wav
380    Remove
381 endfor
382 
383 
384 # This is a Praat script that assumes that a single TextGrid is selected,
385 # and that the data in the first (or only) tier is in the form
386 # silence-text-silence-text and so on. The script will then write
387 # the durations of the silences and the texts into the Info window.
388 
389 form Tabulate speech and silences
390    comment Give the output file name:
391    text fileName c:\windows\desktop\kim\out.txt
392 endform
393 
394 # The following line provides the header,
395 # separated by tabs for easy inclusion in Excel.
396 echo Pause'tab$'Speech'tab$'Text
397 
398 # Every next line writes three pieces of data,
399 # separated by tabs again.
400 
401 # The following is a command from the Query menu
402 # that appears when you select a TextGrid object.
403 numberOfIntervals = Get number of intervals... 1
404 
405 # The number of silence-speech pairs is half of that number,
406 # disregarding any silence at the end.
407 numberOfPairs = numberOfIntervals div 2
408 
409 # Cycle through all the silence-speech pairs.
410 
411 for pair to numberOfPairs
412    silenceInterval = 2 * pair - 1   ; interval 1, 3, 5, and so on
413    speechInterval = 2 * pair   ; interval 2, 4, 6, and so on
414    # Check that the silence interval is indeed empty.
415    silenceText$ = Get label of interval... 1 silenceInterval
416    if silenceText$ <> ""
417       exit Interval 'silenceInterval' should be a silence, but isn't.
418    endif
419    # Also check that the speech interval contains some text.
420    speechText$ = Get label of interval... 1 speechInterval
421    if speechText$ = ""
422       exit Interval 'speechInterval' should contain text, but doesn't.
423    endif
424    # So now we have checked that the intervals contain the data
425    # that Kim wanted them to contain. We're ready to write the data!
426    silenceBegin = Get starting point... 1 silenceInterval
427    silenceEnd = Get end point... 1 silenceInterval
428    silenceDuration_ms = (silenceEnd - silenceBegin) * 1000
429    speechBegin = Get starting point... 1 speechInterval
430    speechEnd = Get end point... 1 speechInterval
431    speechDuration_ms = (speechEnd - speechBegin) * 1000
432    printline 'silenceDuration_ms:0''tab$'
433    ...'speechDuration_ms:0''tab$'
434    ...'speechText$'
435 endfor
436 filedelete 'fileName$'
437 fappendinfo 'fileName$'
438 
439 */
440 
441 }
442 
443 /* End of file manual_annotation.cpp */
444