MCPcopy Create free account
hub / github.com/Qinbf/groundmap / normNum

Function normNum

tools/debug-console/lib/verify-citations.ts:67–73  ·  view source on GitHub ↗

归一:全角数字→半角、去千分位逗号、percent→%、小写。

(s: string)

Source from the content-addressed store, hash-verified

65
66/** 归一:全角数字→半角、去千分位逗号、percent→%、小写。 */
67function normNum(s: string): string {
68 return s
69 .replace(/[0-9]/g, (c) => "0123456789"["0123456789".indexOf(c)])
70 .replace(/(\d),(?=\d{3}(\D|$))/g, "$1")
71 .replace(/percent/gi, "%")
72 .toLowerCase();
73}
74
75interface NumTokens {
76 strong: Set<string>; // 具体数字/日期/百分比/量级(不含裸年份)

Callers 1

hardNumericTokensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected