@mailwoman/core 5.9.0 → 5.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/chromium-i18n/ssl-address/AC.json +2 -2
- package/data/chromium-i18n/ssl-address/AD.json +8 -8
- package/data/chromium-i18n/ssl-address/AE.json +8 -8
- package/data/chromium-i18n/ssl-address/AF.json +2 -2
- package/data/chromium-i18n/ssl-address/AG.json +1 -1
- package/data/chromium-i18n/ssl-address/AI.json +2 -2
- package/data/chromium-i18n/ssl-address/AL.json +2 -2
- package/data/chromium-i18n/ssl-address/AM.json +8 -8
- package/data/chromium-i18n/ssl-address/AO.json +1 -1
- package/data/chromium-i18n/ssl-address/AQ.json +1 -1
- package/data/chromium-i18n/ssl-address/AR.json +8 -8
- package/data/chromium-i18n/ssl-address/AS.json +6 -6
- package/data/chromium-i18n/ssl-address/AT.json +3 -3
- package/data/chromium-i18n/ssl-address/AU.json +13 -13
- package/data/chromium-i18n/ssl-address/AW.json +1 -1
- package/data/chromium-i18n/ssl-address/AX.json +4 -4
- package/data/chromium-i18n/ssl-address/AZ.json +3 -3
- package/data/chromium-i18n/ssl-address/BA.json +2 -2
- package/data/chromium-i18n/ssl-address/BB.json +3 -3
- package/data/chromium-i18n/ssl-address/BD.json +3 -3
- package/data/chromium-i18n/ssl-address/BE.json +3 -3
- package/data/chromium-i18n/ssl-address/BF.json +1 -6
- package/data/chromium-i18n/ssl-address/BG.json +3 -3
- package/data/chromium-i18n/ssl-address/BH.json +3 -3
- package/data/chromium-i18n/ssl-address/BI.json +1 -1
- package/data/chromium-i18n/ssl-address/BJ.json +1 -1
- package/data/chromium-i18n/ssl-address/BL.json +4 -4
- package/data/chromium-i18n/ssl-address/BM.json +3 -3
- package/data/chromium-i18n/ssl-address/BN.json +3 -3
- package/data/chromium-i18n/ssl-address/BO.json +1 -1
- package/data/chromium-i18n/ssl-address/BQ.json +1 -1
- package/data/chromium-i18n/ssl-address/BR.json +13 -13
- package/data/chromium-i18n/ssl-address/BS.json +5 -5
- package/data/chromium-i18n/ssl-address/BT.json +3 -3
- package/data/chromium-i18n/ssl-address/BV.json +1 -1
- package/data/chromium-i18n/ssl-address/BW.json +1 -1
- package/data/chromium-i18n/ssl-address/BY.json +4 -4
- package/data/chromium-i18n/ssl-address/BZ.json +1 -1
- package/data/chromium-i18n/ssl-address/CA.json +9 -9
- package/data/chromium-i18n/ssl-address/CC.json +3 -3
- package/data/chromium-i18n/ssl-address/CD.json +1 -1
- package/data/chromium-i18n/ssl-address/CF.json +1 -1
- package/data/chromium-i18n/ssl-address/CG.json +1 -1
- package/data/chromium-i18n/ssl-address/CH.json +5 -5
- package/data/chromium-i18n/ssl-address/CI.json +1 -6
- package/data/chromium-i18n/ssl-address/CK.json +1 -1
- package/data/chromium-i18n/ssl-address/CL.json +9 -9
- package/data/chromium-i18n/ssl-address/CM.json +1 -1
- package/data/chromium-i18n/ssl-address/CN.json +14 -14
- package/data/chromium-i18n/ssl-address/CO.json +8 -4
- package/data/chromium-i18n/ssl-address/CR.json +3 -3
- package/data/chromium-i18n/ssl-address/CU.json +5 -5
- package/data/chromium-i18n/ssl-address/CV.json +6 -6
- package/data/chromium-i18n/ssl-address/CW.json +1 -1
- package/data/chromium-i18n/ssl-address/CX.json +3 -3
- package/data/chromium-i18n/ssl-address/CY.json +2 -2
- package/data/chromium-i18n/ssl-address/CZ.json +3 -3
- package/data/chromium-i18n/ssl-address/DE.json +3 -3
- package/data/chromium-i18n/ssl-address/DJ.json +1 -1
- package/data/chromium-i18n/ssl-address/DK.json +3 -3
- package/data/chromium-i18n/ssl-address/DM.json +1 -1
- package/data/chromium-i18n/ssl-address/DO.json +3 -3
- package/data/chromium-i18n/ssl-address/DZ.json +1 -8
- package/data/chromium-i18n/ssl-address/EC.json +4 -4
- package/data/chromium-i18n/ssl-address/EE.json +5 -4
- package/data/chromium-i18n/ssl-address/EG.json +8 -8
- package/data/chromium-i18n/ssl-address/EH.json +2 -2
- package/data/chromium-i18n/ssl-address/ER.json +1 -1
- package/data/chromium-i18n/ssl-address/ES.json +9 -9
- package/data/chromium-i18n/ssl-address/ET.json +1 -8
- package/data/chromium-i18n/ssl-address/FI.json +4 -4
- package/data/chromium-i18n/ssl-address/FJ.json +1 -1
- package/data/chromium-i18n/ssl-address/FK.json +3 -3
- package/data/chromium-i18n/ssl-address/FM.json +6 -6
- package/data/chromium-i18n/ssl-address/FO.json +4 -4
- package/data/chromium-i18n/ssl-address/FR.json +5 -5
- package/data/chromium-i18n/ssl-address/GA.json +1 -1
- package/data/chromium-i18n/ssl-address/GB.json +5 -5
- package/data/chromium-i18n/ssl-address/GD.json +1 -1
- package/data/chromium-i18n/ssl-address/GE.json +3 -3
- package/data/chromium-i18n/ssl-address/GF.json +4 -4
- package/data/chromium-i18n/ssl-address/GG.json +4 -4
- package/data/chromium-i18n/ssl-address/GH.json +1 -1
- package/data/chromium-i18n/ssl-address/GI.json +2 -2
- package/data/chromium-i18n/ssl-address/GL.json +2 -2
- package/data/chromium-i18n/ssl-address/GM.json +1 -1
- package/data/chromium-i18n/ssl-address/GN.json +1 -8
- package/data/chromium-i18n/ssl-address/GP.json +4 -4
- package/data/chromium-i18n/ssl-address/GQ.json +1 -1
- package/data/chromium-i18n/ssl-address/GR.json +3 -3
- package/data/chromium-i18n/ssl-address/GS.json +3 -3
- package/data/chromium-i18n/ssl-address/GT.json +2 -2
- package/data/chromium-i18n/ssl-address/GU.json +5 -5
- package/data/chromium-i18n/ssl-address/GW.json +2 -2
- package/data/chromium-i18n/ssl-address/GY.json +1 -1
- package/data/chromium-i18n/ssl-address/HK.json +8 -8
- package/data/chromium-i18n/ssl-address/HM.json +3 -3
- package/data/chromium-i18n/ssl-address/HN.json +3 -2
- package/data/chromium-i18n/ssl-address/HR.json +3 -3
- package/data/chromium-i18n/ssl-address/HT.json +3 -3
- package/data/chromium-i18n/ssl-address/HU.json +4 -4
- package/data/chromium-i18n/ssl-address/ID.json +7 -6
- package/data/chromium-i18n/ssl-address/IE.json +9 -9
- package/data/chromium-i18n/ssl-address/IL.json +3 -3
- package/data/chromium-i18n/ssl-address/IM.json +4 -4
- package/data/chromium-i18n/ssl-address/IN.json +11 -11
- package/data/chromium-i18n/ssl-address/IO.json +3 -3
- package/data/chromium-i18n/ssl-address/IQ.json +3 -3
- package/data/chromium-i18n/ssl-address/IR.json +7 -7
- package/data/chromium-i18n/ssl-address/IS.json +3 -3
- package/data/chromium-i18n/ssl-address/IT.json +10 -10
- package/data/chromium-i18n/ssl-address/JE.json +4 -4
- package/data/chromium-i18n/ssl-address/JM.json +6 -6
- package/data/chromium-i18n/ssl-address/JO.json +1 -8
- package/data/chromium-i18n/ssl-address/JP.json +11 -11
- package/data/chromium-i18n/ssl-address/KE.json +1 -8
- package/data/chromium-i18n/ssl-address/KG.json +1 -8
- package/data/chromium-i18n/ssl-address/KH.json +4 -3
- package/data/chromium-i18n/ssl-address/KI.json +2 -2
- package/data/chromium-i18n/ssl-address/KM.json +1 -1
- package/data/chromium-i18n/ssl-address/KN.json +5 -5
- package/data/chromium-i18n/ssl-address/KP.json +6 -6
- package/data/chromium-i18n/ssl-address/KR.json +15 -15
- package/data/chromium-i18n/ssl-address/KW.json +2 -2
- package/data/chromium-i18n/ssl-address/KY.json +7 -7
- package/data/chromium-i18n/ssl-address/KZ.json +2 -2
- package/data/chromium-i18n/ssl-address/LA.json +2 -2
- package/data/chromium-i18n/ssl-address/LB.json +2 -2
- package/data/chromium-i18n/ssl-address/LC.json +1 -1
- package/data/chromium-i18n/ssl-address/LI.json +3 -3
- package/data/chromium-i18n/ssl-address/LK.json +3 -3
- package/data/chromium-i18n/ssl-address/LR.json +1 -8
- package/data/chromium-i18n/ssl-address/LS.json +1 -8
- package/data/chromium-i18n/ssl-address/LT.json +5 -4
- package/data/chromium-i18n/ssl-address/LU.json +3 -3
- package/data/chromium-i18n/ssl-address/LV.json +5 -4
- package/data/chromium-i18n/ssl-address/LY.json +1 -1
- package/data/chromium-i18n/ssl-address/MA.json +2 -2
- package/data/chromium-i18n/ssl-address/MC.json +3 -3
- package/data/chromium-i18n/ssl-address/MD.json +3 -3
- package/data/chromium-i18n/ssl-address/ME.json +2 -2
- package/data/chromium-i18n/ssl-address/MF.json +4 -4
- package/data/chromium-i18n/ssl-address/MG.json +1 -8
- package/data/chromium-i18n/ssl-address/MH.json +6 -6
- package/data/chromium-i18n/ssl-address/MK.json +2 -2
- package/data/chromium-i18n/ssl-address/ML.json +1 -1
- package/data/chromium-i18n/ssl-address/MM.json +1 -8
- package/data/chromium-i18n/ssl-address/MN.json +3 -3
- package/data/chromium-i18n/ssl-address/MO.json +1 -8
- package/data/chromium-i18n/ssl-address/MP.json +6 -6
- package/data/chromium-i18n/ssl-address/MQ.json +4 -4
- package/data/chromium-i18n/ssl-address/MR.json +1 -1
- package/data/chromium-i18n/ssl-address/MS.json +1 -1
- package/data/chromium-i18n/ssl-address/MT.json +4 -4
- package/data/chromium-i18n/ssl-address/MU.json +3 -3
- package/data/chromium-i18n/ssl-address/MV.json +3 -3
- package/data/chromium-i18n/ssl-address/MW.json +1 -1
- package/data/chromium-i18n/ssl-address/MX.json +12 -12
- package/data/chromium-i18n/ssl-address/MY.json +12 -12
- package/data/chromium-i18n/ssl-address/MZ.json +5 -5
- package/data/chromium-i18n/ssl-address/NA.json +8 -1
- package/data/chromium-i18n/ssl-address/NC.json +4 -4
- package/data/chromium-i18n/ssl-address/NE.json +1 -8
- package/data/chromium-i18n/ssl-address/NF.json +3 -3
- package/data/chromium-i18n/ssl-address/NG.json +8 -8
- package/data/chromium-i18n/ssl-address/NI.json +8 -8
- package/data/chromium-i18n/ssl-address/NL.json +4 -4
- package/data/chromium-i18n/ssl-address/NO.json +3 -3
- package/data/chromium-i18n/ssl-address/NP.json +3 -3
- package/data/chromium-i18n/ssl-address/NR.json +5 -5
- package/data/chromium-i18n/ssl-address/NU.json +1 -1
- package/data/chromium-i18n/ssl-address/NZ.json +3 -3
- package/data/chromium-i18n/ssl-address/OM.json +2 -2
- package/data/chromium-i18n/ssl-address/PA.json +1 -7
- package/data/chromium-i18n/ssl-address/PE.json +7 -7
- package/data/chromium-i18n/ssl-address/PF.json +4 -4
- package/data/chromium-i18n/ssl-address/PG.json +2 -2
- package/data/chromium-i18n/ssl-address/PH.json +7 -7
- package/data/chromium-i18n/ssl-address/PK.json +4 -4
- package/data/chromium-i18n/ssl-address/PL.json +3 -3
- package/data/chromium-i18n/ssl-address/PM.json +3 -3
- package/data/chromium-i18n/ssl-address/PN.json +3 -3
- package/data/chromium-i18n/ssl-address/PR.json +6 -6
- package/data/chromium-i18n/ssl-address/PS.json +1 -1
- package/data/chromium-i18n/ssl-address/PT.json +3 -3
- package/data/chromium-i18n/ssl-address/PW.json +6 -6
- package/data/chromium-i18n/ssl-address/PY.json +2 -2
- package/data/chromium-i18n/ssl-address/QA.json +1 -1
- package/data/chromium-i18n/ssl-address/RE.json +4 -4
- package/data/chromium-i18n/ssl-address/RO.json +6 -5
- package/data/chromium-i18n/ssl-address/RS.json +3 -3
- package/data/chromium-i18n/ssl-address/RU.json +12 -12
- package/data/chromium-i18n/ssl-address/RW.json +1 -1
- package/data/chromium-i18n/ssl-address/SA.json +2 -2
- package/data/chromium-i18n/ssl-address/SB.json +1 -1
- package/data/chromium-i18n/ssl-address/SC.json +2 -2
- package/data/chromium-i18n/ssl-address/SD.json +3 -3
- package/data/chromium-i18n/ssl-address/SE.json +5 -5
- package/data/chromium-i18n/ssl-address/SG.json +3 -3
- package/data/chromium-i18n/ssl-address/SH.json +3 -3
- package/data/chromium-i18n/ssl-address/SI.json +3 -3
- package/data/chromium-i18n/ssl-address/SJ.json +3 -3
- package/data/chromium-i18n/ssl-address/SK.json +3 -3
- package/data/chromium-i18n/ssl-address/SL.json +1 -1
- package/data/chromium-i18n/ssl-address/SM.json +3 -3
- package/data/chromium-i18n/ssl-address/SN.json +2 -2
- package/data/chromium-i18n/ssl-address/SO.json +8 -8
- package/data/chromium-i18n/ssl-address/SR.json +4 -4
- package/data/chromium-i18n/ssl-address/SS.json +1 -1
- package/data/chromium-i18n/ssl-address/ST.json +1 -1
- package/data/chromium-i18n/ssl-address/SV.json +9 -9
- package/data/chromium-i18n/ssl-address/SX.json +1 -1
- package/data/chromium-i18n/ssl-address/SY.json +1 -6
- package/data/chromium-i18n/ssl-address/SZ.json +4 -4
- package/data/chromium-i18n/ssl-address/TA.json +2 -2
- package/data/chromium-i18n/ssl-address/TC.json +3 -3
- package/data/chromium-i18n/ssl-address/TD.json +1 -1
- package/data/chromium-i18n/ssl-address/TF.json +1 -1
- package/data/chromium-i18n/ssl-address/TG.json +1 -1
- package/data/chromium-i18n/ssl-address/TH.json +8 -8
- package/data/chromium-i18n/ssl-address/TJ.json +2 -2
- package/data/chromium-i18n/ssl-address/TK.json +1 -1
- package/data/chromium-i18n/ssl-address/TL.json +1 -1
- package/data/chromium-i18n/ssl-address/TM.json +1 -8
- package/data/chromium-i18n/ssl-address/TN.json +3 -3
- package/data/chromium-i18n/ssl-address/TO.json +1 -1
- package/data/chromium-i18n/ssl-address/TR.json +8 -8
- package/data/chromium-i18n/ssl-address/TT.json +1 -1
- package/data/chromium-i18n/ssl-address/TV.json +5 -5
- package/data/chromium-i18n/ssl-address/TW.json +13 -12
- package/data/chromium-i18n/ssl-address/TZ.json +2 -2
- package/data/chromium-i18n/ssl-address/UA.json +11 -11
- package/data/chromium-i18n/ssl-address/UG.json +1 -1
- package/data/chromium-i18n/ssl-address/UM.json +6 -6
- package/data/chromium-i18n/ssl-address/US.json +11 -11
- package/data/chromium-i18n/ssl-address/UY.json +7 -7
- package/data/chromium-i18n/ssl-address/UZ.json +4 -4
- package/data/chromium-i18n/ssl-address/VA.json +1 -8
- package/data/chromium-i18n/ssl-address/VC.json +3 -3
- package/data/chromium-i18n/ssl-address/VE.json +9 -9
- package/data/chromium-i18n/ssl-address/VG.json +2 -2
- package/data/chromium-i18n/ssl-address/VI.json +6 -6
- package/data/chromium-i18n/ssl-address/VN.json +8 -8
- package/data/chromium-i18n/ssl-address/VU.json +1 -1
- package/data/chromium-i18n/ssl-address/WF.json +3 -3
- package/data/chromium-i18n/ssl-address/WS.json +1 -1
- package/data/chromium-i18n/ssl-address/XK.json +1 -8
- package/data/chromium-i18n/ssl-address/YE.json +1 -1
- package/data/chromium-i18n/ssl-address/YT.json +3 -3
- package/data/chromium-i18n/ssl-address/ZA.json +3 -3
- package/data/chromium-i18n/ssl-address/ZM.json +1 -8
- package/data/chromium-i18n/ssl-address/ZW.json +1 -1
- package/out/api/headless.d.ts +7 -3
- package/out/api/headless.d.ts.map +1 -1
- package/out/api/headless.js +3 -4
- package/out/api/headless.js.map +1 -1
- package/out/api/index.d.ts +3 -3
- package/out/classification/Classification.d.ts +3 -3
- package/out/classification/CompositeClassifier.d.ts +3 -3
- package/out/classification/PhraseClassifier.d.ts +1 -1
- package/out/classification/SectionClassifier.d.ts +1 -1
- package/out/classification/WordClassifier.d.ts +1 -1
- package/out/classification/index.d.ts +7 -7
- package/out/classification/scheme.d.ts +1 -1
- package/out/coarse-placer/coarse-placer.d.ts +1 -1
- package/out/coarse-placer/tools/build-dataset.d.ts +18 -3
- package/out/coarse-placer/tools/build-dataset.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-dataset.js +108 -111
- package/out/coarse-placer/tools/build-dataset.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts +18 -3
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.js +46 -52
- package/out/coarse-placer/tools/build-outlier-exposure.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.d.ts +41 -1
- package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.js +74 -82
- package/out/coarse-placer/tools/build-outlier-latin.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.d.ts +49 -1
- package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.js +100 -102
- package/out/coarse-placer/tools/build-outlier-oa.js.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts +30 -1
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.js +82 -83
- package/out/coarse-placer/tools/eval-latin-offmap.js.map +1 -1
- package/out/coarse-placer/tools/eval-openset.d.ts +23 -2
- package/out/coarse-placer/tools/eval-openset.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-openset.js +282 -287
- package/out/coarse-placer/tools/eval-openset.js.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.d.ts +35 -1
- package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.js +87 -91
- package/out/coarse-placer/tools/eval-quant-compare.js.map +1 -1
- package/out/coarse-placer/tools/eval.d.ts +20 -2
- package/out/coarse-placer/tools/eval.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval.js +104 -105
- package/out/coarse-placer/tools/eval.js.map +1 -1
- package/out/coarse-placer/tools/fnv-hash.d.ts +15 -0
- package/out/coarse-placer/tools/fnv-hash.d.ts.map +1 -0
- package/out/coarse-placer/tools/fnv-hash.js +22 -0
- package/out/coarse-placer/tools/fnv-hash.js.map +1 -0
- package/out/coarse-placer/tools/index.d.ts +23 -0
- package/out/coarse-placer/tools/index.d.ts.map +1 -0
- package/out/coarse-placer/tools/index.js +23 -0
- package/out/coarse-placer/tools/index.js.map +1 -0
- package/out/coarse-placer/tools/probe-frontier.d.ts +22 -3
- package/out/coarse-placer/tools/probe-frontier.d.ts.map +1 -1
- package/out/coarse-placer/tools/probe-frontier.js +92 -95
- package/out/coarse-placer/tools/probe-frontier.js.map +1 -1
- package/out/coarse-placer/tools/quantize.d.ts +34 -1
- package/out/coarse-placer/tools/quantize.d.ts.map +1 -1
- package/out/coarse-placer/tools/quantize.js +58 -60
- package/out/coarse-placer/tools/quantize.js.map +1 -1
- package/out/coarse-placer/tools/train.d.ts +25 -4
- package/out/coarse-placer/tools/train.d.ts.map +1 -1
- package/out/coarse-placer/tools/train.js +135 -137
- package/out/coarse-placer/tools/train.js.map +1 -1
- package/out/decoder/arbitrate-tree.d.ts +2 -2
- package/out/decoder/build-tree.d.ts +2 -2
- package/out/decoder/containment.d.ts +2 -2
- package/out/decoder/index.d.ts +12 -12
- package/out/decoder/proposals-to-tree.d.ts +2 -2
- package/out/decoder/resolve-proposal-overlaps.d.ts +1 -1
- package/out/decoder/serialize-json.d.ts +3 -3
- package/out/decoder/serialize-tuples.d.ts +2 -2
- package/out/decoder/serialize-xml.d.ts +1 -1
- package/out/decoder/types.d.ts +1 -1
- package/out/decoder/unknown-spans.d.ts +1 -1
- package/out/decoder/validate-tree.d.ts +2 -2
- package/out/env/index.d.ts +1 -0
- package/out/env/index.d.ts.map +1 -1
- package/out/env/schema.d.ts +1 -0
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +3 -2
- package/out/env/schema.js.map +1 -1
- package/out/errors/index.d.ts +1 -1
- package/out/filters/RelationshipFilter.d.ts.map +1 -1
- package/out/filters/RelationshipFilter.js.map +1 -1
- package/out/filters/index.d.ts +4 -4
- package/out/fs/node.d.ts +20 -0
- package/out/fs/node.d.ts.map +1 -0
- package/out/fs/node.js +33 -0
- package/out/fs/node.js.map +1 -0
- package/out/index.d.ts +11 -11
- package/out/kysley/client.d.ts +2 -2
- package/out/kysley/client.d.ts.map +1 -1
- package/out/kysley/client.js +1 -1
- package/out/kysley/client.js.map +1 -1
- package/out/kysley/dialect.d.ts +1 -1
- package/out/kysley/dialect.d.ts.map +1 -1
- package/out/kysley/dialect.js +1 -1
- package/out/kysley/dialect.js.map +1 -1
- package/out/kysley/driver.d.ts +1 -1
- package/out/kysley/driver.d.ts.map +1 -1
- package/out/lifecycle/index.d.ts +3 -3
- package/out/locale/index.d.ts +3 -3
- package/out/locale/locale.d.ts +1 -1
- package/out/locale/profiles/en-us.d.ts +1 -1
- package/out/locale/profiles/fr-fr.d.ts +1 -1
- package/out/locale/profiles/index.d.ts +3 -3
- package/out/locale/profiles/ja-jp.d.ts +1 -1
- package/out/locale/registry.d.ts +1 -1
- package/out/logging/index.d.ts +2 -2
- package/out/logging/shared.d.ts +1 -1
- package/out/logging/shared.js +1 -1
- package/out/parser/AddressParser.d.ts +1 -1
- package/out/parser/index.d.ts +3 -3
- package/out/parser/proposal-pipeline.d.ts +4 -4
- package/out/parser/solution-to-proposals.d.ts +2 -2
- package/out/pipeline/index.d.ts +8 -8
- package/out/pipeline/reconcile-lookups.d.ts +2 -2
- package/out/pipeline/reconcile.d.ts +3 -3
- package/out/pipeline/runtime-pipeline.d.ts +3 -3
- package/out/pipeline/span-logit-aggregation.d.ts +1 -1
- package/out/pipeline/types.d.ts +3 -3
- package/out/policy/defaults.d.ts +1 -1
- package/out/policy/from-config.d.ts +3 -3
- package/out/policy/index.d.ts +5 -5
- package/out/policy/input-shape-router.d.ts +1 -1
- package/out/policy/registry.d.ts +1 -1
- package/out/resolver/index.d.ts +2 -2
- package/out/resolver/types.d.ts +1 -1
- package/out/resources/LocaleIndex.d.ts +2 -2
- package/out/resources/ResourceMapCache.d.ts +1 -1
- package/out/resources/ResourceMapCache.d.ts.map +1 -1
- package/out/resources/ResourceMapCache.js +1 -1
- package/out/resources/ResourceMapCache.js.map +1 -1
- package/out/resources/git.d.ts.map +1 -1
- package/out/resources/git.js +1 -1
- package/out/resources/git.js.map +1 -1
- package/out/resources/index.d.ts +11 -12
- package/out/resources/index.d.ts.map +1 -1
- package/out/resources/index.js +0 -1
- package/out/resources/index.js.map +1 -1
- package/out/resources/languages/index.d.ts +2 -2
- package/out/resources/languages/types.gen.d.ts +1 -1
- package/out/resources/languages/types.gen.js +1 -1
- package/out/resources/libpostal.d.ts +1 -1
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/libpostal.js +1 -1
- package/out/resources/libpostal.js.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
- package/out/resources/whosonfirst/index.d.ts +4 -4
- package/out/resources/whosonfirst/loader.d.ts +2 -2
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +1 -1
- package/out/resources/whosonfirst/placetypes/graph.d.ts +2 -2
- package/out/resources/whosonfirst/placetypes/index.d.ts +6 -6
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +2 -2
- package/out/resources/whosonfirst/placetypes/tree.d.ts +2 -2
- package/out/scripting/index.d.ts +15 -0
- package/out/scripting/index.d.ts.map +1 -0
- package/out/scripting/index.js +34 -0
- package/out/scripting/index.js.map +1 -0
- package/out/{utils/scripting.d.ts → scripting/utils/index.d.ts} +6 -15
- package/out/scripting/utils/index.d.ts.map +1 -0
- package/out/{utils/scripting.js → scripting/utils/index.js} +15 -32
- package/out/scripting/utils/index.js.map +1 -0
- package/out/solver/HashMapSolver.d.ts +2 -2
- package/out/solver/Solution.d.ts +1 -1
- package/out/solver/SolutionMatch.d.ts +1 -1
- package/out/solver/index.d.ts +5 -5
- package/out/solver/mask.d.ts +1 -1
- package/out/solvers/index.d.ts +8 -8
- package/out/tokenization/Graph.d.ts +1 -1
- package/out/tokenization/Span.d.ts +5 -5
- package/out/tokenization/context.d.ts +1 -1
- package/out/tokenization/index.d.ts +5 -5
- package/out/tokenization/permutate.d.ts +1 -1
- package/out/tokenization/split.d.ts +1 -1
- package/out/{data/libpostal/resources-download.d.ts → tools/download-libpostal-resources.d.ts} +10 -5
- package/out/tools/download-libpostal-resources.d.ts.map +1 -0
- package/out/{data/libpostal/resources-download.js → tools/download-libpostal-resources.js} +20 -35
- package/out/tools/download-libpostal-resources.js.map +1 -0
- package/out/{data/chromium-i18n/ssl-address-download.d.ts → tools/download-ssl-address.d.ts} +17 -5
- package/out/tools/download-ssl-address.d.ts.map +1 -0
- package/out/{data/chromium-i18n/ssl-address-download.js → tools/download-ssl-address.js} +15 -29
- package/out/tools/download-ssl-address.js.map +1 -0
- package/out/tools/generate-language-types.d.ts +23 -0
- package/out/tools/generate-language-types.d.ts.map +1 -0
- package/out/tools/generate-language-types.js +137 -0
- package/out/tools/generate-language-types.js.map +1 -0
- package/out/tools/index.d.ts +13 -0
- package/out/tools/index.d.ts.map +1 -0
- package/out/tools/index.js +13 -0
- package/out/tools/index.js.map +1 -0
- package/out/types/classifier.d.ts +2 -2
- package/out/types/index.d.ts +3 -3
- package/out/types/mapping.d.ts +2 -2
- package/out/utils/hash.d.ts +13 -0
- package/out/utils/hash.d.ts.map +1 -0
- package/out/utils/hash.js +23 -0
- package/out/utils/hash.js.map +1 -0
- package/out/utils/index.d.ts +8 -6
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +5 -3
- package/out/utils/index.js.map +1 -1
- package/out/utils/jsonl.d.ts +16 -0
- package/out/utils/jsonl.d.ts.map +1 -0
- package/out/utils/jsonl.js +38 -0
- package/out/utils/jsonl.js.map +1 -0
- package/out/utils/stats.d.ts +19 -0
- package/out/utils/stats.d.ts.map +1 -0
- package/out/utils/stats.js +30 -0
- package/out/utils/stats.js.map +1 -0
- package/out/vitest.config.js +3 -3
- package/package.json +309 -42
- package/data/chromium-i18n/ssl-address-download.ts +0 -106
- package/data/libpostal/resources-download.ts +0 -118
- package/out/data/chromium-i18n/ssl-address-download.d.ts.map +0 -1
- package/out/data/chromium-i18n/ssl-address-download.js.map +0 -1
- package/out/data/libpostal/resources-download.d.ts.map +0 -1
- package/out/data/libpostal/resources-download.js.map +0 -1
- package/out/resources/fs.d.ts +0 -12
- package/out/resources/fs.d.ts.map +0 -1
- package/out/resources/fs.js +0 -13
- package/out/resources/fs.js.map +0 -1
- package/out/utils/scripting.d.ts.map +0 -1
- package/out/utils/scripting.js.map +0 -1
|
@@ -27,49 +27,13 @@
|
|
|
27
27
|
* heldout caught = of the never-trained off-map families (baltic/oceania/middle-east), fraction
|
|
28
28
|
* rejected. Both move with the threshold; the Pareto is the whole story.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
* `yarn compile` (imports the compiled featurizer).
|
|
30
|
+
* Run: `mailwoman placer eval openset [--model <dir>] [--out-md <path>]`
|
|
32
31
|
*/
|
|
33
32
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
34
33
|
import * as path from "node:path";
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
const { featurize, COARSE_CLASSES } = (await import(new URL("core/out/coarse-placer/featurize.js", root).href));
|
|
39
|
-
const { values: args } = parseArgs({
|
|
40
|
-
options: {
|
|
41
|
-
model: { type: "string", default: dataRootPath("coarse-placer", "model") },
|
|
42
|
-
data: { type: "string", default: path.resolve(import.meta.dirname, "../../data/coarse-placer") },
|
|
43
|
-
"fit-per-class": { type: "string", default: "2000" },
|
|
44
|
-
"out-md": { type: "string", default: "" },
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
const meta = JSON.parse(readFileSync(path.join(args.model, "meta.json"), "utf8"));
|
|
48
|
-
const W = new Float32Array(readFileSync(path.join(args.model, "weights.bin")).buffer);
|
|
49
|
-
const bias = Float32Array.from(meta.bias);
|
|
50
|
-
const C = meta.classes.length;
|
|
51
|
-
const D = meta.featureDim;
|
|
52
|
-
const OTHER = meta.classes.indexOf("OTHER");
|
|
53
|
-
const IN = meta.classes.map((_, i) => i).filter((i) => i !== OTHER); // in-map class indices
|
|
54
|
-
const nIn = IN.length;
|
|
55
|
-
if (W.length !== C * D)
|
|
56
|
-
throw new Error(`weights ${W.length} ≠ ${C}×${D}`);
|
|
57
|
-
/** Raw logits (PRE-temperature) for the 12 classes. OOD scores use the geometry, not calibration. */
|
|
58
|
-
function logits(raw) {
|
|
59
|
-
const feats = featurize(raw);
|
|
60
|
-
const z = new Float64Array(C);
|
|
61
|
-
for (let c = 0; c < C; c++) {
|
|
62
|
-
let s = bias[c];
|
|
63
|
-
const base = c * D;
|
|
64
|
-
for (const i of feats) {
|
|
65
|
-
s += W[base + i];
|
|
66
|
-
}
|
|
67
|
-
z[c] = s;
|
|
68
|
-
}
|
|
69
|
-
return z;
|
|
70
|
-
}
|
|
71
|
-
/** In-map logit sub-vector (length nIn), in IN order. */
|
|
72
|
-
const inVec = (z) => IN.map((c) => z[c]);
|
|
34
|
+
import { dataRootPath } from "../../utils/data-root.js";
|
|
35
|
+
import { repoRootPath } from "../../utils/repo.js";
|
|
36
|
+
import { COARSE_CLASSES, featurize } from "../featurize.js";
|
|
73
37
|
function logsumexp(xs) {
|
|
74
38
|
let m = -Infinity;
|
|
75
39
|
for (const x of xs)
|
|
@@ -89,77 +53,6 @@ function softmax(z) {
|
|
|
89
53
|
const s = e.reduce((a, b) => a + b, 0);
|
|
90
54
|
return e.map((x) => x / s);
|
|
91
55
|
}
|
|
92
|
-
function load(file) {
|
|
93
|
-
return readFileSync(path.join(args.data, file), "utf8")
|
|
94
|
-
.trim()
|
|
95
|
-
.split("\n")
|
|
96
|
-
.map((l) => JSON.parse(l));
|
|
97
|
-
}
|
|
98
|
-
// ---------------------------------------------------------------------------
|
|
99
|
-
// Fit the Mahalanobis params on IN-MAP TRAIN logits (no test leak): per-class
|
|
100
|
-
// mean in the nIn-dim in-map-logit space + a tied (shared) covariance.
|
|
101
|
-
// ---------------------------------------------------------------------------
|
|
102
|
-
console.error("fitting Mahalanobis on in-map train logits…");
|
|
103
|
-
const fitPerClass = Number(args["fit-per-class"]);
|
|
104
|
-
const trainRows = load("train.jsonl");
|
|
105
|
-
const byClass = new Map(COARSE_CLASSES.map((c) => [c, []]));
|
|
106
|
-
for (const r of trainRows) {
|
|
107
|
-
if (r.country === "OTHER")
|
|
108
|
-
continue;
|
|
109
|
-
const arr = byClass.get(r.country);
|
|
110
|
-
if (arr && arr.length < fitPerClass) {
|
|
111
|
-
arr.push(r.raw);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const means = new Map(); // country -> Float64Array(nIn)
|
|
115
|
-
const counts = new Map();
|
|
116
|
-
// Accumulate per-class means.
|
|
117
|
-
for (const [country, raws] of byClass) {
|
|
118
|
-
if (raws.length === 0)
|
|
119
|
-
continue;
|
|
120
|
-
const mu = new Float64Array(nIn);
|
|
121
|
-
for (const raw of raws) {
|
|
122
|
-
const v = inVec(logits(raw));
|
|
123
|
-
for (let k = 0; k < nIn; k++) {
|
|
124
|
-
mu[k] = mu[k] + v[k];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
for (let k = 0; k < nIn; k++) {
|
|
128
|
-
mu[k] = mu[k] / raws.length;
|
|
129
|
-
}
|
|
130
|
-
means.set(country, mu);
|
|
131
|
-
counts.set(country, raws.length);
|
|
132
|
-
}
|
|
133
|
-
// Tied covariance over centered in-map train logits.
|
|
134
|
-
const Sigma = Array.from({ length: nIn }, () => new Float64Array(nIn));
|
|
135
|
-
let nTot = 0;
|
|
136
|
-
for (const [country, raws] of byClass) {
|
|
137
|
-
const mu = means.get(country);
|
|
138
|
-
if (!mu)
|
|
139
|
-
continue;
|
|
140
|
-
for (const raw of raws) {
|
|
141
|
-
const v = inVec(logits(raw));
|
|
142
|
-
const d = new Float64Array(nIn);
|
|
143
|
-
for (let k = 0; k < nIn; k++) {
|
|
144
|
-
d[k] = v[k] - mu[k];
|
|
145
|
-
}
|
|
146
|
-
for (let a = 0; a < nIn; a++) {
|
|
147
|
-
for (let b = 0; b < nIn; b++) {
|
|
148
|
-
Sigma[a][b] = Sigma[a][b] + d[a] * d[b];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
nTot++;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
for (let a = 0; a < nIn; a++) {
|
|
155
|
-
for (let b = 0; b < nIn; b++) {
|
|
156
|
-
Sigma[a][b] = Sigma[a][b] / nTot;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
// Ridge for invertibility.
|
|
160
|
-
for (let a = 0; a < nIn; a++) {
|
|
161
|
-
Sigma[a][a] = Sigma[a][a] + 1e-3;
|
|
162
|
-
}
|
|
163
56
|
/** Invert a symmetric positive-definite matrix via Gauss-Jordan. */
|
|
164
57
|
function inverse(M) {
|
|
165
58
|
const n = M.length;
|
|
@@ -194,201 +87,303 @@ function inverse(M) {
|
|
|
194
87
|
}
|
|
195
88
|
return A.map((r) => Array.from(r.slice(n)));
|
|
196
89
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
90
|
+
/** Coarse-placer post-hoc open-set score comparison — see the module doc. Emits the markdown report to stdout. */
|
|
91
|
+
export async function evalOpenSet(options = {}, report) {
|
|
92
|
+
const modelDir = options.model || dataRootPath("coarse-placer", "model");
|
|
93
|
+
const dataDir = options.data || repoRootPath("data", "coarse-placer");
|
|
94
|
+
const fitPerClass = options.fitPerClass ?? 2000;
|
|
95
|
+
const meta = JSON.parse(readFileSync(path.join(modelDir, "meta.json"), "utf8"));
|
|
96
|
+
const W = new Float32Array(readFileSync(path.join(modelDir, "weights.bin")).buffer);
|
|
97
|
+
const bias = Float32Array.from(meta.bias);
|
|
98
|
+
const C = meta.classes.length;
|
|
99
|
+
const D = meta.featureDim;
|
|
100
|
+
const OTHER = meta.classes.indexOf("OTHER");
|
|
101
|
+
const IN = meta.classes.map((_, i) => i).filter((i) => i !== OTHER); // in-map class indices
|
|
102
|
+
const nIn = IN.length;
|
|
103
|
+
if (W.length !== C * D)
|
|
104
|
+
throw new Error(`weights ${W.length} ≠ ${C}×${D}`);
|
|
105
|
+
/** Raw logits (PRE-temperature) for the 12 classes. OOD scores use the geometry, not calibration. */
|
|
106
|
+
function logits(raw) {
|
|
107
|
+
const feats = featurize(raw);
|
|
108
|
+
const z = new Float64Array(C);
|
|
109
|
+
for (let c = 0; c < C; c++) {
|
|
110
|
+
let s = bias[c];
|
|
111
|
+
const base = c * D;
|
|
112
|
+
for (const i of feats) {
|
|
113
|
+
s += W[base + i];
|
|
114
|
+
}
|
|
115
|
+
z[c] = s;
|
|
116
|
+
}
|
|
117
|
+
return z;
|
|
118
|
+
}
|
|
119
|
+
/** In-map logit sub-vector (length nIn), in IN order. */
|
|
120
|
+
const inVec = (z) => IN.map((c) => z[c]);
|
|
121
|
+
function load(file) {
|
|
122
|
+
return readFileSync(path.join(dataDir, file), "utf8")
|
|
123
|
+
.trim()
|
|
124
|
+
.split("\n")
|
|
125
|
+
.map((l) => JSON.parse(l));
|
|
126
|
+
}
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
// Fit the Mahalanobis params on IN-MAP TRAIN logits (no test leak): per-class
|
|
129
|
+
// mean in the nIn-dim in-map-logit space + a tied (shared) covariance.
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
report?.("fitting Mahalanobis on in-map train logits…");
|
|
132
|
+
const trainRows = load("train.jsonl");
|
|
133
|
+
const byClass = new Map(COARSE_CLASSES.map((c) => [c, []]));
|
|
134
|
+
for (const r of trainRows) {
|
|
135
|
+
if (r.country === "OTHER")
|
|
136
|
+
continue;
|
|
137
|
+
const arr = byClass.get(r.country);
|
|
138
|
+
if (arr && arr.length < fitPerClass) {
|
|
139
|
+
arr.push(r.raw);
|
|
206
140
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
141
|
+
}
|
|
142
|
+
const means = new Map(); // country -> Float64Array(nIn)
|
|
143
|
+
const counts = new Map();
|
|
144
|
+
// Accumulate per-class means.
|
|
145
|
+
for (const [country, raws] of byClass) {
|
|
146
|
+
if (raws.length === 0)
|
|
147
|
+
continue;
|
|
148
|
+
const mu = new Float64Array(nIn);
|
|
149
|
+
for (const raw of raws) {
|
|
150
|
+
const v = inVec(logits(raw));
|
|
151
|
+
for (let k = 0; k < nIn; k++) {
|
|
152
|
+
mu[k] = mu[k] + v[k];
|
|
212
153
|
}
|
|
213
|
-
q += d[a] * row;
|
|
214
154
|
}
|
|
215
|
-
|
|
216
|
-
|
|
155
|
+
for (let k = 0; k < nIn; k++) {
|
|
156
|
+
mu[k] = mu[k] / raws.length;
|
|
217
157
|
}
|
|
158
|
+
means.set(country, mu);
|
|
159
|
+
counts.set(country, raws.length);
|
|
218
160
|
}
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
161
|
+
// Tied covariance over centered in-map train logits.
|
|
162
|
+
const Sigma = Array.from({ length: nIn }, () => new Float64Array(nIn));
|
|
163
|
+
let nTot = 0;
|
|
164
|
+
for (const [country, raws] of byClass) {
|
|
165
|
+
const mu = means.get(country);
|
|
166
|
+
if (!mu)
|
|
167
|
+
continue;
|
|
168
|
+
for (const raw of raws) {
|
|
169
|
+
const v = inVec(logits(raw));
|
|
170
|
+
const d = new Float64Array(nIn);
|
|
171
|
+
for (let k = 0; k < nIn; k++) {
|
|
172
|
+
d[k] = v[k] - mu[k];
|
|
173
|
+
}
|
|
174
|
+
for (let a = 0; a < nIn; a++) {
|
|
175
|
+
for (let b = 0; b < nIn; b++) {
|
|
176
|
+
Sigma[a][b] = Sigma[a][b] + d[a] * d[b];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
nTot++;
|
|
238
180
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
s: {
|
|
244
|
-
maxprob: inmapProbMax,
|
|
245
|
-
p_inmap: 1 - probs[OTHER],
|
|
246
|
-
energy: logsumexp(zin),
|
|
247
|
-
maxlogit: Math.max(...zin),
|
|
248
|
-
maha: mahaScore(z),
|
|
249
|
-
},
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
const inmapTest = load("test.jsonl").filter((r) => r.country !== "OTHER"); // the 11 countries only
|
|
253
|
-
const heldout = load("test-latin-offmap.jsonl").filter((r) => r.group === "heldout");
|
|
254
|
-
const inmapScored = inmapTest.map((r) => scoreRow(r.raw, r.country));
|
|
255
|
-
const heldoutScored = heldout.map((r) => scoreRow(r.raw, undefined));
|
|
256
|
-
// Honest threshold protocol: split each probe 50/50 (deterministic by index parity) into DEV + TEST.
|
|
257
|
-
// The operating threshold is picked on DEV (maximizing balanced min); the reported point is frozen on
|
|
258
|
-
// TEST — so the number is a generalization estimate, not a threshold fit to the set it's scored on.
|
|
259
|
-
const inDev = inmapScored.filter((_, i) => i % 2 === 0);
|
|
260
|
-
const inTest = inmapScored.filter((_, i) => i % 2 === 1);
|
|
261
|
-
const heldDev = heldoutScored.filter((_, i) => i % 2 === 0);
|
|
262
|
-
const heldTest = heldoutScored.filter((_, i) => i % 2 === 1);
|
|
263
|
-
/** (inMapAcc, heldCaught) at threshold t over a given in-map/heldout split. */
|
|
264
|
-
function pointAt(scoreKey, t, inSplit, heldSplit) {
|
|
265
|
-
let keepCorrect = 0;
|
|
266
|
-
for (const o of inSplit)
|
|
267
|
-
if (o.s[scoreKey] >= t && o.correctRoute) {
|
|
268
|
-
keepCorrect++;
|
|
181
|
+
}
|
|
182
|
+
for (let a = 0; a < nIn; a++) {
|
|
183
|
+
for (let b = 0; b < nIn; b++) {
|
|
184
|
+
Sigma[a][b] = Sigma[a][b] / nTot;
|
|
269
185
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
186
|
+
}
|
|
187
|
+
// Ridge for invertibility.
|
|
188
|
+
for (let a = 0; a < nIn; a++) {
|
|
189
|
+
Sigma[a][a] = Sigma[a][a] + 1e-3;
|
|
190
|
+
}
|
|
191
|
+
const SigmaInv = inverse(Sigma);
|
|
192
|
+
/** -min_c Mahalanobis² to any in-map class mean (higher = closer to the in-map manifold). */
|
|
193
|
+
function mahaScore(z) {
|
|
194
|
+
const v = inVec(z);
|
|
195
|
+
let best = Infinity;
|
|
196
|
+
for (const mu of means.values()) {
|
|
197
|
+
const d = new Float64Array(nIn);
|
|
198
|
+
for (let k = 0; k < nIn; k++) {
|
|
199
|
+
d[k] = v[k] - mu[k];
|
|
200
|
+
}
|
|
201
|
+
let q = 0;
|
|
202
|
+
for (let a = 0; a < nIn; a++) {
|
|
203
|
+
let row = 0;
|
|
204
|
+
for (let b = 0; b < nIn; b++) {
|
|
205
|
+
row += SigmaInv[a][b] * d[b];
|
|
206
|
+
}
|
|
207
|
+
q += d[a] * row;
|
|
208
|
+
}
|
|
209
|
+
if (q < best) {
|
|
210
|
+
best = q;
|
|
211
|
+
}
|
|
274
212
|
}
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
// For each score: KEEP (route in-map) iff score >= threshold; else REJECT (→ OTHER).
|
|
278
|
-
// in-map accuracy = keep & correctRoute. heldout caught = rejected.
|
|
279
|
-
function paretoFor(scoreKey) {
|
|
280
|
-
const inVals = inmapScored.map((o) => ({ v: o.s[scoreKey], ok: o.correctRoute }));
|
|
281
|
-
const heldVals = heldoutScored.map((o) => o.s[scoreKey]);
|
|
282
|
-
// Candidate thresholds: quantiles of the union of scores.
|
|
283
|
-
const all = [...inVals.map((x) => x.v), ...heldVals].sort((a, b) => a - b);
|
|
284
|
-
const ts = [];
|
|
285
|
-
for (let q = 0; q <= 200; q++) {
|
|
286
|
-
ts.push(all[Math.min(all.length - 1, Math.floor((q / 200) * (all.length - 1)))]);
|
|
213
|
+
return -best;
|
|
287
214
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
// Score the in-map test (11 countries) + the off-map heldout families.
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
report?.("scoring in-map test + off-map heldout…");
|
|
219
|
+
const SCORES = ["maxprob", "p_inmap", "energy", "maxlogit", "maha"];
|
|
220
|
+
/** All open-set scores for one raw string + whether argmax-in-map routes to `trueCountry`. */
|
|
221
|
+
function scoreRow(raw, trueCountry) {
|
|
222
|
+
const z = logits(raw);
|
|
223
|
+
const probs = softmax(z);
|
|
224
|
+
const zin = inVec(z);
|
|
225
|
+
// argmax over in-map classes (the FIXED routing).
|
|
226
|
+
let amIdx = 0, am = -Infinity;
|
|
227
|
+
for (let k = 0; k < nIn; k++)
|
|
228
|
+
if (zin[k] > am) {
|
|
229
|
+
am = zin[k];
|
|
230
|
+
amIdx = k;
|
|
231
|
+
}
|
|
232
|
+
const routedCountry = COARSE_CLASSES[IN[amIdx]];
|
|
233
|
+
const inmapProbMax = Math.max(...IN.map((c) => probs[c]));
|
|
234
|
+
return {
|
|
235
|
+
correctRoute: trueCountry !== undefined && routedCountry === trueCountry,
|
|
236
|
+
s: {
|
|
237
|
+
maxprob: inmapProbMax,
|
|
238
|
+
p_inmap: 1 - probs[OTHER],
|
|
239
|
+
energy: logsumexp(zin),
|
|
240
|
+
maxlogit: Math.max(...zin),
|
|
241
|
+
maha: mahaScore(z),
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
const inmapTest = load("test.jsonl").filter((r) => r.country !== "OTHER"); // the 11 countries only
|
|
246
|
+
const heldout = load("test-latin-offmap.jsonl").filter((r) => r.group === "heldout");
|
|
247
|
+
const inmapScored = inmapTest.map((r) => scoreRow(r.raw, r.country));
|
|
248
|
+
const heldoutScored = heldout.map((r) => scoreRow(r.raw, undefined));
|
|
249
|
+
// Honest threshold protocol: split each probe 50/50 (deterministic by index parity) into DEV + TEST.
|
|
250
|
+
// The operating threshold is picked on DEV (maximizing balanced min); the reported point is frozen on
|
|
251
|
+
// TEST — so the number is a generalization estimate, not a threshold fit to the set it's scored on.
|
|
252
|
+
const inDev = inmapScored.filter((_, i) => i % 2 === 0);
|
|
253
|
+
const inTest = inmapScored.filter((_, i) => i % 2 === 1);
|
|
254
|
+
const heldDev = heldoutScored.filter((_, i) => i % 2 === 0);
|
|
255
|
+
const heldTest = heldoutScored.filter((_, i) => i % 2 === 1);
|
|
256
|
+
/** (inMapAcc, heldCaught) at threshold t over a given in-map/heldout split. */
|
|
257
|
+
function pointAt(scoreKey, t, inSplit, heldSplit) {
|
|
292
258
|
let keepCorrect = 0;
|
|
293
|
-
for (const
|
|
294
|
-
if (
|
|
259
|
+
for (const o of inSplit)
|
|
260
|
+
if (o.s[scoreKey] >= t && o.correctRoute) {
|
|
295
261
|
keepCorrect++;
|
|
296
262
|
}
|
|
297
263
|
let caught = 0;
|
|
298
|
-
for (const
|
|
299
|
-
if (
|
|
264
|
+
for (const o of heldSplit)
|
|
265
|
+
if (o.s[scoreKey] < t) {
|
|
300
266
|
caught++;
|
|
301
267
|
}
|
|
302
|
-
return { t, inMapAcc: (100 * keepCorrect) /
|
|
303
|
-
}
|
|
304
|
-
//
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
268
|
+
return { t, inMapAcc: (100 * keepCorrect) / inSplit.length, heldCaught: (100 * caught) / heldSplit.length };
|
|
269
|
+
}
|
|
270
|
+
// For each score: KEEP (route in-map) iff score >= threshold; else REJECT (→ OTHER).
|
|
271
|
+
// in-map accuracy = keep & correctRoute. heldout caught = rejected.
|
|
272
|
+
function paretoFor(scoreKey) {
|
|
273
|
+
const inVals = inmapScored.map((o) => ({ v: o.s[scoreKey], ok: o.correctRoute }));
|
|
274
|
+
const heldVals = heldoutScored.map((o) => o.s[scoreKey]);
|
|
275
|
+
// Candidate thresholds: quantiles of the union of scores.
|
|
276
|
+
const all = [...inVals.map((x) => x.v), ...heldVals].sort((a, b) => a - b);
|
|
277
|
+
const ts = [];
|
|
278
|
+
for (let q = 0; q <= 200; q++) {
|
|
279
|
+
ts.push(all[Math.min(all.length - 1, Math.floor((q / 200) * (all.length - 1)))]);
|
|
313
280
|
}
|
|
314
|
-
|
|
315
|
-
|
|
281
|
+
const uniq = [...new Set(ts)];
|
|
282
|
+
const nInVals = inVals.length;
|
|
283
|
+
const nHeld = heldVals.length;
|
|
284
|
+
const pts = uniq.map((t) => {
|
|
285
|
+
let keepCorrect = 0;
|
|
286
|
+
for (const x of inVals)
|
|
287
|
+
if (x.v >= t && x.ok) {
|
|
288
|
+
keepCorrect++;
|
|
289
|
+
}
|
|
290
|
+
let caught = 0;
|
|
291
|
+
for (const v of heldVals)
|
|
292
|
+
if (v < t) {
|
|
293
|
+
caught++;
|
|
294
|
+
}
|
|
295
|
+
return { t, inMapAcc: (100 * keepCorrect) / nInVals, heldCaught: (100 * caught) / nHeld };
|
|
296
|
+
});
|
|
297
|
+
// Summaries.
|
|
298
|
+
let balanced = { val: -1, pt: null }; // max of min(inMapAcc, heldCaught) on the FULL probe
|
|
299
|
+
let atHeld90 = null; // highest inMapAcc with heldCaught >= 90
|
|
300
|
+
let atIn90 = null;
|
|
301
|
+
// highest heldCaught with inMapAcc >= 90
|
|
302
|
+
for (const p of pts) {
|
|
303
|
+
const m = Math.min(p.inMapAcc, p.heldCaught);
|
|
304
|
+
if (m > balanced.val) {
|
|
305
|
+
balanced = { val: m, pt: p };
|
|
306
|
+
}
|
|
307
|
+
if (p.heldCaught >= 90 && (!atHeld90 || p.inMapAcc > atHeld90.inMapAcc)) {
|
|
308
|
+
atHeld90 = p;
|
|
309
|
+
}
|
|
310
|
+
if (p.inMapAcc >= 90 && (!atIn90 || p.heldCaught > atIn90.heldCaught)) {
|
|
311
|
+
atIn90 = p;
|
|
312
|
+
}
|
|
316
313
|
}
|
|
317
|
-
|
|
318
|
-
|
|
314
|
+
// HONEST point: pick t* on DEV (max balanced min), freeze + report on TEST.
|
|
315
|
+
let devBest = { val: -1, t: null };
|
|
316
|
+
for (const p of pts) {
|
|
317
|
+
const d = pointAt(scoreKey, p.t, inDev, heldDev);
|
|
318
|
+
const m = Math.min(d.inMapAcc, d.heldCaught);
|
|
319
|
+
if (m > devBest.val) {
|
|
320
|
+
devBest = { val: m, t: p.t };
|
|
321
|
+
}
|
|
319
322
|
}
|
|
323
|
+
const heldoutTestPt = pointAt(scoreKey, devBest.t, inTest, heldTest);
|
|
324
|
+
return { balanced, atHeld90, atIn90, devThreshold: devBest.t, honest: heldoutTestPt, pts };
|
|
320
325
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
const results = Object.fromEntries(SCORES.map((k) => [k, paretoFor(k)]));
|
|
327
|
+
// ---------------------------------------------------------------------------
|
|
328
|
+
// Report.
|
|
329
|
+
// ---------------------------------------------------------------------------
|
|
330
|
+
const f = (x) => (x == null ? "—" : x.toFixed(1));
|
|
331
|
+
const lines = [];
|
|
332
|
+
lines.push(`# Coarse-placer M2 Phase 1 — post-hoc open-set score comparison (#244)`);
|
|
333
|
+
lines.push("");
|
|
334
|
+
lines.push(`_Frozen shipped model (\`${path.basename(modelDir)}\`), NO retrain. In-map test ${inmapTest.length} rows ` +
|
|
335
|
+
`(11 countries); off-map HELDOUT ${heldout.length} rows (never-trained families: baltic/oceania/middle-east). ` +
|
|
336
|
+
`Mahalanobis fit on ≤${fitPerClass}/class in-map train logits. The 11-way routing is fixed; each score only ` +
|
|
337
|
+
`changes the reject decision._`);
|
|
338
|
+
lines.push("");
|
|
339
|
+
function atStr(p) {
|
|
340
|
+
if (!p)
|
|
341
|
+
return "— (unreachable)";
|
|
342
|
+
return `in ${f(p.inMapAcc)} / held ${f(p.heldCaught)}`;
|
|
329
343
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
lines.push(
|
|
340
|
-
lines.push(
|
|
341
|
-
lines.push(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const
|
|
357
|
-
const
|
|
358
|
-
lines.push(
|
|
359
|
-
|
|
360
|
-
lines.push(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
lines.push(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
k,
|
|
375
|
-
honestMin: Math.min(results[k].honest.inMapAcc, results[k].honest.heldCaught),
|
|
376
|
-
})).sort((a, b) => b.honestMin - a.honestMin);
|
|
377
|
-
const winner = ranked[0];
|
|
378
|
-
const clears90 = winner.honestMin >= 90;
|
|
379
|
-
lines.push(`## Verdict`);
|
|
380
|
-
lines.push("");
|
|
381
|
-
lines.push(`Best score (honest dev→test): **\`${winner.k}\`** at min(in-map, heldout) = **${f(winner.honestMin)}** on the frozen test half. ` +
|
|
382
|
-
(clears90
|
|
383
|
-
? `**Clears 90/90 post-hoc** — wire it into CoarsePlacer as the open-set reject rule; no retrain needed (Phase 2 reject-head unnecessary).`
|
|
384
|
-
: `Below the 90/90 bar — the best post-hoc score reaches ${f(winner.honestMin)}. Escalate to Phase 2 (explicit binary reject head).`));
|
|
385
|
-
lines.push("");
|
|
386
|
-
lines.push(`Ranking (honest dev→test min): ${ranked.map((r) => `\`${r.k}\` ${f(r.honestMin)}`).join(" · ")}`);
|
|
387
|
-
lines.push("");
|
|
388
|
-
const md = lines.join("\n");
|
|
389
|
-
console.log(md);
|
|
390
|
-
if (args["out-md"]) {
|
|
391
|
-
writeFileSync(args["out-md"], md);
|
|
392
|
-
console.error(`\n[written] ${args["out-md"]}`);
|
|
344
|
+
lines.push(`## Honest dev→test point (threshold picked on dev, frozen on test)`);
|
|
345
|
+
lines.push("");
|
|
346
|
+
lines.push(`| score | TEST in-map | TEST held-caught | min | full-probe balanced |`);
|
|
347
|
+
lines.push(`|---|---:|---:|---:|---:|`);
|
|
348
|
+
for (const k of SCORES) {
|
|
349
|
+
const r = results[k];
|
|
350
|
+
const h = r.honest;
|
|
351
|
+
lines.push(`| \`${k}\` | ${f(h.inMapAcc)} | ${f(h.heldCaught)} | **${f(Math.min(h.inMapAcc, h.heldCaught))}** | ${f(r.balanced.val)} |`);
|
|
352
|
+
}
|
|
353
|
+
lines.push("");
|
|
354
|
+
lines.push(`## Full-probe corners (the achievable Pareto), per score`);
|
|
355
|
+
lines.push("");
|
|
356
|
+
lines.push(`| score | balanced min(in,held) | in-map @ held≥90 | held @ in-map≥90 |`);
|
|
357
|
+
lines.push(`|---|---:|---:|---:|`);
|
|
358
|
+
for (const k of SCORES) {
|
|
359
|
+
const r = results[k];
|
|
360
|
+
const bal = r.balanced.pt;
|
|
361
|
+
lines.push(`| \`${k}\` | **${f(r.balanced.val)}** (in ${f(bal?.inMapAcc)}, held ${f(bal?.heldCaught)}) | ` +
|
|
362
|
+
`${atStr(r.atHeld90)} | ${atStr(r.atIn90)} |`);
|
|
363
|
+
}
|
|
364
|
+
lines.push("");
|
|
365
|
+
// Winner by the HONEST dev→test balanced min (not the full-probe number).
|
|
366
|
+
const ranked = SCORES.map((k) => ({
|
|
367
|
+
k,
|
|
368
|
+
honestMin: Math.min(results[k].honest.inMapAcc, results[k].honest.heldCaught),
|
|
369
|
+
})).sort((a, b) => b.honestMin - a.honestMin);
|
|
370
|
+
const winner = ranked[0];
|
|
371
|
+
const clears90 = winner.honestMin >= 90;
|
|
372
|
+
lines.push(`## Verdict`);
|
|
373
|
+
lines.push("");
|
|
374
|
+
lines.push(`Best score (honest dev→test): **\`${winner.k}\`** at min(in-map, heldout) = **${f(winner.honestMin)}** on the frozen test half. ` +
|
|
375
|
+
(clears90
|
|
376
|
+
? `**Clears 90/90 post-hoc** — wire it into CoarsePlacer as the open-set reject rule; no retrain needed (Phase 2 reject-head unnecessary).`
|
|
377
|
+
: `Below the 90/90 bar — the best post-hoc score reaches ${f(winner.honestMin)}. Escalate to Phase 2 (explicit binary reject head).`));
|
|
378
|
+
lines.push("");
|
|
379
|
+
lines.push(`Ranking (honest dev→test min): ${ranked.map((r) => `\`${r.k}\` ${f(r.honestMin)}`).join(" · ")}`);
|
|
380
|
+
lines.push("");
|
|
381
|
+
const md = lines.join("\n");
|
|
382
|
+
console.log(md);
|
|
383
|
+
if (options.outMd) {
|
|
384
|
+
writeFileSync(options.outMd, md);
|
|
385
|
+
report?.(`\n[written] ${options.outMd}`);
|
|
386
|
+
}
|
|
387
|
+
return { winner: winner.k, honestMin: winner.honestMin, clears90, markdown: md };
|
|
393
388
|
}
|
|
394
389
|
//# sourceMappingURL=eval-openset.js.map
|