You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
564 B
14 lines
564 B
import type { MothershipAddressCandidate } from "@/lib/frontend/types";
|
|
import { sortMothershipCandidatesForDraft } from "@/lib/address/street-normalize";
|
|
|
|
/** 从候选列表中按门牌号/城市/街道词打分,避免误选 Bridge 等歧义项 */
|
|
export function pickBestMothershipCandidate(
|
|
candidates: MothershipAddressCandidate[],
|
|
draft: { street: string; city: string; state: string },
|
|
): MothershipAddressCandidate | undefined {
|
|
if (!candidates.length) {
|
|
return undefined;
|
|
}
|
|
return sortMothershipCandidatesForDraft(candidates, draft)[0];
|
|
}
|