refactoring project structure

This commit is contained in:
github_username_here
2026-02-28 17:21:56 +01:00
parent 92b7c5ecab
commit 8fdf7c190a
5 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
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)
}
}