Last active
May 31, 2023 12:30
-
-
Save AkselA/0c8285d02b10e71e7151b58835abbbc8 to your computer and use it in GitHub Desktop.
Calculating pronunciation success rate per vowel in consonant-vowel words (Norwegian)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d <- "Date Word Pr. Corr. | |
19.01.23 py pwæ 0 | |
19.01.23 ka ka 1 | |
19.01.23 li li 1 | |
19.01.23 se sæ 0 | |
19.01.23 ba bae 0 | |
19.01.23 ju djul 0 | |
19.01.23 ty tæ 0 | |
19.01.23 pi pi 1 | |
19.01.23 se si 0 | |
19.01.23 kø kå 0 | |
19.01.23 mæ mæ 1 | |
19.01.23 hu hå 0 | |
10.02.23 na nø 0 | |
10.02.23 pæ pø 0 | |
10.02.23 læ lø 0 | |
10.02.23 ke ke 1 | |
10.02.23 vu væ 0 | |
10.02.23 hu hå 0 | |
10.02.23 tø tø 1 | |
10.02.23 jo jå 0 | |
10.02.23 li lø 0 | |
10.02.23 vo vu 0 | |
10.02.23 si si 1 | |
10.02.23 ji ji 1 | |
10.02.23 le la 0 | |
10.02.23 pa pa 1 | |
10.02.23 væ væ 1 | |
20.02.23 je dje 0 | |
20.02.23 gø gjø 0 | |
20.02.23 fi fi 1 | |
20.02.23 ve ve 1 | |
20.02.23 sa sæ 0 | |
20.02.23 rø rø 1 | |
20.02.23 ræ ræ 1 | |
20.02.23 gi gji 0 | |
20.02.23 tå tæ 0 | |
20.02.23 vø vå 0 | |
20.02.23 ræ ræ 1 | |
20.02.23 me me 1 | |
21.03.23 på då 0 | |
21.03.23 sy sæ 0 | |
21.03.23 lo ly 0 | |
21.03.23 læ læ 1 | |
21.03.23 ko gå 0 | |
21.03.23 ji dji 0 | |
21.03.23 må mæ 0 | |
21.03.23 kæ kæ 1 | |
21.03.23 go gø 0 | |
21.03.23 me me 1 | |
21.03.23 mæ mæ 1 | |
21.03.23 hå hå 1 | |
30.05.23 ra ra 1 | |
30.05.23 po på 0 | |
30.05.23 sy sy 1 | |
30.05.23 ru roo 0 | |
30.05.23 lø lå 0 | |
30.05.23 bu bu 1 | |
30.05.23 pæ pæ 1 | |
30.05.23 lø lø 1 | |
30.05.23 ki ki 1 | |
30.05.23 da da 1 | |
30.05.23 hu hue 0 | |
30.05.23 no no 1 | |
30.05.23 ti ti 1 | |
30.05.23 ki ki 1 | |
30.05.23 ni ni 1 | |
30.05.23 læ læ 1 | |
30.05.23 dø då 0 | |
30.05.23 jø djå 0 | |
30.05.23 jo djå 0 | |
30.05.23 lå læ 0" | |
aree <- read.table(text=d, sep="\t", header=TRUE) | |
aree$Date <- as.Date(aree$Date, format="%d.%m.%y") | |
str(aree) | |
vowels <- strsplit("aeiouyæøå", "")[[1]] | |
cons <- strsplit("bcdfghjklmnpqrstvwxz", "")[[1]] | |
getv <- function(x) {gsub("[^aeiouyæøå]", "", x)} | |
word.vowels <- getv(aree[, "Word"]) | |
corr.vowel <- word.vowels == getv(aree[, "Pr."]) | |
inc.vowel <- !corr.vowel | |
table(word.vowels) | |
vowels[sort(match(unique(sample(vowels, 7)), vowels))] | |
# Often correct | |
corr.vowel.t <- table(factor(getv(aree[corr.vowel, "Word"]), vowels)) | |
# Often incorrect | |
inc.vowel.t <- table(factor(getv(aree[inc.vowel, "Word"]), vowels)) | |
# Percent correct | |
p.corr.vowel <- 100*corr.vowel.t/(corr.vowel.t+inc.vowel.t) | |
barplot(p.corr.vowel, ylim=c(0, 100), col=1, space=1, | |
main="Percentage correct pronunciation per vowel") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment