entmatch 0.3.0rc1__tar.gz

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 (241) hide show
  1. entmatch-0.3.0rc1/.gitignore +31 -0
  2. entmatch-0.3.0rc1/LICENSE +202 -0
  3. entmatch-0.3.0rc1/PKG-INFO +393 -0
  4. entmatch-0.3.0rc1/README.md +268 -0
  5. entmatch-0.3.0rc1/THIRD_PARTY_NOTICES.md +36 -0
  6. entmatch-0.3.0rc1/pyproject.toml +133 -0
  7. entmatch-0.3.0rc1/src/entmatch/__init__.py +87 -0
  8. entmatch-0.3.0rc1/src/entmatch/__main__.py +7 -0
  9. entmatch-0.3.0rc1/src/entmatch/_brand.py +13 -0
  10. entmatch-0.3.0rc1/src/entmatch/_hashkey.py +50 -0
  11. entmatch-0.3.0rc1/src/entmatch/_hints.py +55 -0
  12. entmatch-0.3.0rc1/src/entmatch/_licences.py +42 -0
  13. entmatch-0.3.0rc1/src/entmatch/_model_hub.py +36 -0
  14. entmatch-0.3.0rc1/src/entmatch/_version.py +3 -0
  15. entmatch-0.3.0rc1/src/entmatch/abstain.py +25 -0
  16. entmatch-0.3.0rc1/src/entmatch/adapters/__init__.py +67 -0
  17. entmatch-0.3.0rc1/src/entmatch/adapters/dedupe_gaz.py +87 -0
  18. entmatch-0.3.0rc1/src/entmatch/adapters/gliner_labels.py +58 -0
  19. entmatch-0.3.0rc1/src/entmatch/adapters/sbert.py +87 -0
  20. entmatch-0.3.0rc1/src/entmatch/adapters/subprocess_gen.py +74 -0
  21. entmatch-0.3.0rc1/src/entmatch/adapters/xmen_gen.py +33 -0
  22. entmatch-0.3.0rc1/src/entmatch/agent/__init__.py +21 -0
  23. entmatch-0.3.0rc1/src/entmatch/agent/audit.py +78 -0
  24. entmatch-0.3.0rc1/src/entmatch/agent/runner.py +225 -0
  25. entmatch-0.3.0rc1/src/entmatch/agent/tools.py +81 -0
  26. entmatch-0.3.0rc1/src/entmatch/agent/types.py +64 -0
  27. entmatch-0.3.0rc1/src/entmatch/audit_ids.py +66 -0
  28. entmatch-0.3.0rc1/src/entmatch/batch.py +91 -0
  29. entmatch-0.3.0rc1/src/entmatch/builtin/__init__.py +1 -0
  30. entmatch-0.3.0rc1/src/entmatch/builtin/assign/__init__.py +4 -0
  31. entmatch-0.3.0rc1/src/entmatch/builtin/assign/basic.py +61 -0
  32. entmatch-0.3.0rc1/src/entmatch/builtin/assign/unique_mapping.py +47 -0
  33. entmatch-0.3.0rc1/src/entmatch/builtin/audit/__init__.py +1 -0
  34. entmatch-0.3.0rc1/src/entmatch/builtin/audit/jsonl.py +69 -0
  35. entmatch-0.3.0rc1/src/entmatch/builtin/calibrators/__init__.py +4 -0
  36. entmatch-0.3.0rc1/src/entmatch/builtin/calibrators/isotonic.py +92 -0
  37. entmatch-0.3.0rc1/src/entmatch/builtin/calibrators/platt.py +121 -0
  38. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/__init__.py +0 -0
  39. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/_common.py +86 -0
  40. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/date_window.py +50 -0
  41. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/directional.py +52 -0
  42. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/enum_map.py +39 -0
  43. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/fieldwise.py +53 -0
  44. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/levels.py +148 -0
  45. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/numeric_tol.py +57 -0
  46. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/relation.py +36 -0
  47. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/set_overlap.py +45 -0
  48. entmatch-0.3.0rc1/src/entmatch/builtin/comparators/tf_adjust.py +65 -0
  49. entmatch-0.3.0rc1/src/entmatch/builtin/deciders/__init__.py +3 -0
  50. entmatch-0.3.0rc1/src/entmatch/builtin/deciders/field_policy.py +212 -0
  51. entmatch-0.3.0rc1/src/entmatch/builtin/deciders/threshold.py +169 -0
  52. entmatch-0.3.0rc1/src/entmatch/builtin/embedders/__init__.py +13 -0
  53. entmatch-0.3.0rc1/src/entmatch/builtin/embedders/cache.py +59 -0
  54. entmatch-0.3.0rc1/src/entmatch/builtin/embedders/hashing.py +59 -0
  55. entmatch-0.3.0rc1/src/entmatch/builtin/embedders/http.py +102 -0
  56. entmatch-0.3.0rc1/src/entmatch/builtin/embedders/sbert.py +61 -0
  57. entmatch-0.3.0rc1/src/entmatch/builtin/explain/__init__.py +3 -0
  58. entmatch-0.3.0rc1/src/entmatch/builtin/explain/tokens.py +37 -0
  59. entmatch-0.3.0rc1/src/entmatch/builtin/fusion/__init__.py +4 -0
  60. entmatch-0.3.0rc1/src/entmatch/builtin/fusion/fusers.py +113 -0
  61. entmatch-0.3.0rc1/src/entmatch/builtin/fusion/rrf.py +54 -0
  62. entmatch-0.3.0rc1/src/entmatch/builtin/generators/__init__.py +18 -0
  63. entmatch-0.3.0rc1/src/entmatch/builtin/generators/_util.py +40 -0
  64. entmatch-0.3.0rc1/src/entmatch/builtin/generators/alias_exact.py +49 -0
  65. entmatch-0.3.0rc1/src/entmatch/builtin/generators/attribute_block.py +27 -0
  66. entmatch-0.3.0rc1/src/entmatch/builtin/generators/dense.py +326 -0
  67. entmatch-0.3.0rc1/src/entmatch/builtin/generators/fullscan.py +13 -0
  68. entmatch-0.3.0rc1/src/entmatch/builtin/generators/lexical.py +221 -0
  69. entmatch-0.3.0rc1/src/entmatch/builtin/generators/prior.py +138 -0
  70. entmatch-0.3.0rc1/src/entmatch/builtin/index/__init__.py +4 -0
  71. entmatch-0.3.0rc1/src/entmatch/builtin/index/flat.py +182 -0
  72. entmatch-0.3.0rc1/src/entmatch/builtin/index/persist.py +144 -0
  73. entmatch-0.3.0rc1/src/entmatch/builtin/index/rerank.py +125 -0
  74. entmatch-0.3.0rc1/src/entmatch/builtin/normalize/__init__.py +0 -0
  75. entmatch-0.3.0rc1/src/entmatch/builtin/normalize/default.py +26 -0
  76. entmatch-0.3.0rc1/src/entmatch/builtin/render.py +44 -0
  77. entmatch-0.3.0rc1/src/entmatch/builtin/rollups/__init__.py +0 -0
  78. entmatch-0.3.0rc1/src/entmatch/builtin/rollups/weighted_mean.py +49 -0
  79. entmatch-0.3.0rc1/src/entmatch/builtin/stores/__init__.py +1 -0
  80. entmatch-0.3.0rc1/src/entmatch/builtin/stores/file.py +101 -0
  81. entmatch-0.3.0rc1/src/entmatch/builtin/verify/__init__.py +20 -0
  82. entmatch-0.3.0rc1/src/entmatch/builtin/verify/guard.py +156 -0
  83. entmatch-0.3.0rc1/src/entmatch/builtin/verify/never_none.py +46 -0
  84. entmatch-0.3.0rc1/src/entmatch/builtin/verify/rules.py +96 -0
  85. entmatch-0.3.0rc1/src/entmatch/builtin/verify/sampling.py +41 -0
  86. entmatch-0.3.0rc1/src/entmatch/builtin/verify/voter.py +110 -0
  87. entmatch-0.3.0rc1/src/entmatch/business_weights.py +118 -0
  88. entmatch-0.3.0rc1/src/entmatch/canon/__init__.py +29 -0
  89. entmatch-0.3.0rc1/src/entmatch/canon/core.py +245 -0
  90. entmatch-0.3.0rc1/src/entmatch/canon/enum.py +253 -0
  91. entmatch-0.3.0rc1/src/entmatch/canon/infer.py +56 -0
  92. entmatch-0.3.0rc1/src/entmatch/catalog.py +935 -0
  93. entmatch-0.3.0rc1/src/entmatch/cli.py +220 -0
  94. entmatch-0.3.0rc1/src/entmatch/cli_catalog.py +110 -0
  95. entmatch-0.3.0rc1/src/entmatch/cli_v3.py +399 -0
  96. entmatch-0.3.0rc1/src/entmatch/code_channel.py +291 -0
  97. entmatch-0.3.0rc1/src/entmatch/config/__init__.py +23 -0
  98. entmatch-0.3.0rc1/src/entmatch/config/expr.py +87 -0
  99. entmatch-0.3.0rc1/src/entmatch/config/load.py +41 -0
  100. entmatch-0.3.0rc1/src/entmatch/config/schema.py +214 -0
  101. entmatch-0.3.0rc1/src/entmatch/contrib/__init__.py +1 -0
  102. entmatch-0.3.0rc1/src/entmatch/contrib/restricted/__init__.py +14 -0
  103. entmatch-0.3.0rc1/src/entmatch/contrib/workers/__init__.py +6 -0
  104. entmatch-0.3.0rc1/src/entmatch/contrib/workers/echo_worker.py +25 -0
  105. entmatch-0.3.0rc1/src/entmatch/contrib/workers/xmen_worker.py +53 -0
  106. entmatch-0.3.0rc1/src/entmatch/dedupe/__init__.py +8 -0
  107. entmatch-0.3.0rc1/src/entmatch/dedupe/api.py +133 -0
  108. entmatch-0.3.0rc1/src/entmatch/dedupe/blocking.py +90 -0
  109. entmatch-0.3.0rc1/src/entmatch/dedupe/cluster.py +139 -0
  110. entmatch-0.3.0rc1/src/entmatch/dedupe/family.py +249 -0
  111. entmatch-0.3.0rc1/src/entmatch/dedupe/scoring.py +77 -0
  112. entmatch-0.3.0rc1/src/entmatch/eval/__init__.py +27 -0
  113. entmatch-0.3.0rc1/src/entmatch/eval/bootstrap.py +95 -0
  114. entmatch-0.3.0rc1/src/entmatch/eval/calibration.py +119 -0
  115. entmatch-0.3.0rc1/src/entmatch/eval/cluster_metrics.py +65 -0
  116. entmatch-0.3.0rc1/src/entmatch/eval/golden.py +61 -0
  117. entmatch-0.3.0rc1/src/entmatch/eval/metrics.py +89 -0
  118. entmatch-0.3.0rc1/src/entmatch/eval/protocol.py +259 -0
  119. entmatch-0.3.0rc1/src/entmatch/eval/report.py +85 -0
  120. entmatch-0.3.0rc1/src/entmatch/eval/splits.py +122 -0
  121. entmatch-0.3.0rc1/src/entmatch/exact_rerank.py +376 -0
  122. entmatch-0.3.0rc1/src/entmatch/export.py +617 -0
  123. entmatch-0.3.0rc1/src/entmatch/extract/__init__.py +84 -0
  124. entmatch-0.3.0rc1/src/entmatch/extract/blocks.py +255 -0
  125. entmatch-0.3.0rc1/src/entmatch/extract/cascade.py +56 -0
  126. entmatch-0.3.0rc1/src/entmatch/extract/coerce.py +45 -0
  127. entmatch-0.3.0rc1/src/entmatch/extract/llm.py +221 -0
  128. entmatch-0.3.0rc1/src/entmatch/extract/ner.py +330 -0
  129. entmatch-0.3.0rc1/src/entmatch/extract/pdf_render.py +125 -0
  130. entmatch-0.3.0rc1/src/entmatch/extract/ports.py +61 -0
  131. entmatch-0.3.0rc1/src/entmatch/extract/regex.py +46 -0
  132. entmatch-0.3.0rc1/src/entmatch/extract/relations.py +81 -0
  133. entmatch-0.3.0rc1/src/entmatch/extract/roles.py +115 -0
  134. entmatch-0.3.0rc1/src/entmatch/extract/row_ner.py +62 -0
  135. entmatch-0.3.0rc1/src/entmatch/extract/schema_map.py +224 -0
  136. entmatch-0.3.0rc1/src/entmatch/extract/structure.py +241 -0
  137. entmatch-0.3.0rc1/src/entmatch/extract/table.py +106 -0
  138. entmatch-0.3.0rc1/src/entmatch/extract/testing.py +26 -0
  139. entmatch-0.3.0rc1/src/entmatch/extract/types.py +70 -0
  140. entmatch-0.3.0rc1/src/entmatch/facade.py +725 -0
  141. entmatch-0.3.0rc1/src/entmatch/feasibility.py +364 -0
  142. entmatch-0.3.0rc1/src/entmatch/gapfill/__init__.py +187 -0
  143. entmatch-0.3.0rc1/src/entmatch/genai/__init__.py +46 -0
  144. entmatch-0.3.0rc1/src/entmatch/genai/adapters/__init__.py +1 -0
  145. entmatch-0.3.0rc1/src/entmatch/genai/adapters/_common.py +21 -0
  146. entmatch-0.3.0rc1/src/entmatch/genai/adapters/anthropic.py +69 -0
  147. entmatch-0.3.0rc1/src/entmatch/genai/adapters/bedrock.py +67 -0
  148. entmatch-0.3.0rc1/src/entmatch/genai/adapters/local_openai.py +91 -0
  149. entmatch-0.3.0rc1/src/entmatch/genai/adapters/openai.py +64 -0
  150. entmatch-0.3.0rc1/src/entmatch/genai/batch.py +217 -0
  151. entmatch-0.3.0rc1/src/entmatch/genai/cache.py +63 -0
  152. entmatch-0.3.0rc1/src/entmatch/genai/client.py +65 -0
  153. entmatch-0.3.0rc1/src/entmatch/genai/cost.py +50 -0
  154. entmatch-0.3.0rc1/src/entmatch/genai/fake.py +44 -0
  155. entmatch-0.3.0rc1/src/entmatch/genai/managed.py +96 -0
  156. entmatch-0.3.0rc1/src/entmatch/genai/prompts.py +55 -0
  157. entmatch-0.3.0rc1/src/entmatch/genai/redact.py +49 -0
  158. entmatch-0.3.0rc1/src/entmatch/genai/types.py +67 -0
  159. entmatch-0.3.0rc1/src/entmatch/glossary/__init__.py +32 -0
  160. entmatch-0.3.0rc1/src/entmatch/glossary/apply.py +117 -0
  161. entmatch-0.3.0rc1/src/entmatch/glossary/miners.py +204 -0
  162. entmatch-0.3.0rc1/src/entmatch/glossary/models.py +66 -0
  163. entmatch-0.3.0rc1/src/entmatch/glossary/normalizer.py +57 -0
  164. entmatch-0.3.0rc1/src/entmatch/glossary/pack.py +346 -0
  165. entmatch-0.3.0rc1/src/entmatch/glossary/registry.py +168 -0
  166. entmatch-0.3.0rc1/src/entmatch/glossary/researcher.py +126 -0
  167. entmatch-0.3.0rc1/src/entmatch/glossary/unknown.py +364 -0
  168. entmatch-0.3.0rc1/src/entmatch/hub.py +190 -0
  169. entmatch-0.3.0rc1/src/entmatch/intake/__init__.py +46 -0
  170. entmatch-0.3.0rc1/src/entmatch/intake/adapters.py +213 -0
  171. entmatch-0.3.0rc1/src/entmatch/intake/cognitive.py +71 -0
  172. entmatch-0.3.0rc1/src/entmatch/intake/context.py +52 -0
  173. entmatch-0.3.0rc1/src/entmatch/intake/document.py +69 -0
  174. entmatch-0.3.0rc1/src/entmatch/intake/forwarded.py +146 -0
  175. entmatch-0.3.0rc1/src/entmatch/intake/router.py +180 -0
  176. entmatch-0.3.0rc1/src/entmatch/interop/__init__.py +0 -0
  177. entmatch-0.3.0rc1/src/entmatch/interop/networkx.py +25 -0
  178. entmatch-0.3.0rc1/src/entmatch/kpack.py +280 -0
  179. entmatch-0.3.0rc1/src/entmatch/lazy.py +225 -0
  180. entmatch-0.3.0rc1/src/entmatch/learn/__init__.py +20 -0
  181. entmatch-0.3.0rc1/src/entmatch/learn/base.py +103 -0
  182. entmatch-0.3.0rc1/src/entmatch/learn/ensemble.py +81 -0
  183. entmatch-0.3.0rc1/src/entmatch/learn/estimators.py +168 -0
  184. entmatch-0.3.0rc1/src/entmatch/learn/level_weights.py +44 -0
  185. entmatch-0.3.0rc1/src/entmatch/learn/pipeline.py +165 -0
  186. entmatch-0.3.0rc1/src/entmatch/local/__init__.py +28 -0
  187. entmatch-0.3.0rc1/src/entmatch/local/cli.py +89 -0
  188. entmatch-0.3.0rc1/src/entmatch/local/embed.py +86 -0
  189. entmatch-0.3.0rc1/src/entmatch/local/errors.py +47 -0
  190. entmatch-0.3.0rc1/src/entmatch/local/ollama.py +215 -0
  191. entmatch-0.3.0rc1/src/entmatch/match_report.py +212 -0
  192. entmatch-0.3.0rc1/src/entmatch/matcher.py +238 -0
  193. entmatch-0.3.0rc1/src/entmatch/models/__init__.py +51 -0
  194. entmatch-0.3.0rc1/src/entmatch/models/_backend.py +84 -0
  195. entmatch-0.3.0rc1/src/entmatch/models/base.py +7 -0
  196. entmatch-0.3.0rc1/src/entmatch/models/comparison.py +54 -0
  197. entmatch-0.3.0rc1/src/entmatch/models/decision.py +85 -0
  198. entmatch-0.3.0rc1/src/entmatch/models/entity.py +93 -0
  199. entmatch-0.3.0rc1/src/entmatch/models/frame.py +489 -0
  200. entmatch-0.3.0rc1/src/entmatch/models/graph.py +212 -0
  201. entmatch-0.3.0rc1/src/entmatch/models/reason_report.py +41 -0
  202. entmatch-0.3.0rc1/src/entmatch/models/reasons.py +42 -0
  203. entmatch-0.3.0rc1/src/entmatch/models/relations.py +71 -0
  204. entmatch-0.3.0rc1/src/entmatch/nil_detector.py +141 -0
  205. entmatch-0.3.0rc1/src/entmatch/onboard.py +243 -0
  206. entmatch-0.3.0rc1/src/entmatch/plugins.py +33 -0
  207. entmatch-0.3.0rc1/src/entmatch/ports/__init__.py +41 -0
  208. entmatch-0.3.0rc1/src/entmatch/ports/assign.py +40 -0
  209. entmatch-0.3.0rc1/src/entmatch/ports/business_policy.py +65 -0
  210. entmatch-0.3.0rc1/src/entmatch/ports/comparator.py +35 -0
  211. entmatch-0.3.0rc1/src/entmatch/ports/embedder.py +51 -0
  212. entmatch-0.3.0rc1/src/entmatch/ports/explain.py +29 -0
  213. entmatch-0.3.0rc1/src/entmatch/ports/fuser.py +28 -0
  214. entmatch-0.3.0rc1/src/entmatch/ports/generator.py +45 -0
  215. entmatch-0.3.0rc1/src/entmatch/ports/scorer.py +54 -0
  216. entmatch-0.3.0rc1/src/entmatch/ports/verify.py +46 -0
  217. entmatch-0.3.0rc1/src/entmatch/py.typed +0 -0
  218. entmatch-0.3.0rc1/src/entmatch/registry/__init__.py +1 -0
  219. entmatch-0.3.0rc1/src/entmatch/registry/diff.py +134 -0
  220. entmatch-0.3.0rc1/src/entmatch/registry/drift.py +124 -0
  221. entmatch-0.3.0rc1/src/entmatch/registry/ingest.py +44 -0
  222. entmatch-0.3.0rc1/src/entmatch/registry/judgements.py +231 -0
  223. entmatch-0.3.0rc1/src/entmatch/registry/replay.py +153 -0
  224. entmatch-0.3.0rc1/src/entmatch/registry/snapshot.py +100 -0
  225. entmatch-0.3.0rc1/src/entmatch/registry/table_ingest.py +160 -0
  226. entmatch-0.3.0rc1/src/entmatch/scaffold.py +106 -0
  227. entmatch-0.3.0rc1/src/entmatch/semantic_rules.py +325 -0
  228. entmatch-0.3.0rc1/src/entmatch/serve/__init__.py +24 -0
  229. entmatch-0.3.0rc1/src/entmatch/serve/app.py +256 -0
  230. entmatch-0.3.0rc1/src/entmatch/serve/cli.py +116 -0
  231. entmatch-0.3.0rc1/src/entmatch/shadow.py +273 -0
  232. entmatch-0.3.0rc1/src/entmatch/testing/__init__.py +0 -0
  233. entmatch-0.3.0rc1/src/entmatch/testing/conformance/__init__.py +0 -0
  234. entmatch-0.3.0rc1/src/entmatch/testing/conformance/generator.py +41 -0
  235. entmatch-0.3.0rc1/src/entmatch/uncertainty/__init__.py +16 -0
  236. entmatch-0.3.0rc1/src/entmatch/uncertainty/conformal.py +178 -0
  237. entmatch-0.3.0rc1/src/entmatch/uncertainty/selective.py +81 -0
  238. entmatch-0.3.0rc1/src/entmatch/units/__init__.py +37 -0
  239. entmatch-0.3.0rc1/src/entmatch/units/normalizer.py +246 -0
  240. entmatch-0.3.0rc1/src/entmatch/units/rates.py +108 -0
  241. entmatch-0.3.0rc1/src/entmatch/verbs.py +148 -0
@@ -0,0 +1,31 @@
1
+ .venv*/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ .pytest_cache/
8
+ .coverage
9
+ .hypothesis/
10
+ *.pyc
11
+ build/
12
+ /site/
13
+ experiments/out/
14
+
15
+ experiments/data/
16
+ experiments/out/
17
+
18
+ .worktrees/
19
+ scratch/
20
+ .venv*/
21
+ *.npz
22
+ *.safetensors
23
+ *.gguf
24
+ *.bin
25
+ *.pt
26
+ *.onnx
27
+
28
+ experiments/catalog-hard-v1/data/
29
+ # training pipeline outputs / data snapshots (experiments/train)
30
+ experiments/train/runs/
31
+ experiments/train/data/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,393 @@
1
+ Metadata-Version: 2.5
2
+ Name: entmatch
3
+ Version: 0.3.0rc1
4
+ Summary: Typed, calibrated, auditable entity matching and comparison library.
5
+ Project-URL: Source, https://github.com/CreAI-mx/match
6
+ Project-URL: Changelog, https://github.com/CreAI-mx/match/blob/master/CHANGELOG.md
7
+ Author: CreAI-mx
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: THIRD_PARTY_NOTICES.md
11
+ Keywords: dedupe,embeddings,entity-linking,entity-matching,record-linkage
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: numpy>=1.26
24
+ Requires-Dist: pydantic<3,>=2.6
25
+ Requires-Dist: pyyaml>=6.0
26
+ Provides-Extra: all
27
+ Requires-Dist: anthropic>=0.30; extra == 'all'
28
+ Requires-Dist: boto3>=1.34; extra == 'all'
29
+ Requires-Dist: faiss-cpu>=1.8; extra == 'all'
30
+ Requires-Dist: fastapi>=0.110; extra == 'all'
31
+ Requires-Dist: gliner>=0.2; extra == 'all'
32
+ Requires-Dist: hnswlib>=0.8; extra == 'all'
33
+ Requires-Dist: networkx>=3; extra == 'all'
34
+ Requires-Dist: openai>=1.30; extra == 'all'
35
+ Requires-Dist: openpyxl>=3.1; extra == 'all'
36
+ Requires-Dist: pandas>=2; extra == 'all'
37
+ Requires-Dist: pdf2image>=1.17; extra == 'all'
38
+ Requires-Dist: pillow>=10; extra == 'all'
39
+ Requires-Dist: polars>=1; extra == 'all'
40
+ Requires-Dist: pyarrow>=14; extra == 'all'
41
+ Requires-Dist: pypdf>=4; extra == 'all'
42
+ Requires-Dist: pypdfium2>=4; extra == 'all'
43
+ Requires-Dist: rapidfuzz>=3; extra == 'all'
44
+ Requires-Dist: sentence-transformers>=3; extra == 'all'
45
+ Requires-Dist: sentence-transformers>=6.3; extra == 'all'
46
+ Requires-Dist: spacy>=3.7; extra == 'all'
47
+ Requires-Dist: torch>=2; extra == 'all'
48
+ Requires-Dist: transformers>=4.40; extra == 'all'
49
+ Requires-Dist: uvicorn>=0.29; extra == 'all'
50
+ Provides-Extra: anthropic
51
+ Requires-Dist: anthropic>=0.30; extra == 'anthropic'
52
+ Provides-Extra: arrow
53
+ Requires-Dist: pyarrow>=14; extra == 'arrow'
54
+ Provides-Extra: assign
55
+ Requires-Dist: scipy>=1.11; extra == 'assign'
56
+ Provides-Extra: bedrock
57
+ Requires-Dist: boto3>=1.34; extra == 'bedrock'
58
+ Provides-Extra: dedupe
59
+ Requires-Dist: btrees<6; extra == 'dedupe'
60
+ Requires-Dist: dedupe>=3; extra == 'dedupe'
61
+ Provides-Extra: dev
62
+ Requires-Dist: build; extra == 'dev'
63
+ Requires-Dist: httpx>=0.27; extra == 'dev'
64
+ Requires-Dist: hypothesis>=6; extra == 'dev'
65
+ Requires-Dist: mypy>=1.10; extra == 'dev'
66
+ Requires-Dist: pandas-stubs; extra == 'dev'
67
+ Requires-Dist: pandas>=2; extra == 'dev'
68
+ Requires-Dist: pytest>=8; extra == 'dev'
69
+ Requires-Dist: ruff>=0.5; extra == 'dev'
70
+ Requires-Dist: twine>=5; extra == 'dev'
71
+ Provides-Extra: docs
72
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
73
+ Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
74
+ Provides-Extra: faiss
75
+ Requires-Dist: faiss-cpu>=1.8; extra == 'faiss'
76
+ Provides-Extra: fast
77
+ Requires-Dist: faiss-cpu>=1.8; extra == 'fast'
78
+ Requires-Dist: rapidfuzz>=3; extra == 'fast'
79
+ Provides-Extra: gliner
80
+ Requires-Dist: gliner>=0.2; extra == 'gliner'
81
+ Provides-Extra: graph
82
+ Requires-Dist: networkx>=3; extra == 'graph'
83
+ Provides-Extra: hnsw
84
+ Requires-Dist: hnswlib>=0.8; extra == 'hnsw'
85
+ Provides-Extra: lite
86
+ Requires-Dist: openpyxl>=3.1; extra == 'lite'
87
+ Requires-Dist: pandas>=2; extra == 'lite'
88
+ Requires-Dist: rapidfuzz>=3; extra == 'lite'
89
+ Provides-Extra: local
90
+ Requires-Dist: sentence-transformers>=3; extra == 'local'
91
+ Provides-Extra: openai
92
+ Requires-Dist: openai>=1.30; extra == 'openai'
93
+ Provides-Extra: pandas
94
+ Requires-Dist: pandas>=2; extra == 'pandas'
95
+ Provides-Extra: pdf
96
+ Requires-Dist: pdf2image>=1.17; extra == 'pdf'
97
+ Requires-Dist: pillow>=10; extra == 'pdf'
98
+ Requires-Dist: pypdf>=4; extra == 'pdf'
99
+ Requires-Dist: pypdfium2>=4; extra == 'pdf'
100
+ Provides-Extra: polars
101
+ Requires-Dist: polars>=1; extra == 'polars'
102
+ Provides-Extra: r2
103
+ Requires-Dist: huggingface-hub>=0.24; extra == 'r2'
104
+ Requires-Dist: sentence-transformers>=6.3; extra == 'r2'
105
+ Provides-Extra: sbert
106
+ Requires-Dist: sentence-transformers>=3; extra == 'sbert'
107
+ Provides-Extra: serve
108
+ Requires-Dist: fastapi>=0.110; extra == 'serve'
109
+ Requires-Dist: sentence-transformers>=6.3; extra == 'serve'
110
+ Requires-Dist: uvicorn>=0.29; extra == 'serve'
111
+ Provides-Extra: spacy
112
+ Requires-Dist: spacy>=3.7; extra == 'spacy'
113
+ Provides-Extra: tables
114
+ Requires-Dist: pillow>=10; extra == 'tables'
115
+ Requires-Dist: torch>=2; extra == 'tables'
116
+ Requires-Dist: transformers>=4.40; extra == 'tables'
117
+ Provides-Extra: train
118
+ Requires-Dist: scikit-learn>=1.3; extra == 'train'
119
+ Requires-Dist: sentence-transformers[train]>=3; extra == 'train'
120
+ Requires-Dist: torch>=2; extra == 'train'
121
+ Provides-Extra: xlsx
122
+ Requires-Dist: openpyxl>=3.1; extra == 'xlsx'
123
+ Requires-Dist: pandas>=2; extra == 'xlsx'
124
+ Description-Content-Type: text/markdown
125
+
126
+ # entmatch
127
+
128
+ <p align="center"><b>Typed, calibrated, auditable entity matching and comparison library.</b><br>
129
+ Domain-agnostic. Core deps: pydantic v2 + numpy.</p>
130
+
131
+ <p align="center">
132
+ <img alt="python" src="https://img.shields.io/badge/python-3.11%2B-4f46e5">
133
+ <img alt="licence" src="https://img.shields.io/badge/licence-Apache--2.0-0d9488">
134
+ <img alt="mypy" src="https://img.shields.io/badge/mypy-strict-4f46e5">
135
+ <img alt="deps" src="https://img.shields.io/badge/core%20deps-3-64748b">
136
+ </p>
137
+
138
+ [Install](#install) | [Quickstart](#60-second-quickstart) | [CLI](#outputs)
139
+
140
+ Pre-release (alpha). Links to `github.com/CreAI-mx/match` point to the source repository, which is private: they open only with access.
141
+
142
+ ---
143
+
144
+ ## What it does
145
+
146
+ You give entmatch a messy line of text and a catalog of official entries. It returns the entry it thinks you meant, a confidence from 0 to 100%, and one decision: **Sure**, **Not sure** or **Not in catalog**. When it is unsure, it says so and asks a human, instead of guessing.
147
+
148
+ Messy input goes in; a decision with a confidence comes out.
149
+
150
+ ---
151
+
152
+ ## Business glossary: teach entmatch your company's words
153
+
154
+ Clients write `GFR`, `TDC`, `SAT`, `x`, brand names and internal codes. No model can guess them. The **business glossary** is a file where you register what those terms mean (acronyms, synonyms, brands, codes, `value_map` yes/no values). Domain terms are expanded before scoring, so the ranker sees both forms.
155
+
156
+ - **Deterministic**: exact term lookup, no model call, no training.
157
+ - **Only `status=approved` rows act.** Proposed and rejected rows are ignored. An empty status counts as approved (a human wrote the row).
158
+ - **No acronym is assumed.** Unknown terms are listed in `unknown_terms.md` on every run for the client to answer.
159
+ - **No glossary = byte-identical output** (empty file or only non-approved rows too).
160
+
161
+ Register it (file formats `.csv`, `.tsv`, `.yaml`/`.yml`, `.json`; columns `term, expansion, type, field, client, direction, lang, status`):
162
+
163
+ ```csv
164
+ term,expansion,type,field,client,direction,lang,status
165
+ GFR,Gerencia de Finanzas Regional,acronym,departamento,,both,es,approved
166
+ @bool,,value_map,activo,,,,approved
167
+ ```
168
+
169
+ ```python
170
+ from entmatch import Catalog
171
+ rows = [{"term": "GFR", "expansion": "Gerencia de Finanzas Regional", "type": "acronym",
172
+ "field": "departamento", "status": "approved"}]
173
+ cat = Catalog(generator="lexical", glossary=rows) # or glossary="glossary.csv"
174
+ ```
175
+
176
+ Command line (works on the base install; add `--client NAME` for client-scoped rows):
177
+
178
+ ```bash
179
+ entmatch match --preset lexical --catalog refs.jsonl --queries queries.csv --out out/results.csv --glossary glossary.csv
180
+ ```
181
+
182
+ `refs.jsonl` holds one catalog entry per line (`{"id": "o1", "name": "Acme Industries"}`); `queries.csv` needs a `query` column.
183
+
184
+ Measured (R2 frozen protocol, English, `acronym_collision`, n=750, synthetic): top-1 0.129 off -> 0.973 with glossary alone. Warning from the same run: enabling every feature together (`all_on`) fell to 0.001 (cause unknown). Turn features on one at a time and measure. A later lexical run did not reproduce the drop (`all_on` 1.000), so the R2 loss is an open item. Synthetic data, not client data.
185
+
186
+ Full reference (file format, scoping, unknown-terms loop, caveats): [docs/skill/references/glossary.md](https://github.com/CreAI-mx/match/blob/master/docs/skill/references/glossary.md).
187
+
188
+ ---
189
+
190
+ ## Install
191
+
192
+ ```bash
193
+ pip install entmatch
194
+ ```
195
+
196
+ While only pre-releases exist you can pin one: `pip install entmatch==0.3.0rc1`.
197
+
198
+ | Extra | Adds |
199
+ |---|---|
200
+ | `entmatch[xlsx]` | `.xlsx` input and output |
201
+ | `entmatch[lite]` | xlsx / pandas ingest and a faster lexical matcher, no torch |
202
+ | `entmatch[r2]` | ENTMATCH-R2 model |
203
+ | `entmatch[serve]` | ENTMATCH-R2 plus HTTP API (CPU) |
204
+
205
+ The trained ENTMATCH-R2 model ([felipedjrg3/entmatch-r2](https://huggingface.co/felipedjrg3/entmatch-r2), 2.4 GB) is not inside the package: with `[r2]` or `[serve]` it downloads on first use, then runs offline. CPU only, no GPU. For CPU-only torch, install it first from the PyTorch CPU index.
206
+
207
+ The source repository also ships a coding-agent skill ([docs/skill](https://github.com/CreAI-mx/match/blob/master/docs/skill/SKILL.md)) with playbooks and a quality gate; it is not part of the package.
208
+
209
+ ---
210
+
211
+ ## How it works
212
+
213
+ Real output of [hero_plans.py](https://github.com/CreAI-mx/match/blob/master/docs/examples/hero_plans.py), offline basic mode.
214
+
215
+ <table width="100%">
216
+ <tr>
217
+ <th align="left">What was typed</th>
218
+ <th align="left">Decision</th>
219
+ <th align="left">Catalog entry</th>
220
+ <th align="right">Confidence</th>
221
+ </tr>
222
+ <tr><td><code>INV-2291 | GOLD PLUS PPO | 2026 | $412.00</code></td><td>🟢 Sure</td><td>GOLD-PPO</td><td align="right">91%</td></tr>
223
+ <tr><td><code>Hola, el empleado pasa al plan Oro Plus PPO…</code></td><td>🟡 Not sure</td><td>GOLD-PPO (probably)</td><td align="right">75%</td></tr>
224
+ <tr><td><code>Gold Plus</code></td><td>🟡 Not sure</td><td>GOLD-PPO or GOLD-HMO?</td><td align="right">63%</td></tr>
225
+ <tr><td><code>Platinum Max EPO</code></td><td>⚪ Not in catalog</td><td>none</td><td align="right">32%</td></tr>
226
+ </table>
227
+
228
+ Scores of the 4 inputs above against the default thresholds. Source: [QUICKSTARTS.md](https://github.com/CreAI-mx/match/blob/master/docs/examples/QUICKSTARTS.md).
229
+
230
+ Default thresholds ([threshold.py:32-34](https://github.com/CreAI-mx/match/blob/master/src/entmatch/builtin/deciders/threshold.py)): Sure >= 80% (`match`), Not sure 50-80% (`review`), Not in catalog < 50% (`abstain`).
231
+
232
+ ---
233
+
234
+ ## Results on 100 records
235
+
236
+ Run with the benchmark script in the source repository (not part of the package).
237
+
238
+ <table width="100%">
239
+ <tr>
240
+ <th align="left">100 synthetic inputs vs a 100-entry catalog (85 in it, 15 not)</th>
241
+ <th align="right">ENTMATCH-R2</th>
242
+ <th align="right">Lexical baseline</th>
243
+ </tr>
244
+ <tr><td>Top-1 accuracy (the 85 in catalog)</td><td align="right">97.6% (83/85)</td><td align="right">80.0%</td></tr>
245
+ <tr><td>Auto-accept precision</td><td align="right">100.0% (30/30)</td><td align="right">79.2% (19/24)</td></tr>
246
+ <tr><td>Not-in-catalog auto-rejected (of 15)</td><td align="right">0 (all 15 sent to review)</td><td align="right">0</td></tr>
247
+ </table>
248
+
249
+ Synthetic data, n=100, 70 of 100 went to a human. Source: [bench100 results](https://github.com/CreAI-mx/match/blob/master/docs/examples/bench100/README.md) (3 identical runs, CPU).
250
+
251
+ ---
252
+
253
+ ## 60-second quickstart
254
+
255
+ After [install](#install). No extra needed.
256
+
257
+ ```python
258
+ import entmatch as em
259
+
260
+ # The catalog: the official list you match against.
261
+ catalog = [
262
+ {"id": "o1", "name": "Acme Industries", "aliases": ["ACME Ind."]},
263
+ {"id": "o2", "name": "Borealis Logistics"},
264
+ {"id": "o3", "name": "Cobalt Mining Co"},
265
+ ]
266
+
267
+ # Link messy names (one or many) to catalog entries.
268
+ found, typo, unknown = em.link(["Acme Industries Inc", "Borealis Logistic", "Zzz Unknown Ltd"], catalog)
269
+
270
+ # Each result has .chosen_id: the catalog id, or None when nothing fits.
271
+ print(found.chosen_id) # o1 -> matched
272
+ print(typo.chosen_id) # o2 -> matched despite the typo
273
+ print(unknown.chosen_id) # None -> not in the catalog
274
+ print(em.explain(found)) # why, in plain words
275
+ ```
276
+
277
+ <details>
278
+ <summary><b>More examples</b> (rank with history, reconcile documents, run all)</summary>
279
+
280
+ See [QUICKSTARTS.md](https://github.com/CreAI-mx/match/blob/master/docs/examples/QUICKSTARTS.md).
281
+
282
+ </details>
283
+
284
+ ---
285
+
286
+ ## Outputs
287
+
288
+ One result per input. Pick the view: JSONL for code, CSV for a reviewer, XLSX for an owner, Markdown for a PR.
289
+
290
+ ```bash
291
+ # many inputs from a file -> one row per input, top-5 candidates side by side, empty reviewer column
292
+ entmatch match --preset lexical --catalog refs.jsonl --queries queries.csv --out review.csv
293
+ ```
294
+
295
+ Without `--preset` the CLI uses `entmatch-r2`, which needs `pip install "entmatch[serve]"`.
296
+
297
+ <table width="100%">
298
+ <tr><th align="left">Format</th><th align="left">What you get</th><th align="left">How</th></tr>
299
+ <tr><td><code>jsonl</code></td><td>Raw result dicts, every field</td><td>default (stdout) or <code>--out r.jsonl</code></td></tr>
300
+ <tr><td><code>csv</code></td><td>1 row per input, top-5 flattened, plain-words reason, empty <code>reviewer_decision</code></td><td><code>--out r.csv</code></td></tr>
301
+ <tr><td><code>csv-long</code></td><td>1 row per (input, rank): pivot-ready</td><td><code>--out r.csv --format csv-long</code></td></tr>
302
+ <tr><td><code>xlsx</code></td><td>summary + results (colour per decision) + topk sheets</td><td><code>--out r.xlsx</code> (<code>[xlsx]</code> extra)</td></tr>
303
+ <tr><td><code>md</code></td><td>Report: counts, thresholds, alerts, top-5 per input</td><td><code>--out r.md</code></td></tr>
304
+ </table>
305
+
306
+ <p align="center"><sub>All fields, a real input vs the registered catalog with its top-5, and the cost per format: <a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/outputs.md">outputs.md</a>.</sub></p>
307
+
308
+ ---
309
+
310
+ ## Architecture
311
+
312
+ One base model, **R2** (preset `entmatch-r2`), finds the top candidates. A **client rules layer after R2** applies each client's knowledge (glossary, typed values, field weights, filters, never-match pairs) without retraining R2. Every client stage is off by default: off = byte-identical output.
313
+
314
+ Flow: messy input -> glossary expand -> R2 top-K retrieval -> client rules layer (canon, weights, filters, must_match, never_match) -> calibrator and thresholds -> `match` / `review` / `nil` + outputs. Unknown terms go to a reviewer, whose answers feed the knowledge pack used by the glossary and rules.
315
+
316
+ Full ladder (one diagram per level), stage table, which rule wins when rules conflict, and what is parked: [architecture.md](https://github.com/CreAI-mx/match/blob/master/docs/skill/references/architecture.md).
317
+
318
+ ## Features
319
+
320
+ <table width="100%">
321
+ <tr><th align="left">Feature</th><th align="left">Status</th><th align="left">Docs</th></tr>
322
+ <tr><td>R2 retrieval, calibrated decision <code>match</code> / <code>review</code> / <code>nil</code>, NIL detector</td><td>on</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/nil-and-abstain.md">nil-and-abstain</a></td></tr>
323
+ <tr><td>Export <code>jsonl</code> / <code>csv</code> / <code>csv-long</code> / <code>xlsx</code> / <code>md</code></td><td>on</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/outputs.md">outputs</a></td></tr>
324
+ <tr><td>Unknown terms report on every <code>entmatch match</code> run</td><td>on</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/glossary.md">glossary</a></td></tr>
325
+ <tr><td>Client glossary (acronyms, codes, yes/no values), field and client scoped</td><td>opt-in</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/glossary.md">glossary</a></td></tr>
326
+ <tr><td>Typed value canon (bool, date, number, money, unit, phone, id)</td><td>opt-in</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/values.md">values</a></td></tr>
327
+ <tr><td>Business field weights and <code>must_match</code></td><td>opt-in</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/business-weights.md">business-weights</a></td></tr>
328
+ <tr><td>Semantic weights, category filters, <code>agreement</code>, <code>discard_if_differs</code></td><td>opt-in</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/semantic-rules.md">semantic-rules</a></td></tr>
329
+ <tr><td>Versioned client knowledge pack (overlays, never-match, rollback), <code>entmatch pack</code></td><td>opt-in</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/knowledge-pack.md">knowledge-pack</a></td></tr>
330
+ <tr><td>Exact code / ID channel</td><td>opt-in</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/feature-inventory.md">feature-inventory</a></td></tr>
331
+ <tr><td>Eval protocol (prereg, exact McNemar, headroom, seeds, calibration)</td><td>dev tool</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/eval-protocol.md">eval-protocol</a></td></tr>
332
+ <tr><td>Learned client reranker (L2)</td><td>parked</td><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/GRAVEYARD.md">GRAVEYARD</a></td></tr>
333
+ </table>
334
+
335
+ <p align="center"><sub>Full status with evidence and numbers per feature: <a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/feature-inventory.md">feature-inventory.md</a>.</sub></p>
336
+
337
+ ---
338
+
339
+ ## Supported languages
340
+
341
+ | language | status | evidence |
342
+ |---|---|---|
343
+ | English | measured | R2 frozen protocol, 5 seeds, n=750 per cell |
344
+ | Spanish | measured | same protocol and slices |
345
+ | mixed Spanish/English input | unmeasured | no mixed-language slice exists |
346
+ | other languages | unmeasured | no data; base-model coverage not documented here |
347
+
348
+ Measured on synthetic slices, not client data. Known weak spot: Spanish acronyms sit at the floor (top-1 .008-.025) until a glossary is on. Evidence and per-slice numbers: [languages.md](https://github.com/CreAI-mx/match/blob/master/docs/skill/references/languages.md).
349
+
350
+ ## Glossary and business rules
351
+
352
+ Client knowledge the model cannot know, all opt-in (off = byte-identical output):
353
+
354
+ - **Glossary**: `--glossary glossary.csv` (columns `term, expansion, type, field, client, direction, lang, status`). Field-scoped, only `approved` rows act, acronyms are never assumed: every run writes `unknown_terms.md` for the client to answer, then `entmatch glossary import`.
355
+ - **Business rules** (one YAML, `business_weights:`): per-field weights, `must_match`, semantic weights, category filters, `agreement`, `discard_if_differs`; never-match pairs live in the client pack.
356
+ - Measured effect per rule, config examples and what is still unmeasured: [business-rules.md](https://github.com/CreAI-mx/match/blob/master/docs/skill/references/business-rules.md).
357
+
358
+ ## No GPU needed
359
+
360
+ ENTMATCH-R2 (hosted on Hugging Face: [felipedjrg3/entmatch-r2](https://huggingface.co/felipedjrg3/entmatch-r2), 2.4 GB) runs on CPU. The first run downloads it once (2.4 GB), then it is cached. Only training needs a GPU, and you do not need to train.
361
+
362
+ Needs `pip install "entmatch[serve]"`:
363
+
364
+ ```bash
365
+ CUDA_VISIBLE_DEVICES="" OMP_NUM_THREADS=8 entmatch match --catalog refs.jsonl --query "Oro Plus PPO plan" --preset entmatch-r2 --device cpu --threads 8
366
+ ```
367
+
368
+ <table width="100%">
369
+ <tr><th align="left">What</th><th align="right">Measured</th></tr>
370
+ <tr><td>One query, median</td><td align="right">229.2 ms</td></tr>
371
+ <tr><td>Worst usual case (p95)</td><td align="right">292.0 ms</td></tr>
372
+ <tr><td>Sustained</td><td align="right">5.63 queries/s</td></tr>
373
+ <tr><td>Machine</td><td align="right">8 CPU cores, no GPU, 3.42 GB RAM</td></tr>
374
+ </table>
375
+
376
+ Fewer than 8 cores not measured. Deploy details: [HOW_TO_USE](https://github.com/CreAI-mx/match/blob/master/docs/HOW_TO_USE.md#10-deploy-on-a-cpu-vm-16-gb-ram-8-cores-no-gpu).
377
+
378
+ ---
379
+
380
+ ## Learn more
381
+
382
+ <table width="100%">
383
+ <tr><td width="35%"><a href="https://github.com/CreAI-mx/match/blob/master/docs/HOW_TO_USE.md"><b>HOW_TO_USE</b></a></td><td>Step-by-step deep dive: install to deploy, client onboarding, unknown-terms loop, knowledge pack, eval protocol</td></tr>
384
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/REFERENCE.md"><b>REFERENCE</b></a></td><td>CLI, catalog workflow, output fields, ENTMATCH-R2, troubleshooting, dev setup</td></tr>
385
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/examples/QUICKSTARTS.md"><b>Examples</b></a> and <a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/SKILL.md"><b>skill</b></a></td><td>Runnable examples, and the <code>match</code> skill</td></tr>
386
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/outputs.md"><b>Outputs</b></a></td><td>Every output format, all fields, a worked top-5 example</td></tr>
387
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/languages.md"><b>Languages</b></a> and <a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/business-rules.md"><b>business rules</b></a></td><td>Supported languages with evidence; glossary and client rules, measured effects</td></tr>
388
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/skill/references/architecture.md"><b>Architecture</b></a></td><td>R2 + client rules layer after R2, stage order, rule precedence</td></tr>
389
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/ACCURACY.md"><b>Accuracy and charts</b></a></td><td>Measured results</td></tr>
390
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/site/quickstart.md"><b>Site docs</b></a></td><td>Quickstart pages</td></tr>
391
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/site/troubleshooting.md"><b>Troubleshooting</b></a></td><td>Common problems and fixes</td></tr>
392
+ <tr><td><a href="https://github.com/CreAI-mx/match/blob/master/docs/REFERENCE.md#contribute"><b>Contributing</b></a></td><td>Dev setup. License: Apache-2.0</td></tr>
393
+ </table>