package main import( "log" "regexp" "strings" "unicode" "unicode/utf8" ) func stripAlternativeVersification(rawChapter chapter) chapter{ regExp:=regexp.MustCompile(`\(\d+:\d+\)`) var treatedChapter chapter for _, verse := range rawChapter.verses{ modifiedVerse := string(regExp.ReplaceAll([]byte(verse), []byte(""))) log.Printf("%v\n", modifiedVerse) treatedChapter.verses = append(treatedChapter.verses, modifiedVerse) } return treatedChapter } func splitInPart(verse string, properName map[string]struct{})(){ currentPart := "" words := strings.Split(strings.TrimSpace(verse), " ") wordsCount := len(words) isTreated := false for i :=0 ; i < wordsCount ; i++{ word := words[i] r, _ := utf8.DecodeRuneInString(word) trimedWord := strings.TrimRight(word, ".,") _, isProperName := properName[trimedWord] if i != 0 && unicode.IsUpper(r) && !isProperName{ log.Printf("%s", currentPart) currentPart = word isTreated = true }else{ currentPart += " " + word isTreated = false } } if !isTreated { log.Printf("%s", currentPart) } }