Harden item occurrence grounding
This commit is contained in:
@@ -9,10 +9,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/unicode/norm"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/shared"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -52,17 +50,7 @@ func NormalizeDisplay(value string) string {
|
||||
|
||||
// ComparisonKey returns the stable key used for NPC identity comparisons.
|
||||
func ComparisonKey(value string) string {
|
||||
value = norm.NFKC.String(value)
|
||||
value = strings.Map(func(r rune) rune {
|
||||
switch r {
|
||||
case '\u2018', '\u2019', '\u02bc':
|
||||
return '\''
|
||||
default:
|
||||
return r
|
||||
}
|
||||
}, value)
|
||||
value = strings.Join(strings.Fields(value), " ")
|
||||
return cases.Fold().String(value)
|
||||
return shared.ComparisonKey(value)
|
||||
}
|
||||
|
||||
// DeriveID returns the deterministic ID for a canonical NPC name. Empty
|
||||
|
||||
Reference in New Issue
Block a user