'Count number of syllables (vowel clusters) in a string R
I have a variable in a df that contains sentences in Norweigan. I need to mutate a new column no_syls which counts how many syllables there are. The problem is that there are diphthongs (vowel clusters) which need to count as one syllable, and existing functions like from the sylcount library abort my R session (probably because the df is very very large). Does anyone know a quick and simple way to count the vowel clusters?
Below is a working example of what I'd like to make. Norwegian contains the following vowels aoeuiyæøå. Norwegian contains few to no silent vowels, those that occur, we'll just ignore.
Edit: a slight complication -- <ée>-sequences represent separate syllables like in the updated minimal working example below.
example_df <- data.frame("Tekst" = c("en", "fleire stavingar", "enda eit døme med nokre andre diftongar: øy, ei, au, osb.", "komitéen"),
"No_syls" = c(1, 5, 17, 4))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
