fetching and splitting the verse

This commit is contained in:
github_username_here
2026-02-27 17:53:14 +01:00
parent 52ce0f6db1
commit 92b7c5ecab
7 changed files with 369 additions and 0 deletions

48
main.go Normal file
View File

@@ -0,0 +1,48 @@
package main
import(
"log"
"os"
"strings"
)
func loadExclude(path string) (map[string]struct{}, error) {
b, err := os.ReadFile(path)
if err != nil { return nil, err }
m := make(map[string]struct{})
for _, line := range strings.Split(string(b), "\n") {
w := strings.TrimSpace(line)
if w == "" || strings.HasPrefix(w, "#") { continue }
m[w] = struct{}{}
}
return m, nil
}
func main (){
properName, err:= loadExclude("properName.txt")
if err != nil{
log.Printf("cant open the proper names file")
os.Exit(1)
}
book := "Psaumes"
searchedChapter := "2"
version := "LSG"
Chapter, err := fetchChapter(book, searchedChapter, version)
if err != nil {
log.Printf("GET %s %s %s failed\n", book, searchedChapter, version)
os.Exit(1)
}
Chapter = stripAlternativeVersification(Chapter)
for i, verse := range Chapter.verses{
log.Printf("==== Verse: %v ====", i+1)
splitInPart(verse, properName)
}
os.Exit(0)
}