#-*- coding: utf-8 -*- ''' Created on Oct 21, 2016 Syllable counter for Swedish words @author: David ''' import re def count_syllables(word): ''' Return number of syllables in a Swedish word. Syllables are counted as number of vowels except vowel combinations with 'u' (eu,au,...) which are counted as one syllable ''' return len(re.findall("[aeioäöå]|[^aeioäöå]u|^u", word)) if __name__ == '__main__': print(count_syllables("stjärnan"))