Armored decision parsing more

This commit is contained in:
Steve White 2025-01-26 14:23:24 -06:00
parent 0d44120a63
commit 72ba9ac98f
2 changed files with 8 additions and 7 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.swp

View File

@ -8,7 +8,6 @@ import (
"net/http"
"strings"
"time"
"unicode"
)
// Paper represents a single academic paper
@ -200,13 +199,14 @@ Abstract: %s`, criteria, paper.Title, paper.Abstract)
// Clean and normalize decision
rawDecision := strings.TrimSpace(decisionLine)
// Remove "DECISION:" prefix if present and trim non-alphabetic characters
cleanDecision := strings.TrimPrefix(rawDecision, "DECISION:")
cleanDecision = strings.TrimFunc(cleanDecision, func(r rune) bool {
return !unicode.IsLetter(r) && !unicode.IsNumber(r)
})
// Handle common prefixes and clean the decision text
cleanDecision := rawDecision
for _, prefix := range []string{"DECISION:", "Decision:"} {
cleanDecision = strings.TrimPrefix(cleanDecision, prefix)
}
cleanDecision = strings.TrimSpace(cleanDecision)
// Normalize case and check for valid decision
// Normalize case
upperDecision := strings.ToUpper(cleanDecision)
var decision string
switch {