stickler-eval 0.1.0__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 (64) hide show
  1. stickler_eval-0.1.0/LICENSE +175 -0
  2. stickler_eval-0.1.0/NOTICE +1 -0
  3. stickler_eval-0.1.0/PKG-INFO +159 -0
  4. stickler_eval-0.1.0/README.md +138 -0
  5. stickler_eval-0.1.0/pyproject.toml +36 -0
  6. stickler_eval-0.1.0/setup.cfg +4 -0
  7. stickler_eval-0.1.0/src/stickler/__init__.py +30 -0
  8. stickler_eval-0.1.0/src/stickler/algorithms/__init__.py +12 -0
  9. stickler_eval-0.1.0/src/stickler/algorithms/hungarian.py +332 -0
  10. stickler_eval-0.1.0/src/stickler/comparators/__init__.py +53 -0
  11. stickler_eval-0.1.0/src/stickler/comparators/base.py +76 -0
  12. stickler_eval-0.1.0/src/stickler/comparators/bert.py +80 -0
  13. stickler_eval-0.1.0/src/stickler/comparators/exact.py +66 -0
  14. stickler_eval-0.1.0/src/stickler/comparators/fuzzy.py +117 -0
  15. stickler_eval-0.1.0/src/stickler/comparators/levenshtein.py +108 -0
  16. stickler_eval-0.1.0/src/stickler/comparators/llm.py +76 -0
  17. stickler_eval-0.1.0/src/stickler/comparators/numeric.py +157 -0
  18. stickler_eval-0.1.0/src/stickler/comparators/semantic.py +79 -0
  19. stickler_eval-0.1.0/src/stickler/comparators/structured.py +57 -0
  20. stickler_eval-0.1.0/src/stickler/comparators/utils.py +73 -0
  21. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/__init__.py +29 -0
  22. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/bulk_structured_model_evaluator.py +725 -0
  23. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/evaluator.py +679 -0
  24. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/comparable_field.py +211 -0
  25. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/comparator_registry.py +213 -0
  26. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/comparison_helper.py +296 -0
  27. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/comparison_info.py +156 -0
  28. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/configuration_helper.py +537 -0
  29. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/evaluator_format_helper.py +209 -0
  30. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/field.py +91 -0
  31. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/field_converter.py +422 -0
  32. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/field_helper.py +163 -0
  33. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/hungarian_helper.py +68 -0
  34. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/metrics_helper.py +206 -0
  35. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/non_match_field.py +169 -0
  36. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/non_matches_helper.py +202 -0
  37. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/structured_list_comparator.py +573 -0
  38. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/structured_model.py +2589 -0
  39. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/threshold_helper.py +103 -0
  40. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/models/type_resolver.py +313 -0
  41. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/trees/__init__.py +21 -0
  42. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/trees/base.py +156 -0
  43. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/trees/dict_tree.py +136 -0
  44. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/trees/leaf_tree.py +91 -0
  45. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/trees/list_tree.py +198 -0
  46. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/trees/none_tree.py +92 -0
  47. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/trees/tuple_tree.py +144 -0
  48. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/utils/__init__.py +13 -0
  49. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/utils/anls_score.py +117 -0
  50. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/utils/compare_json.py +35 -0
  51. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/utils/key_scores.py +140 -0
  52. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/utils/pretty_print.py +1360 -0
  53. stickler_eval-0.1.0/src/stickler/structured_object_evaluator/utils.py +85 -0
  54. stickler_eval-0.1.0/src/stickler/utils/eval_argparser.py +68 -0
  55. stickler_eval-0.1.0/src/stickler/utils/markdown_util.py +116 -0
  56. stickler_eval-0.1.0/src/stickler/utils/process_evaluation.py +58 -0
  57. stickler_eval-0.1.0/src/stickler/utils/text_normalizers.py +50 -0
  58. stickler_eval-0.1.0/src/stickler/utils/time_util.py +17 -0
  59. stickler_eval-0.1.0/src/stickler_eval.egg-info/PKG-INFO +159 -0
  60. stickler_eval-0.1.0/src/stickler_eval.egg-info/SOURCES.txt +62 -0
  61. stickler_eval-0.1.0/src/stickler_eval.egg-info/dependency_links.txt +1 -0
  62. stickler_eval-0.1.0/src/stickler_eval.egg-info/requires.txt +11 -0
  63. stickler_eval-0.1.0/src/stickler_eval.egg-info/top_level.txt +1 -0
  64. stickler_eval-0.1.0/tests/test_compare_with_call_count.py +202 -0
@@ -0,0 +1,175 @@
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.
@@ -0,0 +1 @@
1
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: stickler-eval
3
+ Version: 0.1.0
4
+ Summary: Structured object comparison and evaluation library
5
+ Author-email: Spencer Romo <sromo@amazon.com>
6
+ Requires-Python: >=3.12
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ License-File: NOTICE
10
+ Requires-Dist: pydantic>=2.11.0
11
+ Requires-Dist: rapidfuzz>=3.0.0
12
+ Requires-Dist: munkres>=1.1.4
13
+ Requires-Dist: numpy>=1.24.0
14
+ Requires-Dist: scipy>=1.10.0
15
+ Requires-Dist: psutil>=5.8.0
16
+ Requires-Dist: pandas>=1.5.0
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
19
+ Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # stickler-lib
23
+
24
+ A Python library for structured object comparison and evaluation with configurable comparison strategies and detailed metrics.
25
+
26
+ ## Installation
27
+
28
+ ### Requirements
29
+ - Python 3.12+
30
+ - conda (recommended)
31
+
32
+ ### Quick Install
33
+ ```bash
34
+ # Create conda environment
35
+ conda create -n stickler python=3.12 -y
36
+ conda activate stickler
37
+
38
+ # Install the library
39
+ pip install -e .
40
+ ```
41
+
42
+ ### Development Install
43
+ ```bash
44
+ # Install with testing dependencies
45
+ pip install -e ".[dev]"
46
+ ```
47
+
48
+ ## Quick Test
49
+
50
+ Run the example to verify installation:
51
+ ```bash
52
+ python examples/scripts/quick_start.py
53
+ ```
54
+
55
+ Run tests:
56
+ ```bash
57
+ pytest tests/
58
+ ```
59
+
60
+ ## Basic Usage
61
+
62
+ ### Static Model Definition
63
+
64
+ ```python
65
+ from stickler import StructuredModel, ComparableField, StructuredModelEvaluator
66
+ from stickler.comparators.levenshtein import LevenshteinComparator
67
+
68
+ # Define your data structure
69
+ class Invoice(StructuredModel):
70
+ invoice_number: str = ComparableField(
71
+ comparator=LevenshteinComparator(),
72
+ threshold=0.9
73
+ )
74
+ total: float = ComparableField(threshold=0.95)
75
+
76
+ # Compare objects
77
+ evaluator = StructuredModelEvaluator()
78
+ result = evaluator.evaluate(ground_truth, prediction)
79
+
80
+ print(f"Overall Score: {result['overall']['anls_score']:.3f}")
81
+ ```
82
+
83
+ ### Dynamic Model Creation (New!)
84
+
85
+ Create models from JSON configuration for maximum flexibility:
86
+
87
+ ```python
88
+ from stickler.structured_object_evaluator.models.structured_model import StructuredModel
89
+
90
+ # Define model configuration
91
+ config = {
92
+ "model_name": "Product",
93
+ "match_threshold": 0.8,
94
+ "fields": {
95
+ "name": {
96
+ "type": "str",
97
+ "comparator": "LevenshteinComparator",
98
+ "threshold": 0.8,
99
+ "weight": 2.0
100
+ },
101
+ "price": {
102
+ "type": "float",
103
+ "comparator": "NumericComparator",
104
+ "default": 0.0
105
+ }
106
+ }
107
+ }
108
+
109
+ # Create dynamic model class
110
+ Product = StructuredModel.model_from_json(config)
111
+
112
+ # Use like any Pydantic model
113
+ product1 = Product(name="Widget", price=29.99)
114
+ product2 = Product(name="Gadget", price=29.99)
115
+
116
+ # Full comparison capabilities
117
+ result = product1.compare_with(product2)
118
+ print(f"Similarity: {result['overall_score']:.2f}")
119
+ ```
120
+
121
+ ### Complete JSON-to-Evaluation Workflow (New!)
122
+
123
+ For maximum flexibility, load both configuration AND data from JSON:
124
+
125
+ ```python
126
+ # Load model config from JSON
127
+ with open('model_config.json') as f:
128
+ config = json.load(f)
129
+
130
+ # Load test data from JSON
131
+ with open('test_data.json') as f:
132
+ data = json.load(f)
133
+
134
+ # Create model and instances from JSON
135
+ Model = StructuredModel.model_from_json(config)
136
+ ground_truth = Model(**data['ground_truth'])
137
+ prediction = Model(**data['prediction'])
138
+
139
+ # Evaluate - no Python object construction needed!
140
+ result = ground_truth.compare_with(prediction)
141
+ ```
142
+
143
+ **Benefits of JSON-Driven Approach:**
144
+ - Zero Python object construction required
145
+ - Configuration-driven model creation
146
+ - A/B testing different field configurations
147
+ - Runtime model generation from external schemas
148
+ - Production-ready JSON-based evaluation pipeline
149
+ - Full Pydantic compatibility with comparison capabilities
150
+
151
+ See [`examples/scripts/json_to_evaluation_demo.py`](examples/scripts/json_to_evaluation_demo.py) for a complete working example and [`docs/StructuredModel_Dynamic_Creation.md`](docs/StructuredModel_Dynamic_Creation.md) for comprehensive documentation.
152
+
153
+ ## Examples
154
+
155
+ Check out the `examples/` directory for more detailed usage examples and notebooks.
156
+
157
+ ## License
158
+
159
+ © 2025 Amazon Web Services, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,138 @@
1
+ # stickler-lib
2
+
3
+ A Python library for structured object comparison and evaluation with configurable comparison strategies and detailed metrics.
4
+
5
+ ## Installation
6
+
7
+ ### Requirements
8
+ - Python 3.12+
9
+ - conda (recommended)
10
+
11
+ ### Quick Install
12
+ ```bash
13
+ # Create conda environment
14
+ conda create -n stickler python=3.12 -y
15
+ conda activate stickler
16
+
17
+ # Install the library
18
+ pip install -e .
19
+ ```
20
+
21
+ ### Development Install
22
+ ```bash
23
+ # Install with testing dependencies
24
+ pip install -e ".[dev]"
25
+ ```
26
+
27
+ ## Quick Test
28
+
29
+ Run the example to verify installation:
30
+ ```bash
31
+ python examples/scripts/quick_start.py
32
+ ```
33
+
34
+ Run tests:
35
+ ```bash
36
+ pytest tests/
37
+ ```
38
+
39
+ ## Basic Usage
40
+
41
+ ### Static Model Definition
42
+
43
+ ```python
44
+ from stickler import StructuredModel, ComparableField, StructuredModelEvaluator
45
+ from stickler.comparators.levenshtein import LevenshteinComparator
46
+
47
+ # Define your data structure
48
+ class Invoice(StructuredModel):
49
+ invoice_number: str = ComparableField(
50
+ comparator=LevenshteinComparator(),
51
+ threshold=0.9
52
+ )
53
+ total: float = ComparableField(threshold=0.95)
54
+
55
+ # Compare objects
56
+ evaluator = StructuredModelEvaluator()
57
+ result = evaluator.evaluate(ground_truth, prediction)
58
+
59
+ print(f"Overall Score: {result['overall']['anls_score']:.3f}")
60
+ ```
61
+
62
+ ### Dynamic Model Creation (New!)
63
+
64
+ Create models from JSON configuration for maximum flexibility:
65
+
66
+ ```python
67
+ from stickler.structured_object_evaluator.models.structured_model import StructuredModel
68
+
69
+ # Define model configuration
70
+ config = {
71
+ "model_name": "Product",
72
+ "match_threshold": 0.8,
73
+ "fields": {
74
+ "name": {
75
+ "type": "str",
76
+ "comparator": "LevenshteinComparator",
77
+ "threshold": 0.8,
78
+ "weight": 2.0
79
+ },
80
+ "price": {
81
+ "type": "float",
82
+ "comparator": "NumericComparator",
83
+ "default": 0.0
84
+ }
85
+ }
86
+ }
87
+
88
+ # Create dynamic model class
89
+ Product = StructuredModel.model_from_json(config)
90
+
91
+ # Use like any Pydantic model
92
+ product1 = Product(name="Widget", price=29.99)
93
+ product2 = Product(name="Gadget", price=29.99)
94
+
95
+ # Full comparison capabilities
96
+ result = product1.compare_with(product2)
97
+ print(f"Similarity: {result['overall_score']:.2f}")
98
+ ```
99
+
100
+ ### Complete JSON-to-Evaluation Workflow (New!)
101
+
102
+ For maximum flexibility, load both configuration AND data from JSON:
103
+
104
+ ```python
105
+ # Load model config from JSON
106
+ with open('model_config.json') as f:
107
+ config = json.load(f)
108
+
109
+ # Load test data from JSON
110
+ with open('test_data.json') as f:
111
+ data = json.load(f)
112
+
113
+ # Create model and instances from JSON
114
+ Model = StructuredModel.model_from_json(config)
115
+ ground_truth = Model(**data['ground_truth'])
116
+ prediction = Model(**data['prediction'])
117
+
118
+ # Evaluate - no Python object construction needed!
119
+ result = ground_truth.compare_with(prediction)
120
+ ```
121
+
122
+ **Benefits of JSON-Driven Approach:**
123
+ - Zero Python object construction required
124
+ - Configuration-driven model creation
125
+ - A/B testing different field configurations
126
+ - Runtime model generation from external schemas
127
+ - Production-ready JSON-based evaluation pipeline
128
+ - Full Pydantic compatibility with comparison capabilities
129
+
130
+ See [`examples/scripts/json_to_evaluation_demo.py`](examples/scripts/json_to_evaluation_demo.py) for a complete working example and [`docs/StructuredModel_Dynamic_Creation.md`](docs/StructuredModel_Dynamic_Creation.md) for comprehensive documentation.
131
+
132
+ ## Examples
133
+
134
+ Check out the `examples/` directory for more detailed usage examples and notebooks.
135
+
136
+ ## License
137
+
138
+ © 2025 Amazon Web Services, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,36 @@
1
+ [project]
2
+ name = "stickler-eval"
3
+ version = "0.1.0"
4
+ description = "Structured object comparison and evaluation library"
5
+ authors = [
6
+ {name = "Spencer Romo", email = "sromo@amazon.com"}
7
+ ]
8
+ readme = "README.md"
9
+ requires-python = ">=3.12"
10
+
11
+ dependencies = [
12
+ "pydantic>=2.11.0",
13
+ "rapidfuzz>=3.0.0",
14
+ "munkres>=1.1.4",
15
+ "numpy>=1.24.0",
16
+ "scipy>=1.10.0",
17
+ "psutil>=5.8.0",
18
+ "pandas>=1.5.0"
19
+ ]
20
+
21
+ [project.optional-dependencies]
22
+ dev = [
23
+ "pytest>=7.0.0",
24
+ "pytest-xdist>=3.0.0"
25
+ ]
26
+
27
+
28
+ [tool.setuptools]
29
+ package-dir = {"" = "src"}
30
+
31
+ [tool.setuptools.packages.find]
32
+ where = ["src"]
33
+
34
+ [build-system]
35
+ requires = ["setuptools >= 61.0", "wheel"]
36
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,30 @@
1
+ """
2
+ stickler: Structured object comparison and evaluation library.
3
+
4
+ This library provides tools for comparing complex structured objects
5
+ with configurable comparison strategies and detailed evaluation metrics.
6
+ """
7
+
8
+ from .structured_object_evaluator import (
9
+ StructuredModel,
10
+ ComparableField,
11
+ NonMatchField,
12
+ NonMatchType,
13
+ StructuredModelEvaluator,
14
+ compare_structured_models,
15
+ anls_score,
16
+ compare_json,
17
+ )
18
+
19
+ __version__ = "0.1.0"
20
+
21
+ __all__ = [
22
+ "StructuredModel",
23
+ "ComparableField",
24
+ "NonMatchField",
25
+ "NonMatchType",
26
+ "StructuredModelEvaluator",
27
+ "compare_structured_models",
28
+ "anls_score",
29
+ "compare_json",
30
+ ]
@@ -0,0 +1,12 @@
1
+ """Common algorithms for key information evaluation.
2
+
3
+ This package contains algorithms that are shared between the traditional
4
+ and ANLS Star evaluation systems.
5
+ """
6
+
7
+ from stickler.algorithms.hungarian import (
8
+ HungarianMatcher,
9
+ HUNGARIAN_SIZE_WARNING_THRESHOLD,
10
+ )
11
+
12
+ __all__ = ["HungarianMatcher", "HUNGARIAN_SIZE_WARNING_THRESHOLD"]