pelican-nlp 0.3.8__py3-none-any.whl → 0.3.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pelican_nlp/_version.py +1 -1
- pelican_nlp/praat/eps_conv.praat +193 -0
- pelican_nlp/praat/polytonia.praat +773 -0
- pelican_nlp/praat/prosogram.praat +102 -0
- pelican_nlp/praat/prosomain.praat +3787 -0
- pelican_nlp/praat/prosoplot.praat +1546 -0
- pelican_nlp/praat/segment.praat +1224 -0
- pelican_nlp/praat/setup.praat +1 -0
- pelican_nlp/praat/stylize.praat +2766 -0
- pelican_nlp/praat/util.praat +632 -0
- {pelican_nlp-0.3.8.dist-info → pelican_nlp-0.3.9.dist-info}/METADATA +1 -1
- {pelican_nlp-0.3.8.dist-info → pelican_nlp-0.3.9.dist-info}/RECORD +16 -7
- {pelican_nlp-0.3.8.dist-info → pelican_nlp-0.3.9.dist-info}/WHEEL +0 -0
- {pelican_nlp-0.3.8.dist-info → pelican_nlp-0.3.9.dist-info}/entry_points.txt +0 -0
- {pelican_nlp-0.3.8.dist-info → pelican_nlp-0.3.9.dist-info}/licenses/LICENSE +0 -0
- {pelican_nlp-0.3.8.dist-info → pelican_nlp-0.3.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,632 @@
|
|
1
|
+
# util.praat --- Praat include file containing some utilities
|
2
|
+
#
|
3
|
+
# This file isn't a stand-alone script. It is included (indirectly) by prosogram.praat. Use prosogram.praat instead.
|
4
|
+
# Author: Piet Mertens
|
5
|
+
# Last modification: 2020-07-14
|
6
|
+
|
7
|
+
|
8
|
+
procedure files_get_regex: .varname$, .spec$
|
9
|
+
# Get list of file names using a regular expression (whereas "Create Strings as file list" only allows wildcard '*').
|
10
|
+
# <spec> contains full path with possibly regex symbols in filename part.
|
11
|
+
# <varname> is the name of the variable that will hold the list object ID.
|
12
|
+
@fname_parts: .spec$
|
13
|
+
.specfname$ = result1$ ; fname without path
|
14
|
+
@debug_msg: "files_get_regex: specfname='.specfname$'"
|
15
|
+
.indir$ = result4$
|
16
|
+
; Find ALL files in the specified directory
|
17
|
+
.listID = Create Strings as file list: "filelist", "'.indir$'*"
|
18
|
+
.j = Get number of strings
|
19
|
+
selectObject: .listID
|
20
|
+
'.varname$' = .listID
|
21
|
+
while (.j > 0)
|
22
|
+
.s$ = Get string: .j
|
23
|
+
.i = index_regex (.s$, .specfname$)
|
24
|
+
if not (index_regex (.s$, .specfname$)) ; Match with regular expression
|
25
|
+
Remove string: .j
|
26
|
+
else
|
27
|
+
Set string: .j, "'.indir$''.s$'"
|
28
|
+
endif
|
29
|
+
.j -= 1
|
30
|
+
endwhile
|
31
|
+
endproc
|
32
|
+
|
33
|
+
|
34
|
+
procedure file_windows_notation: .fname$
|
35
|
+
result$ = replace_regex$(.fname$, "/", "\\", 0)
|
36
|
+
endproc
|
37
|
+
|
38
|
+
|
39
|
+
procedure file_rename: .oldfname$, .newfname$
|
40
|
+
# File is relative to script directory, unless absolute path is specified.
|
41
|
+
# On windows, newfname$ cannot be an absolute path.
|
42
|
+
if not fileReadable (.oldfname$)
|
43
|
+
@msg: "Cannot find <'.oldfname$'>"
|
44
|
+
else
|
45
|
+
if (windows)
|
46
|
+
@file_windows_notation: .oldfname$
|
47
|
+
.oldfname$ = result$
|
48
|
+
@file_windows_notation: .newfname$
|
49
|
+
.newfname$ = result$
|
50
|
+
@debug_msg: "Command=<rename '.oldfname$' '.newfname$'>"
|
51
|
+
.command$ = "rename"
|
52
|
+
else
|
53
|
+
.command$ = "mv"
|
54
|
+
endif
|
55
|
+
runSystem: .command$, " ", .oldfname$, " ", .newfname$
|
56
|
+
endif
|
57
|
+
endproc
|
58
|
+
|
59
|
+
|
60
|
+
procedure file_copy: .srcfname$, .dstfname$
|
61
|
+
# File is relative to script directory, unless absolute path is specified.
|
62
|
+
if not fileReadable (.srcfname$)
|
63
|
+
@msg: "Cannot find <'.srcfname$'>"
|
64
|
+
else
|
65
|
+
if (windows)
|
66
|
+
@file_windows_notation: .srcfname$
|
67
|
+
.srcfname$ = result$
|
68
|
+
@file_windows_notation: .dstfname$
|
69
|
+
.dstfname$ = result$
|
70
|
+
@debug_msg: "Command=<copy '.srcfname$' '.dstfname$'>"
|
71
|
+
.command$ = "copy"
|
72
|
+
else
|
73
|
+
.command$ = "cp"
|
74
|
+
endif
|
75
|
+
runSystem: .command$, " ", .srcfname$, " ", .dstfname$
|
76
|
+
endif
|
77
|
+
endproc
|
78
|
+
|
79
|
+
|
80
|
+
procedure fname_parts: .s$
|
81
|
+
# Obtain filename parts
|
82
|
+
# .s$ the total filename
|
83
|
+
# result1$ the filename without path
|
84
|
+
# result2$ the basename (i.e. no path, no extension)
|
85
|
+
# result3$ the filename extension (excluding dot)
|
86
|
+
# result4$ the file path (including trailing slash) including drive
|
87
|
+
# result5$ the file path (including trailing slash) excluding drive
|
88
|
+
# result6$ the drive (excluding separator ':' )
|
89
|
+
@debug_msg: "fname_parts: entry"
|
90
|
+
result1$ = .s$
|
91
|
+
result2$ = ""
|
92
|
+
result3$ = ""
|
93
|
+
result4$ = ""
|
94
|
+
result5$ = ""
|
95
|
+
result6$ = ""
|
96
|
+
.pos = rindex (.s$, "\")
|
97
|
+
if (.pos = 0)
|
98
|
+
.pos = rindex (.s$, "/")
|
99
|
+
endif
|
100
|
+
if (.pos > 0)
|
101
|
+
result4$ = mid$ (.s$, 1, .pos)
|
102
|
+
.len = length (.s$) - .pos
|
103
|
+
result1$ = mid$ (.s$, .pos + 1, .len)
|
104
|
+
endif
|
105
|
+
.pos = rindex (result1$, ".")
|
106
|
+
if (.pos > 0)
|
107
|
+
.len = length (result1$)
|
108
|
+
result3$ = right$ (result1$, .len - .pos)
|
109
|
+
result2$ = left$ (result1$, .pos - 1)
|
110
|
+
else
|
111
|
+
result2$ = result1$
|
112
|
+
endif
|
113
|
+
.pos = index (result4$, ":")
|
114
|
+
if (.pos = 2)
|
115
|
+
.len = length (result4$)
|
116
|
+
result5$ = right$ (result4$, .len - .pos)
|
117
|
+
result6$ = left$ (result4$, .pos - 1)
|
118
|
+
else
|
119
|
+
result5$ = result4$
|
120
|
+
endif
|
121
|
+
@debug_msg: "fname_parts: exit"
|
122
|
+
endproc
|
123
|
+
|
124
|
+
|
125
|
+
procedure interval_from_time: .gridID, .tiernr, .t, varname$
|
126
|
+
# Return in global variable <varname$> the interval number within tier <.tiernr> of TextGrid <.gridID>
|
127
|
+
# in which time <.t> occurs, taking into account cases where time is outside grid range
|
128
|
+
@debug_msg: "interval_from_time: entry, varname='varname$'"
|
129
|
+
selectObject: .gridID
|
130
|
+
.result = Get interval at time: .tiernr, .t
|
131
|
+
if (.result == 0) ; time outside grid range
|
132
|
+
.start = Get start time
|
133
|
+
if (.t <= .start)
|
134
|
+
.result = 1
|
135
|
+
else
|
136
|
+
.end = Get end time
|
137
|
+
if (.t >= .end)
|
138
|
+
.result = Get number of intervals: .tiernr
|
139
|
+
endif
|
140
|
+
endif
|
141
|
+
endif
|
142
|
+
'varname$' = .result
|
143
|
+
@debug_msg: "interval_from_time: exit"
|
144
|
+
endproc
|
145
|
+
|
146
|
+
|
147
|
+
procedure intervals_from_time_range: .gridID, .tiernr, .t1, .t2, varname1$, varname2$
|
148
|
+
# Return in global variables <varname1$> and <varname2$> the interval numbers within tier <.tiernr> of TextGrid <.gridID>
|
149
|
+
# in which times <.t1> and <.t2> occur, taking into account cases where time is outside grid range
|
150
|
+
if (.t1 > .t2)
|
151
|
+
@fatal_error: "intervals_from_time_range: t1 > t2"
|
152
|
+
endif
|
153
|
+
@interval_from_time: .gridID, .tiernr, .t1, varname1$
|
154
|
+
@interval_from_time: .gridID, .tiernr, .t2, varname2$
|
155
|
+
endproc
|
156
|
+
|
157
|
+
|
158
|
+
procedure intervals_from_time_range_excl: .gridID, .tiernr, .t1, .t2, varname1$, varname2$
|
159
|
+
# Return in global variables <varname1$> and <varname2$> the interval numbers within tier <.tiernr> of TextGrid <.gridID>
|
160
|
+
# from time <.t1> up to bot not including <.t2>, taking into account cases where time is outside grid range
|
161
|
+
# <.t2>
|
162
|
+
@interval_from_time: .gridID, .tiernr, .t1, varname1$
|
163
|
+
selectObject: .gridID
|
164
|
+
.result = Get low interval at time: .tiernr, .t2
|
165
|
+
if (.result == 0) ; time outside grid range
|
166
|
+
.end = Get end time
|
167
|
+
if (.t2 >= .end)
|
168
|
+
.result = Get number of intervals: .tiernr
|
169
|
+
endif
|
170
|
+
endif
|
171
|
+
'varname2$' = .result
|
172
|
+
endproc
|
173
|
+
|
174
|
+
|
175
|
+
procedure tier_get_label_at_time: .grid, .tier, .time, .varname$
|
176
|
+
; for interval tier only
|
177
|
+
'.varname$'$ = ""
|
178
|
+
selectObject: .grid
|
179
|
+
.interval_tier = Is interval tier: .tier
|
180
|
+
if (.interval_tier)
|
181
|
+
.i = Get interval at time: .tier, .time
|
182
|
+
if (.i > 0)
|
183
|
+
'.varname$'$ = Get label of interval: .tier, .i
|
184
|
+
endif
|
185
|
+
endif
|
186
|
+
endproc
|
187
|
+
|
188
|
+
|
189
|
+
procedure tier_get_label_in_range .grid .tier .t1 .t2 .varname$
|
190
|
+
; for point tier
|
191
|
+
'.varname$'$ = ""
|
192
|
+
selectObject: .grid
|
193
|
+
.interval_tier = Is interval tier: .tier
|
194
|
+
if (not .interval_tier)
|
195
|
+
.k = Get nearest index from time: .tier, .t1+(.t2-.t1)/2
|
196
|
+
.t = Get time of point: .tier, .k
|
197
|
+
if (.t > .t1 and .t <=.t2)
|
198
|
+
'.varname$'$ = Get label of point: .tier, .k
|
199
|
+
endif
|
200
|
+
endif
|
201
|
+
endproc
|
202
|
+
|
203
|
+
|
204
|
+
procedure tier_number_by_name: .gridID, name$
|
205
|
+
# Return in <result> the number of first tier corresponding to tier name.
|
206
|
+
# Return 0 if tier with name does not exist in textgrid.
|
207
|
+
# The target tier <name> may be a regular expression.
|
208
|
+
# Return tier name in <result2$>
|
209
|
+
selectObject: .gridID
|
210
|
+
.n = Get number of tiers
|
211
|
+
result = 0
|
212
|
+
.tier = 1
|
213
|
+
while (.tier <= .n and result == 0)
|
214
|
+
result2$ = Get tier name: .tier
|
215
|
+
if (index_regex (result2$, name$))
|
216
|
+
result = .tier
|
217
|
+
else
|
218
|
+
.tier += 1
|
219
|
+
result2$ = ""
|
220
|
+
endif
|
221
|
+
endwhile
|
222
|
+
endproc
|
223
|
+
|
224
|
+
|
225
|
+
procedure tier_get: .gridID, tiername$, varname$, message$, .fatal
|
226
|
+
# In TextGrid object <.gridID>, find a tier with a name matching the regular expression
|
227
|
+
# in <tiername$> and return its number as the value of variable named <varname$>.
|
228
|
+
# When such a tier is not found, print the error message and exit is <.fatal> is true.
|
229
|
+
@tier_number_by_name: .gridID, tiername$
|
230
|
+
if (result < 1)
|
231
|
+
if (.fatal)
|
232
|
+
@fatal_error: message$
|
233
|
+
else
|
234
|
+
@msg: message$
|
235
|
+
endif
|
236
|
+
endif
|
237
|
+
'varname$' = result
|
238
|
+
endproc
|
239
|
+
|
240
|
+
|
241
|
+
procedure tier_names: .grid
|
242
|
+
; Return in the variable result$ the list of tiernames in the TextGrid, in the form "1:name1 2:name2 3:name3"
|
243
|
+
selectObject: .grid
|
244
|
+
.n = Get number of tiers
|
245
|
+
result$ = ""
|
246
|
+
for .j to .n
|
247
|
+
.s$ = Get tier name: .j
|
248
|
+
if (.j > 1)
|
249
|
+
result$ = result$ + ", "
|
250
|
+
endif
|
251
|
+
result$ = result$ + "'.j':" + .s$
|
252
|
+
endfor
|
253
|
+
endproc
|
254
|
+
|
255
|
+
|
256
|
+
procedure tier_align_on: .grid, .tier, .ontier, .dt
|
257
|
+
; Align boundaries in <.tier> on those in <.ontier>, when the time difference <= <.dt>
|
258
|
+
selectObject: .grid
|
259
|
+
.n = Get number of tiers
|
260
|
+
if (.tier <= .n and .ontier <= .n and .tier <> .ontier)
|
261
|
+
.ni = Get number of intervals: .ontier
|
262
|
+
for .i from 2 to .ni
|
263
|
+
.t = Get starting point: .ontier, .i
|
264
|
+
.j = Get interval at time: .tier, .t
|
265
|
+
.t1 = Get starting point: .tier, .j
|
266
|
+
.t2 = Get end point: .tier, .j
|
267
|
+
.s$ = Get label of interval: .tier, .j
|
268
|
+
if (.t = .t1)
|
269
|
+
elsif (.t-.t1 < .t2-.t and .t-.t1 <= .dt)
|
270
|
+
Set interval text: .tier, .j, ""
|
271
|
+
Insert boundary: .tier, .t
|
272
|
+
Remove boundary at time: .tier, .t1
|
273
|
+
Set interval text: .tier, .j, .s$
|
274
|
+
elsif (.t2-.t <= .dt)
|
275
|
+
Insert boundary: .tier, .t
|
276
|
+
Remove boundary at time: .tier, .t2
|
277
|
+
endif
|
278
|
+
endfor
|
279
|
+
endif
|
280
|
+
endproc
|
281
|
+
|
282
|
+
|
283
|
+
procedure tier_replace: .srcgrid, .srctier, .destgrid, .desttier, .dest_varname$
|
284
|
+
; Replace a tier of a grid by a tier of another grid.
|
285
|
+
; For speed, when possible, extract a tier, merge it with src TextGrid and duplicate it to appropriate position.
|
286
|
+
; However, when times don't match, copy interval by interval.
|
287
|
+
selectObject: .destgrid
|
288
|
+
.dest_t1 = Get start time
|
289
|
+
.dest_t2 = Get end time
|
290
|
+
.n = Get number of tiers
|
291
|
+
selectObject: .srcgrid
|
292
|
+
.src_t1 = Get start time
|
293
|
+
.src_t2 = Get end time
|
294
|
+
.tiername$ = Get tier name: .srctier
|
295
|
+
if (.src_t1 == .dest_t1 and .src_t2 <= .dest_t2)
|
296
|
+
.newgrid = Extract one tier: .srctier
|
297
|
+
if (.src_t2 < .dest_t2)
|
298
|
+
Extend time: .dest_t2-.src_t2, "End"
|
299
|
+
.newgrid_t2 = Get end time
|
300
|
+
@debug_msg: "tier_replace: new endtime='.newgrid_t2' (signal_finish='signal_finish')"
|
301
|
+
endif
|
302
|
+
selectObject: .destgrid
|
303
|
+
plus .newgrid
|
304
|
+
.merged = Merge
|
305
|
+
Remove tier: .desttier
|
306
|
+
.ntiers = Get number of tiers
|
307
|
+
Duplicate tier: .ntiers, .desttier, .tiername$
|
308
|
+
Remove tier: .ntiers+1
|
309
|
+
removeObject: .destgrid, .newgrid
|
310
|
+
'.dest_varname$' = .merged
|
311
|
+
else ; times don't match
|
312
|
+
@msg: "tier_replace: times dont match: src '.src_t1' '.src_t2' , dest '.dest_t1' '.dest_t2'"
|
313
|
+
@copy_tier: .srcgrid, .srctier, .destgrid, .desttier
|
314
|
+
endif
|
315
|
+
endproc
|
316
|
+
|
317
|
+
|
318
|
+
procedure tier_replace2: .srcgrid, .srctier, .destgrid, .desttier
|
319
|
+
@tier_clear: .destgrid, .desttier
|
320
|
+
@copy_tier: .srcgrid, .srctier, .destgrid, .desttier
|
321
|
+
endproc
|
322
|
+
|
323
|
+
|
324
|
+
procedure copy_tier: .srcgrid, .srctier, .destgrid, .desttier
|
325
|
+
# assumes destination tier is empty
|
326
|
+
selectObject: .srcgrid
|
327
|
+
.interval_tier = Is interval tier: .srctier
|
328
|
+
if (.interval_tier)
|
329
|
+
selectObject: .destgrid
|
330
|
+
.n = Get number of intervals: .desttier
|
331
|
+
.endtime = Get end time of interval: .desttier, .n
|
332
|
+
selectObject: .srcgrid
|
333
|
+
.n = Get number of intervals: .srctier
|
334
|
+
for .i to .n
|
335
|
+
selectObject: .srcgrid
|
336
|
+
.t1 = Get start time of interval: .srctier, .i
|
337
|
+
.t2 = Get end time of interval: .srctier, .i
|
338
|
+
.label$ = Get label of interval: .srctier, .i
|
339
|
+
selectObject: .destgrid
|
340
|
+
if (.t2 < .endtime and .i < .n)
|
341
|
+
Insert boundary: .desttier, .t2
|
342
|
+
endif
|
343
|
+
if (.t1 <= .endtime)
|
344
|
+
.t2 = min (.t2, .endtime) ; when destgrid is shorter than srcgrid
|
345
|
+
.j = Get interval at time: .desttier, .t1+(.t2-.t1)/2
|
346
|
+
Set interval text: .desttier, .j, .label$
|
347
|
+
endif
|
348
|
+
endfor
|
349
|
+
else
|
350
|
+
selectObject: .srcgrid
|
351
|
+
.n = Get number of points: .srctier
|
352
|
+
for .i to .n
|
353
|
+
selectObject: .srcgrid
|
354
|
+
.t = Get time of point: .srctier, .i
|
355
|
+
.label$ = Get label of point: .srctier, .i
|
356
|
+
selectObject: .destgrid
|
357
|
+
Insert point: .desttier, .t, .label$
|
358
|
+
endfor
|
359
|
+
endif
|
360
|
+
endproc
|
361
|
+
|
362
|
+
|
363
|
+
procedure tier_clear: .grid, .tier
|
364
|
+
selectObject: .grid
|
365
|
+
.interval_tier = Is interval tier: .tier
|
366
|
+
if (.interval_tier)
|
367
|
+
.i = Get number of intervals: .tier
|
368
|
+
.i -= 1
|
369
|
+
while (.i > 0)
|
370
|
+
Remove right boundary: .tier, .i
|
371
|
+
.i -= 1
|
372
|
+
endwhile
|
373
|
+
else
|
374
|
+
.n = Get number of points: .tier
|
375
|
+
for .i to .n
|
376
|
+
Remove point: .i
|
377
|
+
endfor
|
378
|
+
endif
|
379
|
+
endproc
|
380
|
+
|
381
|
+
|
382
|
+
procedure tier_clear_text: .grid, .tier
|
383
|
+
selectObject: .grid
|
384
|
+
.interval_tier = Is interval tier: .tier
|
385
|
+
if (.interval_tier)
|
386
|
+
.n = Get number of intervals: .tier
|
387
|
+
for .i from 1 to .n
|
388
|
+
Set interval text: .tier, .i, ""
|
389
|
+
endfor
|
390
|
+
endif
|
391
|
+
endproc
|
392
|
+
|
393
|
+
|
394
|
+
procedure grid_append_tier: .gridin, .tierin, .gridname$
|
395
|
+
# append tier <.tierin> from <.gridin> at end of <.gridname$> by creating a new grid, the ID of which will replace the value of variable <.gridname$>
|
396
|
+
selectObject: .gridin
|
397
|
+
.ok = Is interval tier: .tierin
|
398
|
+
Extract tier: .tierin
|
399
|
+
if (.ok)
|
400
|
+
.tmp = selected ("IntervalTier", -1)
|
401
|
+
else
|
402
|
+
.tmp = selected ("TextTier", -1)
|
403
|
+
endif
|
404
|
+
.grid = '.gridname$'
|
405
|
+
selectObject: .grid, .tmp
|
406
|
+
.tmp2 = Append
|
407
|
+
removeObject: .tmp, .grid
|
408
|
+
'.gridname$' = .tmp2
|
409
|
+
endproc
|
410
|
+
|
411
|
+
|
412
|
+
procedure tier_match_times: .grid, .tier1, .tier2
|
413
|
+
selectObject: .grid
|
414
|
+
.n1 = Get number of intervals: .tier1
|
415
|
+
.n2 = Get number of intervals: .tier2
|
416
|
+
.s1$ = Get tier name: .tier1
|
417
|
+
.s2$ = Get tier name: .tier2
|
418
|
+
.n = min (.n1, .n2)
|
419
|
+
for .i to .n
|
420
|
+
.t1 = Get start point: .tier1, .i
|
421
|
+
.t2 = Get start point: .tier2, .i
|
422
|
+
if (.t1 <> .t2)
|
423
|
+
printline Comparing times in tiers '.s1$' and '.s2$': first mismatch at time '.t1:3'
|
424
|
+
.i = .n
|
425
|
+
endif
|
426
|
+
endfor
|
427
|
+
endproc
|
428
|
+
|
429
|
+
|
430
|
+
procedure next_field: .s$
|
431
|
+
# Get next field form a string with comma-separated fields.
|
432
|
+
# Return success in <result>, return field in <result2$>, return rest of string in <result3$>
|
433
|
+
result = 0
|
434
|
+
result2$ = ""
|
435
|
+
.s$ = replace_regex$(.s$, "^ ", "", 0); ; ltrim input
|
436
|
+
.len = length (.s$)
|
437
|
+
if (.len > 0)
|
438
|
+
.pos = index (.s$, ",")
|
439
|
+
if (.pos = 0)
|
440
|
+
result3$ = ""
|
441
|
+
else
|
442
|
+
result3$ = right$ (.s$, .len-.pos) ; rest of strings
|
443
|
+
.s$ = left$ (.s$, .pos-1)
|
444
|
+
.len = length (.s$)
|
445
|
+
endif
|
446
|
+
.s$ = replace_regex$(.s$, "^ *", "", 0); ; ltrim input
|
447
|
+
.s$ = replace_regex$(.s$, " *$", "", 0); ; rtrim input
|
448
|
+
if (length (.s$) == 0)
|
449
|
+
result = 0
|
450
|
+
else
|
451
|
+
result = 1
|
452
|
+
result2$ = .s$
|
453
|
+
endif
|
454
|
+
endif
|
455
|
+
endproc
|
456
|
+
|
457
|
+
|
458
|
+
procedure next_line: stringname$, varname$
|
459
|
+
# Get next line form a string in variable named <stringname>
|
460
|
+
# Return line in variable named <varname$> and remainder of string in variable named <stringname$>
|
461
|
+
.text$ = 'stringname$'$
|
462
|
+
.len = length(.text$)
|
463
|
+
.i = index(.text$, newline$)
|
464
|
+
if (.i = 0)
|
465
|
+
.i = .len
|
466
|
+
endif
|
467
|
+
'varname$'$ = left$(.text$, .i)
|
468
|
+
'stringname$'$ = right$(.text$, .len-.i)
|
469
|
+
.text$ = ""
|
470
|
+
endproc
|
471
|
+
|
472
|
+
|
473
|
+
procedure is_number: .s$
|
474
|
+
result = extractNumber(.s$, "")
|
475
|
+
if (result == undefined)
|
476
|
+
result = 0
|
477
|
+
else
|
478
|
+
result = 1
|
479
|
+
endif
|
480
|
+
endproc
|
481
|
+
|
482
|
+
|
483
|
+
procedure convert_Hz_ST: .objectID
|
484
|
+
# Convert a PitchTier from Hz values to ST scale, relative to 1 Hz
|
485
|
+
.yoffset = hertzToSemitones(1)
|
486
|
+
selectObject: .objectID
|
487
|
+
.n = Get number of points
|
488
|
+
for .i from 1 to .n
|
489
|
+
.x = Get time from index: .i
|
490
|
+
.y = Get value at index: .i
|
491
|
+
Remove point: .i
|
492
|
+
Add point: .x, hertzToSemitones(.y) - .yoffset
|
493
|
+
endfor
|
494
|
+
endproc
|
495
|
+
|
496
|
+
|
497
|
+
procedure convert_ST_Hz: .objectID
|
498
|
+
# Convert a PitchTier from ST values (relative to 1 Hz) to Hz values
|
499
|
+
.yoffset = hertzToSemitones(1)
|
500
|
+
selectObject: .objectID
|
501
|
+
.n = Get number of points
|
502
|
+
for .i from 1 to .n
|
503
|
+
.x = Get time from index: .i
|
504
|
+
.y = Get value at index: .i
|
505
|
+
Remove point: .i
|
506
|
+
Add point: .x, semitonesToHertz(.y + .yoffset)
|
507
|
+
endfor
|
508
|
+
endproc
|
509
|
+
|
510
|
+
|
511
|
+
procedure from_ST_rel_1_to_Hz: .value
|
512
|
+
result = semitonesToHertz(.value + hertzToSemitones(1))
|
513
|
+
endproc
|
514
|
+
|
515
|
+
|
516
|
+
procedure from_Hz_to_ST_rel_1: .value
|
517
|
+
result = hertzToSemitones(.value) - hertzToSemitones(1)
|
518
|
+
endproc
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
# ------------------------------ Messages ------------------------------ #
|
523
|
+
|
524
|
+
|
525
|
+
procedure logging: .option$, logfile$
|
526
|
+
# Write messages (calls to: msg, debug_msg, time_msg, error_msg, fatal_error) to logfile.
|
527
|
+
# Options:
|
528
|
+
# "reset" resets the logfile (whereas otherwise new messages are appended to the logfile, if it exists)
|
529
|
+
# "timed" selects the output format where timing information is added to the message
|
530
|
+
# "noinfo" suppresses output to Info window and writes messages to logfile only.
|
531
|
+
# "debug" enables debug messages (debug_msg).
|
532
|
+
# "nodebug" disables debug messages (debug_msg).
|
533
|
+
logging = 1
|
534
|
+
logging_timed = 0
|
535
|
+
logging_noinfo = 0
|
536
|
+
if (index (.option$, "timed"))
|
537
|
+
logging_timed = 1
|
538
|
+
endif
|
539
|
+
if (index (.option$, "reset"))
|
540
|
+
filedelete 'logfile$'
|
541
|
+
endif
|
542
|
+
if (index (.option$, "noinfo"))
|
543
|
+
logging_noinfo = 1
|
544
|
+
endif
|
545
|
+
if (index (.option$, "nodebug"))
|
546
|
+
logging_debug = 0
|
547
|
+
@msg: "Logging to 'logfile$' stopped"
|
548
|
+
elsif (index (.option$, "debug"))
|
549
|
+
logging_debug = 1
|
550
|
+
@msg: "Logging to 'logfile$' started"
|
551
|
+
else
|
552
|
+
logging_debug = 0
|
553
|
+
endif
|
554
|
+
endproc
|
555
|
+
|
556
|
+
|
557
|
+
procedure msg: .message$
|
558
|
+
if (variableExists ("logging"))
|
559
|
+
if (logging)
|
560
|
+
if (logging_timed)
|
561
|
+
.date$ = date$ ()
|
562
|
+
appendFileLine: logfile$, "'tab$'@ '.date$'"
|
563
|
+
endif
|
564
|
+
appendFileLine: logfile$, .message$
|
565
|
+
if (not logging_noinfo)
|
566
|
+
appendInfoLine: .message$
|
567
|
+
endif
|
568
|
+
else
|
569
|
+
appendInfoLine: .message$
|
570
|
+
endif
|
571
|
+
else
|
572
|
+
appendInfoLine: .message$
|
573
|
+
endif
|
574
|
+
endproc
|
575
|
+
|
576
|
+
|
577
|
+
procedure debug_msg: .message$
|
578
|
+
if (variableExists ("logging_debug"))
|
579
|
+
if (logging_debug)
|
580
|
+
@msg: "*** DEBUG *** " + .message$
|
581
|
+
endif
|
582
|
+
endif
|
583
|
+
endproc
|
584
|
+
|
585
|
+
|
586
|
+
procedure time_msg: .message$
|
587
|
+
.date$ = date$ ()
|
588
|
+
@msg: "'.date$' '.message$'"
|
589
|
+
endproc
|
590
|
+
|
591
|
+
|
592
|
+
procedure error_msg: .message$
|
593
|
+
@msg: "*** ERROR *** '.message$'"
|
594
|
+
endproc
|
595
|
+
|
596
|
+
|
597
|
+
procedure fatal_error: .message$
|
598
|
+
@msg: "*** FATAL ERROR *** '.message$'"
|
599
|
+
exit
|
600
|
+
endproc
|
601
|
+
|
602
|
+
|
603
|
+
# ------------------------------ Miscellaneous ------------------------------ #
|
604
|
+
|
605
|
+
|
606
|
+
procedure toggle: varname$
|
607
|
+
if ('varname$' == 0)
|
608
|
+
'varname$' = 1
|
609
|
+
else
|
610
|
+
'varname$' = 0
|
611
|
+
endif
|
612
|
+
endproc
|
613
|
+
|
614
|
+
|
615
|
+
procedure steps_012: varname$
|
616
|
+
.v = 'varname$'
|
617
|
+
if (.v >= 2)
|
618
|
+
.v = 0
|
619
|
+
else
|
620
|
+
.v += 1
|
621
|
+
endif
|
622
|
+
'varname$' = .v
|
623
|
+
endproc
|
624
|
+
|
625
|
+
|
626
|
+
procedure play_part: .objectID, .t1, .t2
|
627
|
+
selectObject: .objectID
|
628
|
+
.tmpsoundID = Extract part: .t1, .t2, "Rectangular", 1.0, "yes"
|
629
|
+
Play
|
630
|
+
removeObject: .tmpsoundID
|
631
|
+
endproc
|
632
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
pelican_nlp/__init__.py,sha256=TD5xjKeXXAH6nUWG-6igbClgovi5r8RIEqI_ix1QeYo,204
|
2
|
-
pelican_nlp/_version.py,sha256=
|
2
|
+
pelican_nlp/_version.py,sha256=7YeBgSVj8ydF7tymPSFdq22NONiQoBjKL1iwcxp4TJo,21
|
3
3
|
pelican_nlp/cli.py,sha256=KBGHRwzZ0rXjK6liyicPQFY6iVpkQsjPmxMQ2UmjQcc,1221
|
4
4
|
pelican_nlp/config.py,sha256=ueVFs2ioz5Ul2oD9UUZH3mTTl9L9mUj_RFS0BG0X7WY,442
|
5
5
|
pelican_nlp/main.py,sha256=X9eysIIM3_nsVGQfpdquIzy8z9jR-rzCCRVa2wEvomY,12292
|
@@ -50,6 +50,15 @@ pelican_nlp/extraction/test_documents/wallace_1.1_3.txt,sha256=gs5REE10myK3Nm9JB
|
|
50
50
|
pelican_nlp/extraction/test_documents/wallace_1_4.txt,sha256=95Z7gS92KERCocrbOAFbJntf5QoE-6p0GL67XQEffqI,3963
|
51
51
|
pelican_nlp/metrics_statistics/embeddings_metrics_statistics.py,sha256=svXXyLEA62mLa0KUfSiOSFFMjYk17K7BJbxUoLf0l9w,1468
|
52
52
|
pelican_nlp/praat/__init__.py,sha256=uSEaUZ2nw7lH0twbRJL5BltJTJpopj5XCVhIbeM42bg,1035
|
53
|
+
pelican_nlp/praat/eps_conv.praat,sha256=vrz4Q1A-uALiWiqOnueh8kS-wtbTI5AIMjLEBffNuOc,6285
|
54
|
+
pelican_nlp/praat/polytonia.praat,sha256=We3D9R42p-IIWg8p07QOxIRUPWC_PGw9VOV7eboAkIc,35486
|
55
|
+
pelican_nlp/praat/prosogram.praat,sha256=HVVtQDd5Z4cmb5WV5w9sVITEmKGvDiJ5UvwqsrJzMj0,3771
|
56
|
+
pelican_nlp/praat/prosomain.praat,sha256=_POzN9LzCJC4kFYMiLk7Ox4ZCoMbRyvuDDD98CZrOrU,147297
|
57
|
+
pelican_nlp/praat/prosoplot.praat,sha256=g0jNwGl5y4iHAgk51pEEs2FzoLNwa-7CZHlRtqWp2zE,60545
|
58
|
+
pelican_nlp/praat/segment.praat,sha256=HPUjb7vsrpScfNN-LBMxzn9R7yTtpN_4zIyWToOvp3g,45051
|
59
|
+
pelican_nlp/praat/setup.praat,sha256=6iuegzNaru0fCykF5Giy8Zzj4Aegel7xlakY7JtjnD0,79
|
60
|
+
pelican_nlp/praat/stylize.praat,sha256=Yhssxo78VDHjrfO9mNDv-RNeFyrDcavzwvS-BwNvzxA,114713
|
61
|
+
pelican_nlp/praat/util.praat,sha256=yxO0mM5XbI4NS5vQSLBFGWiWGw7zi5LE3w3EeHbWRRY,18338
|
53
62
|
pelican_nlp/preprocessing/LPDS.py,sha256=xTJ_3bbt2Kmezb6GaCMW-X-E-1t9FzuTF1ZAkHXmvRQ,4319
|
54
63
|
pelican_nlp/preprocessing/__init__.py,sha256=Du35Ybs7yNRC-oKWnRHg5Xe5MEGONTRx_JnIuQyUK6A,349
|
55
64
|
pelican_nlp/preprocessing/pipeline.py,sha256=RBKJSDtpeqeAl5nt5qfJfyNGzKePR-1sFRfgehcSsjY,1800
|
@@ -116,9 +125,9 @@ pelican_nlp/utils/unittests/examples/example_image-descriptions/participants/par
|
|
116
125
|
pelican_nlp/utils/unittests/examples/example_image-descriptions/participants/part-01/ses-02/image-description/part-01_ses-02_task-imgdesc_acq-placebo_transcript.docx,sha256=PCq2yOzkbM6dm6trlIcYR06LZfTjf23naQlyFKrsiL4,9265
|
117
126
|
pelican_nlp/utils/unittests/examples/example_image-descriptions/participants/part-02/ses-01/image-description/part-02_ses-01_task-imgdesc_acq-drug_transcript.docx,sha256=AL6N4Wfz778OHqGaX9tGwGw8S-FV2GoPJnpXi-zbj-4,9104
|
118
127
|
pelican_nlp/utils/unittests/examples/example_image-descriptions/participants/part-02/ses-01/image-description/part-02_ses-01_task-imgdesc_acq-placebo_transcript.docx,sha256=7PzVm3Byi_cMvfhP0msggtUE7dvO9Gav2WgcGU0Ipb4,12458
|
119
|
-
pelican_nlp-0.3.
|
120
|
-
pelican_nlp-0.3.
|
121
|
-
pelican_nlp-0.3.
|
122
|
-
pelican_nlp-0.3.
|
123
|
-
pelican_nlp-0.3.
|
124
|
-
pelican_nlp-0.3.
|
128
|
+
pelican_nlp-0.3.9.dist-info/licenses/LICENSE,sha256=m3jshBZIXKiBX6qhmhtJcLTVJ1N6BEkQGIflneXvpYg,19336
|
129
|
+
pelican_nlp-0.3.9.dist-info/METADATA,sha256=pAC8HHv59-_q59yTU7_FELbCPtQSZauy1cbWnFUEC7Q,7556
|
130
|
+
pelican_nlp-0.3.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
131
|
+
pelican_nlp-0.3.9.dist-info/entry_points.txt,sha256=znlG0paAfju9P10UM3rm5HcCHoj4tarTllNpeaqH_gc,53
|
132
|
+
pelican_nlp-0.3.9.dist-info/top_level.txt,sha256=F0qlyqy5FCd3sTS_npUYPeLKN9_BZq6wD4qo9pI0xbg,12
|
133
|
+
pelican_nlp-0.3.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|