Armored decision parsing more
This commit is contained in:
parent
0d44120a63
commit
72ba9ac98f
|
@ -0,0 +1 @@
|
||||||
|
*.swp
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Paper represents a single academic paper
|
// Paper represents a single academic paper
|
||||||
|
@ -200,13 +199,14 @@ Abstract: %s`, criteria, paper.Title, paper.Abstract)
|
||||||
// Clean and normalize decision
|
// Clean and normalize decision
|
||||||
rawDecision := strings.TrimSpace(decisionLine)
|
rawDecision := strings.TrimSpace(decisionLine)
|
||||||
|
|
||||||
// Remove "DECISION:" prefix if present and trim non-alphabetic characters
|
// Handle common prefixes and clean the decision text
|
||||||
cleanDecision := strings.TrimPrefix(rawDecision, "DECISION:")
|
cleanDecision := rawDecision
|
||||||
cleanDecision = strings.TrimFunc(cleanDecision, func(r rune) bool {
|
for _, prefix := range []string{"DECISION:", "Decision:"} {
|
||||||
return !unicode.IsLetter(r) && !unicode.IsNumber(r)
|
cleanDecision = strings.TrimPrefix(cleanDecision, prefix)
|
||||||
})
|
}
|
||||||
|
cleanDecision = strings.TrimSpace(cleanDecision)
|
||||||
|
|
||||||
// Normalize case and check for valid decision
|
// Normalize case
|
||||||
upperDecision := strings.ToUpper(cleanDecision)
|
upperDecision := strings.ToUpper(cleanDecision)
|
||||||
var decision string
|
var decision string
|
||||||
switch {
|
switch {
|
||||||
|
|
Loading…
Reference in New Issue