Debian Codegraph @

generate/Corpus CGN/createRegion.praat

raw
1 # file "Corpus CGN/createRegion.praat"
2 # Paul Boersma, 21 August 2026
3
4 regionCodes$# = { "regN1a", "regN1b", "regN1c", "regN2a", "regN2b", "regN2c", "regN2d", "regN2e", "regN2f",
5 ... "regN3a", "regN3b", "regN3c", "regN3d", "regN3e", "regN4a", "regN4b", "regNx",
6 ... "regV1", "regV2", "regV3", "regV4", "regVx", "regW", "regZ", "regX" }
7
8 regions_short$# = { "S-Holland", "N-Holland", "W-Utrecht", "Zeeland", "E-Utrecht", "Guelders", "Veluwe", "W-Friesland", "Polders",
9 ... "Achterhoek", "Overijssel", "Drenthe", "Groningen", "Frisia", "N-Brabant", "E-Limburg", "Netherlands",
10 ... "S-Brabant", "E-Flanders", "W-Flanders", "W-Limburg", "N-Belgium", "S-Belgium", "reg_other", "reg_unknown" }
11
12 regions_long$# = {
13 ... "South Holland (province of Zuid-Holland excl. Goeree-Overflakkee)",
14 ... "North Holland (province of Noord-Holland excl. West-Friesland)",
15 ... "West Utrecht (province of Utrecht, Western part incl. the city of Utrecht)",
16 ... "Zeeland (province of Zeeland, plus Goeree-Overflakkee)",
17 ... "East Utrecht (province of Utrecht, Eastern part excl. the city of Utrecht)",
18 ... "Guelders river area (province of Gelderland, Southern part incl. Arnhem en Nijmegen)",
19 ... "Veluwe (province of Gelderland, Northern part West of the IJssel river)",
20 ... "West-Friesland (part of the province of Noord-Holland",
21 ... "Polders (province of Flevoland)",
22 ... "Achterhoek (province of Gelderland, Eastern part)",
23 ... "Overijssel (province of Overijssel)",
24 ... "Drenthe (province of Drenthe)",
25 ... "Groningen (province of Groningen)",
26 ... "Frisia (province of Fryslân)",
27 ... "North Brabant (province of Noord-Brabant",
28 ... "East Limburg (Dutch province of Limburg)",
29 ... "unknown region in the Netherlands",
30 ... "South Brabant (provinces of Antwerpen and Brabant (Northern part)",
31 ... "East Flanders (province of Oost-Vlaanderen)",
32 ... "West Flanders (province of West-Vlaanderen",
33 ... "West Limburg (Belgian province of Limburg)",
34 ... "unknown region in North Belgium",
35 ... "South Belgium (Wallonia)",
36 ... "region outside Belgium and the Netherlands",
37 ... "unknown region" }
38
39 numberOfRegions = size (regionCodes$#)
40 assert size (regions_short$#) = numberOfRegions
41 assert size (regions_long$#) = numberOfRegions
42
43 imdiFolder$ = "/Volumes/CGN_2.0.3/data/meta/imdi/corpora"
44 table = Create Table with column names: "regionTable", 0, { "code", "short", "recording" }
45 numberOfRows = 0
46 for iregion to numberOfRegions
47 regionCode$ = regionCodes$# [iregion]
48 if regionCode$ <> "regW"
49 lines$# = readLinesFromFile$#: imdiFolder$ + "/" + regionCodes$# [iregion] + ".imdi"
50 for iline to size (lines$#)
51 line$ = lines$# [iline]
52 if left$ (line$, 18) = “<CorpusLink Name="”
53 recording$ = mid$ (line$, 19, 8)
54 numberOfRows += 1
55 Append row
56 Set string value: numberOfRows, "code", regionCode$
57 Set string value: numberOfRows, "short", regions_short$# [iregion]
58 Set string value: numberOfRows, "recording", recording$
59 endif
60 endfor
61 endif
62 endfor
63 Sort rows: { "recording" }