package address import "strings" // streetKey builds the canonical, city-aware, type-independent street key: // // "||" // // The city is part of the key so that "Ленина" in Novosibirsk and "Ленина" in // Berdsk are different streets. The type word is dropped so that a user who // omits it ("станционная 1" instead of "Станционная улица 1") still matches; // type confusion is surfaced later as ambiguity. // // None of the components may contain "|": NormalizeText folds all punctuation // that could appear in a name into spaces, and ordinals are digits only. func streetKey(cityKey, ordinal, nameKey string) string { return cityKey + "|" + ordinal + "|" + nameKey } // normalizeOrdinal trims leading zeros so "02-я" and "2-я" agree. func normalizeOrdinal(s string) string { return trimLeadingZeros(strings.TrimSpace(s)) }