mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-12-01 01:05:30 +08:00
test: 暂存代码
This commit is contained in:
1 parent
17417aa9d6
commit
4967cff3c0
43 files changed
+9978
-512
No files matched your search
@@ -0,0 +1,38 @@
|
||||
export type ContactResolutionMatch = 'exact' | 'normalized' | 'alias' | 'fuzzy'
|
||||
|
||||
export interface ContactResolutionCandidate {
|
||||
conversationId: string
|
||||
displayName: string
|
||||
matchedBy: ContactResolutionMatch
|
||||
confidence: number
|
||||
}
|
||||
|
||||
export interface ContactResolutionResult {
|
||||
matched: boolean
|
||||
personId?: string
|
||||
conversationId?: string
|
||||
canonicalName?: string
|
||||
displayName?: string
|
||||
matchedBy?: ContactResolutionMatch
|
||||
confidence: number
|
||||
candidates: ContactResolutionCandidate[]
|
||||
ambiguous: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Identity-only canonicalization. It deliberately does not use substring
|
||||
* matching: callers may use a separate UI-filter policy for broad discovery,
|
||||
* but identity resolution must never turn 张三 into 张三丰.
|
||||
*/
|
||||
export const normalizeContactName = (value: string): string =>
|
||||
String(value || '')
|
||||
.normalize('NFKC')
|
||||
.toLocaleLowerCase()
|
||||
.replace(/[\p{White_Space}\p{P}\p{S}_]+/gu, '')
|
||||
|
||||
export const emptyContactResolution = (): ContactResolutionResult => ({
|
||||
matched: false,
|
||||
confidence: 0,
|
||||
candidates: [],
|
||||
ambiguous: false
|
||||
})
|
||||
Reference in new issue
Block a user