whatcategory 0.0.0-stage → 0.1.0

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.
Files changed (438) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +164 -2
  4. package/THIRD_PARTY_NOTICES.md +112 -0
  5. package/data/brands/001.js +2 -0
  6. package/data/brands/AC.js +2 -0
  7. package/data/brands/AD.js +2 -0
  8. package/data/brands/AE.js +2 -0
  9. package/data/brands/AF.js +2 -0
  10. package/data/brands/AG.js +2 -0
  11. package/data/brands/AI.js +2 -0
  12. package/data/brands/AL.js +2 -0
  13. package/data/brands/AM.js +2 -0
  14. package/data/brands/AO.js +2 -0
  15. package/data/brands/AQ.js +2 -0
  16. package/data/brands/AR.js +2 -0
  17. package/data/brands/AS.js +2 -0
  18. package/data/brands/AT.js +2 -0
  19. package/data/brands/AU.js +2 -0
  20. package/data/brands/AW.js +2 -0
  21. package/data/brands/AX.js +2 -0
  22. package/data/brands/AZ.js +2 -0
  23. package/data/brands/BA.js +2 -0
  24. package/data/brands/BB.js +2 -0
  25. package/data/brands/BD.js +2 -0
  26. package/data/brands/BE.js +2 -0
  27. package/data/brands/BF.js +2 -0
  28. package/data/brands/BG.js +2 -0
  29. package/data/brands/BH.js +2 -0
  30. package/data/brands/BI.js +2 -0
  31. package/data/brands/BJ.js +2 -0
  32. package/data/brands/BL.js +2 -0
  33. package/data/brands/BM.js +2 -0
  34. package/data/brands/BN.js +2 -0
  35. package/data/brands/BO.js +2 -0
  36. package/data/brands/BQ.js +2 -0
  37. package/data/brands/BR.js +2 -0
  38. package/data/brands/BS.js +2 -0
  39. package/data/brands/BT.js +2 -0
  40. package/data/brands/BV.js +2 -0
  41. package/data/brands/BW.js +2 -0
  42. package/data/brands/BY.js +2 -0
  43. package/data/brands/BZ.js +2 -0
  44. package/data/brands/CA.js +2 -0
  45. package/data/brands/CC.js +2 -0
  46. package/data/brands/CD.js +2 -0
  47. package/data/brands/CF.js +2 -0
  48. package/data/brands/CG.js +2 -0
  49. package/data/brands/CH.js +2 -0
  50. package/data/brands/CI.js +2 -0
  51. package/data/brands/CK.js +2 -0
  52. package/data/brands/CL.js +2 -0
  53. package/data/brands/CM.js +2 -0
  54. package/data/brands/CN.js +2 -0
  55. package/data/brands/CO.js +2 -0
  56. package/data/brands/CP.js +2 -0
  57. package/data/brands/CQ.js +2 -0
  58. package/data/brands/CR.js +2 -0
  59. package/data/brands/CU.js +2 -0
  60. package/data/brands/CV.js +2 -0
  61. package/data/brands/CW.js +2 -0
  62. package/data/brands/CX.js +2 -0
  63. package/data/brands/CY.js +2 -0
  64. package/data/brands/CZ.js +2 -0
  65. package/data/brands/DE.js +2 -0
  66. package/data/brands/DG.js +2 -0
  67. package/data/brands/DJ.js +2 -0
  68. package/data/brands/DK.js +2 -0
  69. package/data/brands/DM.js +2 -0
  70. package/data/brands/DO.js +2 -0
  71. package/data/brands/DZ.js +2 -0
  72. package/data/brands/EA.js +2 -0
  73. package/data/brands/EC.js +2 -0
  74. package/data/brands/EE.js +2 -0
  75. package/data/brands/EG.js +2 -0
  76. package/data/brands/EH.js +2 -0
  77. package/data/brands/ER.js +2 -0
  78. package/data/brands/ES.js +2 -0
  79. package/data/brands/ET.js +2 -0
  80. package/data/brands/FI.js +2 -0
  81. package/data/brands/FJ.js +2 -0
  82. package/data/brands/FK.js +2 -0
  83. package/data/brands/FM.js +2 -0
  84. package/data/brands/FO.js +2 -0
  85. package/data/brands/FR.js +2 -0
  86. package/data/brands/GA.js +2 -0
  87. package/data/brands/GB.js +2 -0
  88. package/data/brands/GD.js +2 -0
  89. package/data/brands/GE.js +2 -0
  90. package/data/brands/GF.js +2 -0
  91. package/data/brands/GG.js +2 -0
  92. package/data/brands/GH.js +2 -0
  93. package/data/brands/GI.js +2 -0
  94. package/data/brands/GL.js +2 -0
  95. package/data/brands/GM.js +2 -0
  96. package/data/brands/GN.js +2 -0
  97. package/data/brands/GP.js +2 -0
  98. package/data/brands/GQ.js +2 -0
  99. package/data/brands/GR.js +2 -0
  100. package/data/brands/GS.js +2 -0
  101. package/data/brands/GT.js +2 -0
  102. package/data/brands/GU.js +2 -0
  103. package/data/brands/GW.js +2 -0
  104. package/data/brands/GY.js +2 -0
  105. package/data/brands/HK.js +2 -0
  106. package/data/brands/HM.js +2 -0
  107. package/data/brands/HN.js +2 -0
  108. package/data/brands/HR.js +2 -0
  109. package/data/brands/HT.js +2 -0
  110. package/data/brands/HU.js +2 -0
  111. package/data/brands/IC.js +2 -0
  112. package/data/brands/ID.js +2 -0
  113. package/data/brands/IE.js +2 -0
  114. package/data/brands/IL.js +2 -0
  115. package/data/brands/IM.js +2 -0
  116. package/data/brands/IN.js +2 -0
  117. package/data/brands/IO.js +2 -0
  118. package/data/brands/IQ.js +2 -0
  119. package/data/brands/IR.js +2 -0
  120. package/data/brands/IS.js +2 -0
  121. package/data/brands/IT.js +2 -0
  122. package/data/brands/JE.js +2 -0
  123. package/data/brands/JM.js +2 -0
  124. package/data/brands/JO.js +2 -0
  125. package/data/brands/JP.js +2 -0
  126. package/data/brands/KE.js +2 -0
  127. package/data/brands/KG.js +2 -0
  128. package/data/brands/KH.js +2 -0
  129. package/data/brands/KI.js +2 -0
  130. package/data/brands/KM.js +2 -0
  131. package/data/brands/KN.js +2 -0
  132. package/data/brands/KP.js +2 -0
  133. package/data/brands/KR.js +2 -0
  134. package/data/brands/KW.js +2 -0
  135. package/data/brands/KY.js +2 -0
  136. package/data/brands/KZ.js +2 -0
  137. package/data/brands/LA.js +2 -0
  138. package/data/brands/LB.js +2 -0
  139. package/data/brands/LC.js +2 -0
  140. package/data/brands/LI.js +2 -0
  141. package/data/brands/LK.js +2 -0
  142. package/data/brands/LR.js +2 -0
  143. package/data/brands/LS.js +2 -0
  144. package/data/brands/LT.js +2 -0
  145. package/data/brands/LU.js +2 -0
  146. package/data/brands/LV.js +2 -0
  147. package/data/brands/LY.js +2 -0
  148. package/data/brands/MA.js +2 -0
  149. package/data/brands/MC.js +2 -0
  150. package/data/brands/MD.js +2 -0
  151. package/data/brands/ME.js +2 -0
  152. package/data/brands/MF.js +2 -0
  153. package/data/brands/MG.js +2 -0
  154. package/data/brands/MH.js +2 -0
  155. package/data/brands/MK.js +2 -0
  156. package/data/brands/ML.js +2 -0
  157. package/data/brands/MM.js +2 -0
  158. package/data/brands/MN.js +2 -0
  159. package/data/brands/MO.js +2 -0
  160. package/data/brands/MP.js +2 -0
  161. package/data/brands/MQ.js +2 -0
  162. package/data/brands/MR.js +2 -0
  163. package/data/brands/MS.js +2 -0
  164. package/data/brands/MT.js +2 -0
  165. package/data/brands/MU.js +2 -0
  166. package/data/brands/MV.js +2 -0
  167. package/data/brands/MW.js +2 -0
  168. package/data/brands/MX.js +2 -0
  169. package/data/brands/MY.js +2 -0
  170. package/data/brands/MZ.js +2 -0
  171. package/data/brands/NA.js +2 -0
  172. package/data/brands/NC.js +2 -0
  173. package/data/brands/NE.js +2 -0
  174. package/data/brands/NF.js +2 -0
  175. package/data/brands/NG.js +2 -0
  176. package/data/brands/NI.js +2 -0
  177. package/data/brands/NL.js +2 -0
  178. package/data/brands/NO.js +2 -0
  179. package/data/brands/NP.js +2 -0
  180. package/data/brands/NR.js +2 -0
  181. package/data/brands/NU.js +2 -0
  182. package/data/brands/NZ.js +2 -0
  183. package/data/brands/OM.js +2 -0
  184. package/data/brands/PA.js +2 -0
  185. package/data/brands/PE.js +2 -0
  186. package/data/brands/PF.js +2 -0
  187. package/data/brands/PG.js +2 -0
  188. package/data/brands/PH.js +2 -0
  189. package/data/brands/PK.js +2 -0
  190. package/data/brands/PL.js +2 -0
  191. package/data/brands/PM.js +2 -0
  192. package/data/brands/PN.js +2 -0
  193. package/data/brands/PR.js +2 -0
  194. package/data/brands/PS.js +2 -0
  195. package/data/brands/PT.js +2 -0
  196. package/data/brands/PW.js +2 -0
  197. package/data/brands/PY.js +2 -0
  198. package/data/brands/QA.js +2 -0
  199. package/data/brands/RE.js +2 -0
  200. package/data/brands/RO.js +2 -0
  201. package/data/brands/RS.js +2 -0
  202. package/data/brands/RU.js +2 -0
  203. package/data/brands/RW.js +2 -0
  204. package/data/brands/SA.js +2 -0
  205. package/data/brands/SB.js +2 -0
  206. package/data/brands/SC.js +2 -0
  207. package/data/brands/SD.js +2 -0
  208. package/data/brands/SE.js +2 -0
  209. package/data/brands/SG.js +2 -0
  210. package/data/brands/SH.js +2 -0
  211. package/data/brands/SI.js +2 -0
  212. package/data/brands/SJ.js +2 -0
  213. package/data/brands/SK.js +2 -0
  214. package/data/brands/SL.js +2 -0
  215. package/data/brands/SM.js +2 -0
  216. package/data/brands/SN.js +2 -0
  217. package/data/brands/SO.js +2 -0
  218. package/data/brands/SR.js +2 -0
  219. package/data/brands/SS.js +2 -0
  220. package/data/brands/ST.js +2 -0
  221. package/data/brands/SV.js +2 -0
  222. package/data/brands/SX.js +2 -0
  223. package/data/brands/SY.js +2 -0
  224. package/data/brands/SZ.js +2 -0
  225. package/data/brands/TA.js +2 -0
  226. package/data/brands/TC.js +2 -0
  227. package/data/brands/TD.js +2 -0
  228. package/data/brands/TF.js +2 -0
  229. package/data/brands/TG.js +2 -0
  230. package/data/brands/TH.js +2 -0
  231. package/data/brands/TJ.js +2 -0
  232. package/data/brands/TK.js +2 -0
  233. package/data/brands/TL.js +2 -0
  234. package/data/brands/TM.js +2 -0
  235. package/data/brands/TN.js +2 -0
  236. package/data/brands/TO.js +2 -0
  237. package/data/brands/TR.js +2 -0
  238. package/data/brands/TT.js +2 -0
  239. package/data/brands/TV.js +2 -0
  240. package/data/brands/TW.js +2 -0
  241. package/data/brands/TZ.js +2 -0
  242. package/data/brands/UA.js +2 -0
  243. package/data/brands/UG.js +2 -0
  244. package/data/brands/UM.js +2 -0
  245. package/data/brands/US.js +2 -0
  246. package/data/brands/UY.js +2 -0
  247. package/data/brands/UZ.js +2 -0
  248. package/data/brands/VA.js +2 -0
  249. package/data/brands/VC.js +2 -0
  250. package/data/brands/VE.js +2 -0
  251. package/data/brands/VG.js +2 -0
  252. package/data/brands/VI.js +2 -0
  253. package/data/brands/VN.js +2 -0
  254. package/data/brands/VU.js +2 -0
  255. package/data/brands/WF.js +2 -0
  256. package/data/brands/WS.js +2 -0
  257. package/data/brands/XK.js +2 -0
  258. package/data/brands/YE.js +2 -0
  259. package/data/brands/YT.js +2 -0
  260. package/data/brands/ZA.js +2 -0
  261. package/data/brands/ZM.js +2 -0
  262. package/data/brands/ZW.js +2 -0
  263. package/data/index.d.ts +5 -0
  264. package/data/index.js +424 -0
  265. package/data/words/af.js +2 -0
  266. package/data/words/ak.js +2 -0
  267. package/data/words/am.js +2 -0
  268. package/data/words/ar-SA.js +2 -0
  269. package/data/words/ar.js +2 -0
  270. package/data/words/as.js +2 -0
  271. package/data/words/ast.js +2 -0
  272. package/data/words/az.js +2 -0
  273. package/data/words/ba.js +2 -0
  274. package/data/words/be.js +2 -0
  275. package/data/words/bg.js +2 -0
  276. package/data/words/blo.js +2 -0
  277. package/data/words/bn.js +2 -0
  278. package/data/words/br.js +2 -0
  279. package/data/words/bs.js +2 -0
  280. package/data/words/ca-ES-valencia.js +2 -0
  281. package/data/words/ca.js +2 -0
  282. package/data/words/ccp.js +2 -0
  283. package/data/words/ceb.js +2 -0
  284. package/data/words/chr.js +2 -0
  285. package/data/words/ckb.js +2 -0
  286. package/data/words/cop.js +2 -0
  287. package/data/words/cs.js +2 -0
  288. package/data/words/cv.js +2 -0
  289. package/data/words/cy.js +2 -0
  290. package/data/words/da.js +2 -0
  291. package/data/words/de-CH.js +2 -0
  292. package/data/words/de.js +2 -0
  293. package/data/words/dsb.js +2 -0
  294. package/data/words/el.js +2 -0
  295. package/data/words/en-001.js +2 -0
  296. package/data/words/en-AU.js +2 -0
  297. package/data/words/en-CA.js +2 -0
  298. package/data/words/en-GB.js +2 -0
  299. package/data/words/en-IN.js +2 -0
  300. package/data/words/en.js +2 -0
  301. package/data/words/es-419.js +2 -0
  302. package/data/words/es-MX.js +2 -0
  303. package/data/words/es-US.js +2 -0
  304. package/data/words/es.js +2 -0
  305. package/data/words/et.js +2 -0
  306. package/data/words/eu.js +2 -0
  307. package/data/words/fa.js +2 -0
  308. package/data/words/ff-Adlm.js +2 -0
  309. package/data/words/ff.js +2 -0
  310. package/data/words/fi.js +2 -0
  311. package/data/words/fil.js +2 -0
  312. package/data/words/fo.js +2 -0
  313. package/data/words/fr-CA.js +2 -0
  314. package/data/words/fr.js +2 -0
  315. package/data/words/ga.js +2 -0
  316. package/data/words/gd.js +2 -0
  317. package/data/words/gl.js +2 -0
  318. package/data/words/gu.js +2 -0
  319. package/data/words/ha-NE.js +2 -0
  320. package/data/words/ha.js +2 -0
  321. package/data/words/he.js +2 -0
  322. package/data/words/hi-Latn.js +2 -0
  323. package/data/words/hi.js +2 -0
  324. package/data/words/hr.js +2 -0
  325. package/data/words/hsb.js +2 -0
  326. package/data/words/hu.js +2 -0
  327. package/data/words/hy.js +2 -0
  328. package/data/words/ia.js +2 -0
  329. package/data/words/id.js +2 -0
  330. package/data/words/ig.js +2 -0
  331. package/data/words/is.js +2 -0
  332. package/data/words/it.js +2 -0
  333. package/data/words/ja.js +2 -0
  334. package/data/words/jv.js +2 -0
  335. package/data/words/ka.js +2 -0
  336. package/data/words/kab.js +2 -0
  337. package/data/words/kk-Arab.js +2 -0
  338. package/data/words/kk.js +2 -0
  339. package/data/words/kl.js +2 -0
  340. package/data/words/km.js +2 -0
  341. package/data/words/kn.js +2 -0
  342. package/data/words/ko.js +2 -0
  343. package/data/words/kok.js +2 -0
  344. package/data/words/ku.js +2 -0
  345. package/data/words/ky.js +2 -0
  346. package/data/words/lb.js +2 -0
  347. package/data/words/lij.js +2 -0
  348. package/data/words/lo.js +2 -0
  349. package/data/words/lt.js +2 -0
  350. package/data/words/lv.js +2 -0
  351. package/data/words/mi.js +2 -0
  352. package/data/words/mk.js +2 -0
  353. package/data/words/ml.js +2 -0
  354. package/data/words/mn.js +2 -0
  355. package/data/words/mni.js +2 -0
  356. package/data/words/mr.js +2 -0
  357. package/data/words/ms.js +2 -0
  358. package/data/words/mt.js +2 -0
  359. package/data/words/my.js +2 -0
  360. package/data/words/ne.js +2 -0
  361. package/data/words/nl.js +2 -0
  362. package/data/words/nn.js +2 -0
  363. package/data/words/no.js +2 -0
  364. package/data/words/nso.js +2 -0
  365. package/data/words/oc.js +2 -0
  366. package/data/words/om.js +2 -0
  367. package/data/words/or.js +2 -0
  368. package/data/words/pa-Arab.js +2 -0
  369. package/data/words/pa.js +2 -0
  370. package/data/words/pcm.js +2 -0
  371. package/data/words/pl.js +2 -0
  372. package/data/words/ps.js +2 -0
  373. package/data/words/pt-PT.js +2 -0
  374. package/data/words/pt.js +2 -0
  375. package/data/words/qu.js +2 -0
  376. package/data/words/quc.js +2 -0
  377. package/data/words/rm.js +2 -0
  378. package/data/words/ro.js +2 -0
  379. package/data/words/ru.js +2 -0
  380. package/data/words/rw.js +2 -0
  381. package/data/words/sat.js +2 -0
  382. package/data/words/sc.js +2 -0
  383. package/data/words/sd.js +2 -0
  384. package/data/words/shn.js +2 -0
  385. package/data/words/si.js +2 -0
  386. package/data/words/sk.js +2 -0
  387. package/data/words/sl.js +2 -0
  388. package/data/words/so.js +2 -0
  389. package/data/words/sq.js +2 -0
  390. package/data/words/sr-Cyrl-BA.js +2 -0
  391. package/data/words/sr-Cyrl.js +2 -0
  392. package/data/words/sr-Latn-BA.js +2 -0
  393. package/data/words/sr-Latn.js +2 -0
  394. package/data/words/sr.js +2 -0
  395. package/data/words/su.js +2 -0
  396. package/data/words/sv-FI.js +2 -0
  397. package/data/words/sv.js +2 -0
  398. package/data/words/sw-KE.js +2 -0
  399. package/data/words/sw.js +2 -0
  400. package/data/words/syr.js +2 -0
  401. package/data/words/ta.js +2 -0
  402. package/data/words/te.js +2 -0
  403. package/data/words/tg.js +2 -0
  404. package/data/words/th.js +2 -0
  405. package/data/words/ti.js +2 -0
  406. package/data/words/tk.js +2 -0
  407. package/data/words/tn.js +2 -0
  408. package/data/words/to.js +2 -0
  409. package/data/words/tr.js +2 -0
  410. package/data/words/ug.js +2 -0
  411. package/data/words/uk.js +2 -0
  412. package/data/words/ur.js +2 -0
  413. package/data/words/uz.js +2 -0
  414. package/data/words/vec.js +2 -0
  415. package/data/words/vi.js +2 -0
  416. package/data/words/wo.js +2 -0
  417. package/data/words/xh.js +2 -0
  418. package/data/words/yo-BJ.js +2 -0
  419. package/data/words/yo.js +2 -0
  420. package/data/words/yue-Hans.js +2 -0
  421. package/data/words/yue.js +2 -0
  422. package/data/words/zh-Hant-HK.js +2 -0
  423. package/data/words/zh-Hant.js +2 -0
  424. package/data/words/zh.js +2 -0
  425. package/data/words/zu.js +2 -0
  426. package/dist/data.d.ts +22 -0
  427. package/dist/data.js +2 -0
  428. package/dist/index.d.ts +60 -0
  429. package/dist/index.js +272 -0
  430. package/dist/load.d.ts +15 -0
  431. package/dist/load.js +22 -0
  432. package/dist/text.d.ts +17 -0
  433. package/dist/text.js +52 -0
  434. package/dist/words.d.ts +36 -0
  435. package/dist/words.js +112 -0
  436. package/package.json +71 -4
  437. package/types/brands.d.ts +3 -0
  438. package/types/words.d.ts +3 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are listed here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0]
10
+
11
+ ### Added
12
+
13
+ - `createClassifier`: suggests one of the app's categories for a short title in any language, with a
14
+ confidence and the reasons, or `null` when unsure.
15
+ - History learning: exact repeats win, most recent first; similar past titles count when the data is unsure.
16
+ - `createEmojiFinder`: emoji for free text, without categories.
17
+ - `loadData`: lazy per-locale and per-country data chunks, with locale fallback.
18
+ - Data for 161 locales and 257 regions from Unicode CLDR 49, the iD tagging schema and the
19
+ OpenStreetMap name-suggestion-index.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Varun Biju
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,165 @@
1
- # Temporary Holding Version
1
+ # whatcategory
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Suggest which of **your app's categories** fits a short title, in any language:
4
+ "Bus to Goa", "Abendessen", "Stromrechnung", "タクシー代", "Biedronka zakupy".
5
+
6
+ - **Offline.** No LLM, no network call, no API key. The title never leaves the device.
7
+ - **Your categories.** There are no built-in categories. Describe each one with an emoji, words in any language, or both.
8
+ - **Learns from history.** Pass past choices and repeats are recognised, including local shops and slang that no open data knows.
9
+ - **Small and lazy.** Load only the locales and countries you need. ESM, TypeScript types, zero runtime dependencies, browsers and Node 18+.
10
+ - **Explains itself.** Every suggestion says why.
11
+
12
+ It works for expense splitters, budgets, to-do lists, notes, inventories, bookmarks: anything that files short text into a few buckets.
13
+
14
+ ```js
15
+ import { createClassifier, loadData, learn } from 'whatcategory'
16
+
17
+ const classifier = createClassifier({
18
+ categories: [
19
+ { id: 'food', emoji: '🍽️', words: ['Eating out'] },
20
+ { id: 'groceries', emoji: '🛒', words: ['Groceries'] },
21
+ { id: 'transport', emoji: '🚕', words: ['Transport'] },
22
+ { id: 'bills', words: ['Bills', 'Rechnungen'] },
23
+ ],
24
+ // The user's languages in order of preference, and their country for brand names.
25
+ data: await loadData({ locales: ['de', 'en'], regions: ['DE'] }),
26
+ })
27
+
28
+ classifier.suggest('Abendessen')
29
+ // → { id: 'food', confidence: 0.53, why: [{ layer: 'words', text: 'abendessen', match: '🍴', link: 'gabel', … }] }
30
+ classifier.suggest('Lidl') // → groceries: brand → shop/supermarket, which shares "grocery"
31
+ classifier.suggest('Stromrechnung') // → bills: "rechnung" inside the compound → 🧾
32
+ classifier.suggest('Sonstiges') // → null: not sure, so no suggestion
33
+
34
+ // History is plain JSON. Store it however you like.
35
+ let history = learn([], 'Bäckerei Müller', 'food')
36
+ classifier.suggest('Bäckerei Müller', history) // → { id: 'food', confidence: 1, why: [{ layer: 'history', … }] }
37
+ ```
38
+
39
+ ## Install
40
+
41
+ ```sh
42
+ npm install whatcategory
43
+ ```
44
+
45
+ ## Describing categories
46
+
47
+ ```ts
48
+ interface Category {
49
+ id: string // yours, returned as-is
50
+ emoji?: string // the strongest signal: '🍺'
51
+ words?: string[] // in any language, the category's name works: ['Drinks', 'Getränke']
52
+ }
53
+ ```
54
+
55
+ Give both when you can. An emoji is the strongest link, because emoji are annotated in every language. A name links
56
+ place types and brands: "Groceries" is what lets Lidl reach a 🛒 category. Words work in any loaded locale.
57
+ A category with only a vague name such as "Misc" or "Other" will rarely be suggested, and that's intended.
58
+
59
+ ## Data
60
+
61
+ | Import | Contents | Size (gzip) |
62
+ |---|---|---|
63
+ | `whatcategory/words/<locale>` | Emoji names and keywords ([Unicode CLDR](https://cldr.unicode.org)) and place-type names and search terms ([iD tagging schema](https://github.com/openstreetmap/id-tagging-schema)), for 161 locales | ~90 KB each |
64
+ | `whatcategory/brands/<COUNTRY>` | Brand, operator and transit-network names from the [OSM name-suggestion-index](https://nsi.guide), with what kind of place each is. `001` is worldwide | 5–105 KB each |
65
+
66
+ `loadData({ locales, regions })` picks chunks for you. It falls back from `de-AT` to `de`, skips unknown locales and always adds the worldwide brands. Each chunk is a separate module behind a literal `import()`, so Vite, webpack, esbuild and Node load only what you ask for. You can also import chunks directly and pass them as `data`.
67
+
68
+ Load the user's language first. Adding `en` helps when categories are described in English, and English is the best-covered locale.
69
+
70
+ ## API
71
+
72
+ ### `createClassifier({ categories, data, threshold? })`
73
+
74
+ Returns `{ suggest(title, history?), rank(title, history?) }`.
75
+
76
+ - `suggest` returns the best `Suggestion`, or `null` when confidence is below `threshold` (default `0.08`).
77
+ - `rank` returns every category with any evidence, best first.
78
+ - `Suggestion` is `{ id, confidence, why }`. `confidence` is the lead over the runner-up, from 0 to 1. `why` lists the evidence: `layer` (`history`, `brand`, `words` or `category`), the `text` that matched, the emoji or place type it matched (`match`), and how that links to the category (`link`: `anchor` or the shared word).
79
+
80
+ Setup takes about 100 ms for two locales and a country, and each suggestion about 1 ms. Create one classifier and reuse it.
81
+
82
+ ### History
83
+
84
+ `history` is an array of `{ title, categoryId, at? }` that you store. `learn(history, title, categoryId)` returns a new array.
85
+
86
+ - An exact repeat of a title wins, case- and accent-insensitively. The most recent wins, by `at` or else by array order.
87
+ - A past title that shares words ("Kamath Stores veggies" after "Kamath Stores") is used only when it is stronger evidence than the open data.
88
+ - Entries for category ids you no longer pass are ignored.
89
+
90
+ ### `createEmojiFinder(data)`
91
+
92
+ `find(title, limit = 5)` returns `[{ emoji, score }]` with no categories needed: `find('Gitarre')` gives 🎸. It uses only the words chunks.
93
+
94
+ ### Also exported
95
+
96
+ `loadData`, `resolveLocale`, `availableLocales`, `availableRegions`, `learn`, `tokens`, `fold`, and the types.
97
+
98
+ ## How it works
99
+
100
+ ```
101
+ title ─► history: exact repeat? ─────────────────────────────► past choice
102
+ │
103
+ ├─► split into words (Intl.Segmenter for ja/zh/th), lowercase, strip Latin/Greek/Cyrillic accents
104
+ ├─► brand names (longest first) "biedronka" ─► shop/supermarket
105
+ ├─► other words ─► concepts "zakupy" ─► 🛍 🛒 … (exact, inflected, or inside a compound)
106
+ │ concept = an emoji or an OSM place type, described by its words in every locale
107
+ ├─► concepts ─► your categories anchor (the category's emoji, or a concept its words name) = 1,
108
+ │ otherwise the most specific word they share
109
+ └─► confidence = lead over the runner-up; below threshold ─► null
110
+ (if a similar past title is stronger evidence, it wins)
111
+ ```
112
+
113
+ There are no hand-written word lists. Everything general comes from the data:
114
+
115
+ - **Specificity.** A word that describes hundreds of concepts ("face", "store") counts for little.
116
+ - **Phrase fragments.** A word that is never a name or keyword on its own anywhere in its locale ("and", "la", "का") counts for little.
117
+ - **Locale preference.** When a word exists in several loaded locales, the first locale wins (French "courses" is not English "courses").
118
+ - **Brands.** Weight comes from how many NSI items of each place type carry the name, and sub-brands count ("Tesco Extra" counts for "Tesco").
119
+
120
+ ## Accuracy
121
+
122
+ Measured on 541 hand-labelled titles in 19 languages (en, de, fr, es, it, pt, nl, pl, sv, ru, uk, el, tr, ar, hi, ja, zh, ko, th), including titles that should get no suggestion. Per-language numbers and every failure are in [eval/RESULTS.md](eval/RESULTS.md).
123
+
124
+ | Category set | Precision | Recall | No-suggestion correct | Best guess right (top-1) |
125
+ |---|---|---|---|---|
126
+ | Expenses: emoji + English name | 92% | 60% | 98% | 76% |
127
+ | Expenses: emoji only | 88% | 56% | 95% | 72% |
128
+ | To-do list | 85% | 36% | 83% | 58% |
129
+ | Home inventory: English words only | 81% | 36% | 60% | 66% |
130
+
131
+ **What this means:** when it suggests something, it is usually right. It stays silent on a third to a half of titles, and history fills those in for each user. Replaying one user's 26 expenses in order, history raised correct suggestions from 7 to 16.
132
+
133
+ The labels were written by the author, not by native speakers of all 19 languages. Corrections are welcome.
134
+
135
+ ## Limitations
136
+
137
+ - **Concepts without an emoji or place type** are mostly missed: rent, subscriptions, insurance, salary.
138
+ - **App and online brands** (Uber, Airbnb, Netflix, Swiggy) are not in OpenStreetMap data. History learns them after one use.
139
+ - **Ambiguous brands** (Shell, Tesco, Amazon) spread across what they sell, so confidence is low.
140
+ - **Typos** are not corrected ("Resturant").
141
+ - **Loose inflection matching** can link unrelated words that share a start ("Flug" and "Flügel").
142
+ - **Closely related categories** such as Groceries and Shopping, or Transport and Fuel, share vocabulary and get confused. Distinct emoji help.
143
+ - Scoring constants were tuned on the evaluation set above. Expect somewhat lower numbers on other titles.
144
+
145
+ ## Development
146
+
147
+ ```sh
148
+ npm ci
149
+ npm run build:data # generates data/ from the pinned upstream packages (~1 min)
150
+ npm test
151
+ npm run eval # rewrites eval/RESULTS.md; commit it with any change that moves the numbers
152
+ node eval/explain.ts "Stromrechnung" --lang de --region DE # see why a title scores the way it does
153
+ ```
154
+
155
+ The data build needs Node 22.18+ (it runs TypeScript directly). The published library runs on Node 18+ and modern browsers.
156
+ Upstream data is pinned in `package-lock.json` and in `upstream/emoji-test.txt`, and rebuilds are byte-for-byte deterministic. A weekly workflow refreshes the data and opens a pull request showing how the results changed.
157
+
158
+ ## Contributing
159
+
160
+ Wrong suggestions, new evaluation cases (especially from native speakers) and fixes are welcome. See
161
+ [CONTRIBUTING.md](CONTRIBUTING.md): the main rule is no hand-written word lists.
162
+
163
+ ## Licence
164
+
165
+ Code: MIT. Bundled data: Unicode License v3 (CLDR, emoji-test), ISC (iD tagging schema) and BSD-3-Clause (name-suggestion-index). See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,112 @@
1
+ # Third-party notices
2
+
3
+ The code of whatcategory is MIT-licensed (see LICENSE). The generated data in `data/` is derived from the
4
+ sources below and is distributed under their licences.
5
+
6
+ ## Unicode CLDR annotations (cldr-annotations-full 49.0.0, cldr-core 49.0.0)
7
+
8
+ Emoji names and keywords in data/words, and locale data used to build them.
9
+
10
+ COPYRIGHT AND PERMISSION NOTICE
11
+
12
+ Copyright © 2001–2026 Unicode, Inc.
13
+
14
+ Unicode Technical Standard #35, Unicode Locale Data Markup Language
15
+ (LDML) made available in this repository is protected by copyright, and
16
+ permission must be obtained from Unicode, Inc. prior to any
17
+ reproduction, modification, or other use not permitted by the Unicode
18
+ Terms of Use <https://www.unicode.org/copyright.html>. Specifically, you
19
+ may make copies of this publication and may annotate and translate it
20
+ solely for personal or internal business purposes and not for public
21
+ distribution, provided that any such permitted copies and modifications
22
+ fully reproduce all copyright and other legal notices contained in the
23
+ original. You may not make copies of or modifications to this
24
+ publication for public distribution, or incorporate it in whole or in
25
+ part into any product or publication without the express written
26
+ permission of Unicode. Notwithstanding the foregoing, you may within
27
+ this repository provide comments and propose changes to this standard
28
+ and may make copies/forks solely for such purposes provided that you
29
+ reproduce this copyright notice and these terms of use in any such
30
+ copy/fork.
31
+
32
+ All other content in this repo is released under UNICODE LICENSE V3
33
+
34
+ NOTICE TO USER: Carefully read the following legal agreement. BY
35
+ DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
36
+ SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
37
+ TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
38
+ DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining a
41
+ copy of data files and any associated documentation (the "Data Files") or
42
+ software and any associated documentation (the "Software") to deal in the
43
+ Data Files or Software without restriction, including without limitation
44
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
45
+ copies of the Data Files or Software, and to permit persons to whom the
46
+ Data Files or Software are furnished to do so, provided that either (a)
47
+ this copyright and permission notice appear with all copies of the Data
48
+ Files or Software, or (b) this copyright and permission notice appear in
49
+ associated Documentation.
50
+
51
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
52
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
54
+ THIRD PARTY RIGHTS.
55
+
56
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
57
+ BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
58
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
59
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
60
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
61
+ FILES OR SOFTWARE.
62
+
63
+ Except as contained in this notice, the name of a copyright holder shall
64
+ not be used in advertising or otherwise to promote the sale, use or other
65
+ dealings in these Data Files or Software without prior written
66
+ authorization of the copyright holder.
67
+
68
+ SPDX-License-Identifier: Unicode-3.0
69
+
70
+ ## Unicode emoji-test.txt (18.0)
71
+
72
+ The list of emoji and their subgroups. Same licence as CLDR above.
73
+
74
+ © Unicode, Inc. Unicode License v3, see above.
75
+
76
+ ## iD tagging schema (@openstreetmap/id-tagging-schema 7.3.0)
77
+
78
+ Place type names and search terms in data/words.
79
+
80
+ ISC License
81
+
82
+ Copyright (c) iD Contributors
83
+
84
+ Permission to use, copy, modify, and/or distribute this software for any
85
+ purpose with or without fee is hereby granted, provided that the above
86
+ copyright notice and this permission notice appear in all copies.
87
+
88
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
89
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
90
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
91
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
92
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
93
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
94
+ PERFORMANCE OF THIS SOFTWARE.
95
+
96
+ ## name-suggestion-index (9.0.20261121)
97
+
98
+ Brand, operator and network names in data/brands.
99
+
100
+ BSD 3-Clause
101
+
102
+ Copyright 2026, name-suggestion-index contributors
103
+
104
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
105
+
106
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
107
+
108
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
109
+
110
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
111
+
112
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.