Repository navigation
Expand file tree
/
Copy pathTOKENS_SCRIPT.praat
More file actions
56 lines (36 loc) · 1.48 KB
/
Copy pathTOKENS_SCRIPT.praat
File metadata and controls
56 lines (36 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Extracting the tokens
form Get Tokens
sentence Directory F:\Politecnico University\Semester 3 (March - July 2015)\NLP\Assignment\Dataset-test
comment If you want to analyse all the files, leave this blank
word Base_file_name
comment The name of result file
text textfile TEXT.txt
endform
#Read all files in a folder
clearinfo
Create Strings as file list... gridlist 'directory$'/'base_file_name$'*.TextGrid
number_of_files = Get number of strings
for x to number_of_files
select Strings gridlist
current_file$ = Get string... x
printline 'current_file$'
fileappend "'textfile$'" 'current_file$''tab$'
fileappend "'textfile$'" 'newline$'
Read from file... 'directory$'/'current_file$'
textgridID = selected ("TextGrid")
select textgridID
numintervals = Get number of intervals... 1
for curint to numintervals
select textgridID
label$ = Get label of interval... 1 'curint'
if (label$ <> "") and (label$ <> "#")and (label$ <> "# ")and (label$ <> "# ")and (label$ <> "<now> ")and (label$ <> "<now>")
resultline$ = "'label$''tab$'"
fileappend "'textfile$'" 'resultline$'
endif
endfor
fileappend "'textfile$'" 'newline$'
fileappend "'textfile$'" 'newline$'
endfor
# clean up
select Strings gridlist
Remove