swarmauri_metric_hamming 0.9.3.dev2__tar.gz → 0.11.0.dev1__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.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_metric_hamming
3
+ Version: 0.11.0.dev1
4
+ Summary: Hamming-distance metric for Swarmauri with raw mismatch counts, batched comparisons, and metric-axiom helpers.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,metric,hamming,distance,binary distance,sequence comparison,error correcting codes,discrete metrics,information analysis
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.15
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Natural Language :: English
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
18
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
19
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Programming Language :: Python
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: 3.14
29
+ Requires-Dist: numpy (>=1.26)
30
+ Requires-Dist: swarmauri_base
31
+ Requires-Dist: swarmauri_core
32
+ Description-Content-Type: text/markdown
33
+
34
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
35
+
36
+ <p align="center">
37
+ <a href="https://pepy.tech/project/swarmauri_metric_hamming/">
38
+ <img src="https://static.pepy.tech/badge/swarmauri_metric_hamming/month" alt="PyPI - Downloads"/></a>
39
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_metric_hamming/">
40
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_metric_hamming.svg"/></a>
41
+ <a href="https://pypi.org/project/swarmauri_metric_hamming/">
42
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
43
+ <a href="https://pypi.org/project/swarmauri_metric_hamming/">
44
+ <img src="https://img.shields.io/pypi/l/swarmauri_metric_hamming" alt="PyPI - License"/></a>
45
+ <a href="https://pypi.org/project/swarmauri_metric_hamming/">
46
+ <img src="https://img.shields.io/pypi/v/swarmauri_metric_hamming?label=swarmauri_metric_hamming&color=green" alt="PyPI - swarmauri_metric_hamming"/></a>
47
+ <a href="https://discord.gg/N4UpBuQv8T">
48
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
49
+
50
+ # Swarmauri Metric Hamming
51
+
52
+ `swarmauri_metric_hamming` is the Swarmauri metric implementation for Hamming
53
+ distance. It compares equal-length sequences and returns the count of positions
54
+ that differ, while also exposing batched distance helpers and metric-axiom
55
+ checks for downstream validation workflows.
56
+
57
+ ## Why Use Swarmauri Metric Hamming
58
+
59
+ - Measure discrete sequence differences inside Swarmauri retrieval, coding,
60
+ validation, or comparison workflows.
61
+ - Compare binary vectors, strings, NumPy arrays, and Swarmauri vector or matrix
62
+ surfaces through one metric component.
63
+ - Reuse a metric implementation that also exposes symmetry, identity, and
64
+ triangle-inequality checks.
65
+ - Build exact distance-based workflows for error-correcting codes, bitstring
66
+ analysis, and symbolic comparison.
67
+
68
+ ## FAQ
69
+
70
+ > **What does `distance()` return?**
71
+ > A float equal to the number of differing positions between two equal-length
72
+ > inputs.
73
+
74
+ > **What input types are supported?**
75
+ > Strings, bytes, dictionaries, NumPy arrays, generic sequences, and
76
+ > Swarmauri matrix/vector interfaces.
77
+
78
+ > **Does it normalize the distance?**
79
+ > No. The current implementation returns the raw count of mismatched positions.
80
+
81
+ > **Can it compare batches of vectors?**
82
+ > Yes. Use `distances()` to generate pairwise distance rows across collections.
83
+
84
+ ## Features
85
+
86
+ - Raw Hamming distance for equal-length sequences.
87
+ - Pairwise `distances()` support for collections of vectors.
88
+ - Input normalization for strings, bytes, dicts, arrays, matrices, and
89
+ vectors.
90
+ - Metric-axiom helpers: non-negativity, symmetry, identity of indiscernibles,
91
+ and triangle inequality.
92
+ - Supports Python 3.10, 3.11, 3.12, 3.13, and 3.14.
93
+
94
+ ## Installation
95
+
96
+ ```bash
97
+ uv add swarmauri_metric_hamming
98
+ ```
99
+
100
+ ```bash
101
+ pip install swarmauri_metric_hamming
102
+ ```
103
+
104
+ ## Usage
105
+
106
+ ```python
107
+ from swarmauri_metric_hamming import HammingMetric
108
+
109
+ metric = HammingMetric()
110
+ codeword = [1, 0, 1, 1, 0, 0, 1]
111
+ received = [1, 1, 1, 1, 0, 0, 1]
112
+
113
+ print(metric.distance(codeword, received))
114
+ ```
115
+
116
+ ## Examples
117
+
118
+ ### Compare binary vectors
119
+
120
+ ```python
121
+ from swarmauri_metric_hamming import HammingMetric
122
+
123
+ metric = HammingMetric()
124
+ print(metric.distance([1, 0, 1, 1], [1, 1, 0, 1]))
125
+ ```
126
+
127
+ ### Compare strings and arrays
128
+
129
+ ```python
130
+ import numpy as np
131
+ from swarmauri_metric_hamming import HammingMetric
132
+
133
+ metric = HammingMetric()
134
+ left = "1011001"
135
+ right = np.array([1, 0, 1, 0, 0, 0, 1])
136
+
137
+ print(metric.distance(left, right))
138
+ ```
139
+
140
+ ### Compute pairwise distances across collections
141
+
142
+ ```python
143
+ from swarmauri_metric_hamming import HammingMetric
144
+
145
+ metric = HammingMetric()
146
+ left = [[0, 0, 0], [1, 1, 1]]
147
+ right = [[0, 0, 1], [1, 0, 1]]
148
+
149
+ print(metric.distances(left, right))
150
+ ```
151
+
152
+ ### Verify metric axioms
153
+
154
+ ```python
155
+ from swarmauri_metric_hamming import HammingMetric
156
+
157
+ metric = HammingMetric()
158
+ x = [0, 1, 0, 1]
159
+ y = [0, 0, 1, 1]
160
+ z = [1, 0, 1, 0]
161
+
162
+ assert metric.check_non_negativity(x, y)
163
+ assert metric.check_symmetry(x, y)
164
+ assert metric.check_triangle_inequality(x, y, z)
165
+ ```
166
+
167
+ ## Related Packages
168
+
169
+ - [swarmauri_measurement_mutualinformation](https://pypi.org/project/swarmauri_measurement_mutualinformation/)
170
+ - [swarmauri_measurement_tokencountestimator](https://pypi.org/project/swarmauri_measurement_tokencountestimator/)
171
+ - [swarmauri_metric_hamming](https://pypi.org/project/swarmauri_metric_hamming/)
172
+
173
+ ## Swarmauri Foundations
174
+
175
+ - [swarmauri](https://pypi.org/project/swarmauri/)
176
+ - [swarmauri_core](https://pypi.org/project/swarmauri_core/)
177
+ - [swarmauri_base](https://pypi.org/project/swarmauri_base/)
178
+
179
+ ## More Documentation
180
+
181
+ - [Hamming distance overview](https://en.wikipedia.org/wiki/Hamming_distance)
182
+ - [NumPy documentation](https://numpy.org/doc/)
183
+
184
+ ## Best Practices
185
+
186
+ - Validate equal-length inputs before calling `distance()` in external
187
+ pipelines.
188
+ - Use raw Hamming counts when exact mismatch positions matter more than a
189
+ normalized ratio.
190
+ - Normalize heterogeneous input types consistently before comparing large
191
+ collections.
192
+ - Pair this metric with domain-specific encoders when comparing symbolic or
193
+ categorical data.
194
+
195
+ ## License
196
+
197
+ This project is licensed under the Apache-2.0 License.
198
+
199
+
@@ -0,0 +1,165 @@
1
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
+
3
+ <p align="center">
4
+ <a href="https://pepy.tech/project/swarmauri_metric_hamming/">
5
+ <img src="https://static.pepy.tech/badge/swarmauri_metric_hamming/month" alt="PyPI - Downloads"/></a>
6
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_metric_hamming/">
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_metric_hamming.svg"/></a>
8
+ <a href="https://pypi.org/project/swarmauri_metric_hamming/">
9
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
10
+ <a href="https://pypi.org/project/swarmauri_metric_hamming/">
11
+ <img src="https://img.shields.io/pypi/l/swarmauri_metric_hamming" alt="PyPI - License"/></a>
12
+ <a href="https://pypi.org/project/swarmauri_metric_hamming/">
13
+ <img src="https://img.shields.io/pypi/v/swarmauri_metric_hamming?label=swarmauri_metric_hamming&color=green" alt="PyPI - swarmauri_metric_hamming"/></a>
14
+ <a href="https://discord.gg/N4UpBuQv8T">
15
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
16
+
17
+ # Swarmauri Metric Hamming
18
+
19
+ `swarmauri_metric_hamming` is the Swarmauri metric implementation for Hamming
20
+ distance. It compares equal-length sequences and returns the count of positions
21
+ that differ, while also exposing batched distance helpers and metric-axiom
22
+ checks for downstream validation workflows.
23
+
24
+ ## Why Use Swarmauri Metric Hamming
25
+
26
+ - Measure discrete sequence differences inside Swarmauri retrieval, coding,
27
+ validation, or comparison workflows.
28
+ - Compare binary vectors, strings, NumPy arrays, and Swarmauri vector or matrix
29
+ surfaces through one metric component.
30
+ - Reuse a metric implementation that also exposes symmetry, identity, and
31
+ triangle-inequality checks.
32
+ - Build exact distance-based workflows for error-correcting codes, bitstring
33
+ analysis, and symbolic comparison.
34
+
35
+ ## FAQ
36
+
37
+ > **What does `distance()` return?**
38
+ > A float equal to the number of differing positions between two equal-length
39
+ > inputs.
40
+
41
+ > **What input types are supported?**
42
+ > Strings, bytes, dictionaries, NumPy arrays, generic sequences, and
43
+ > Swarmauri matrix/vector interfaces.
44
+
45
+ > **Does it normalize the distance?**
46
+ > No. The current implementation returns the raw count of mismatched positions.
47
+
48
+ > **Can it compare batches of vectors?**
49
+ > Yes. Use `distances()` to generate pairwise distance rows across collections.
50
+
51
+ ## Features
52
+
53
+ - Raw Hamming distance for equal-length sequences.
54
+ - Pairwise `distances()` support for collections of vectors.
55
+ - Input normalization for strings, bytes, dicts, arrays, matrices, and
56
+ vectors.
57
+ - Metric-axiom helpers: non-negativity, symmetry, identity of indiscernibles,
58
+ and triangle inequality.
59
+ - Supports Python 3.10, 3.11, 3.12, 3.13, and 3.14.
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ uv add swarmauri_metric_hamming
65
+ ```
66
+
67
+ ```bash
68
+ pip install swarmauri_metric_hamming
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ ```python
74
+ from swarmauri_metric_hamming import HammingMetric
75
+
76
+ metric = HammingMetric()
77
+ codeword = [1, 0, 1, 1, 0, 0, 1]
78
+ received = [1, 1, 1, 1, 0, 0, 1]
79
+
80
+ print(metric.distance(codeword, received))
81
+ ```
82
+
83
+ ## Examples
84
+
85
+ ### Compare binary vectors
86
+
87
+ ```python
88
+ from swarmauri_metric_hamming import HammingMetric
89
+
90
+ metric = HammingMetric()
91
+ print(metric.distance([1, 0, 1, 1], [1, 1, 0, 1]))
92
+ ```
93
+
94
+ ### Compare strings and arrays
95
+
96
+ ```python
97
+ import numpy as np
98
+ from swarmauri_metric_hamming import HammingMetric
99
+
100
+ metric = HammingMetric()
101
+ left = "1011001"
102
+ right = np.array([1, 0, 1, 0, 0, 0, 1])
103
+
104
+ print(metric.distance(left, right))
105
+ ```
106
+
107
+ ### Compute pairwise distances across collections
108
+
109
+ ```python
110
+ from swarmauri_metric_hamming import HammingMetric
111
+
112
+ metric = HammingMetric()
113
+ left = [[0, 0, 0], [1, 1, 1]]
114
+ right = [[0, 0, 1], [1, 0, 1]]
115
+
116
+ print(metric.distances(left, right))
117
+ ```
118
+
119
+ ### Verify metric axioms
120
+
121
+ ```python
122
+ from swarmauri_metric_hamming import HammingMetric
123
+
124
+ metric = HammingMetric()
125
+ x = [0, 1, 0, 1]
126
+ y = [0, 0, 1, 1]
127
+ z = [1, 0, 1, 0]
128
+
129
+ assert metric.check_non_negativity(x, y)
130
+ assert metric.check_symmetry(x, y)
131
+ assert metric.check_triangle_inequality(x, y, z)
132
+ ```
133
+
134
+ ## Related Packages
135
+
136
+ - [swarmauri_measurement_mutualinformation](https://pypi.org/project/swarmauri_measurement_mutualinformation/)
137
+ - [swarmauri_measurement_tokencountestimator](https://pypi.org/project/swarmauri_measurement_tokencountestimator/)
138
+ - [swarmauri_metric_hamming](https://pypi.org/project/swarmauri_metric_hamming/)
139
+
140
+ ## Swarmauri Foundations
141
+
142
+ - [swarmauri](https://pypi.org/project/swarmauri/)
143
+ - [swarmauri_core](https://pypi.org/project/swarmauri_core/)
144
+ - [swarmauri_base](https://pypi.org/project/swarmauri_base/)
145
+
146
+ ## More Documentation
147
+
148
+ - [Hamming distance overview](https://en.wikipedia.org/wiki/Hamming_distance)
149
+ - [NumPy documentation](https://numpy.org/doc/)
150
+
151
+ ## Best Practices
152
+
153
+ - Validate equal-length inputs before calling `distance()` in external
154
+ pipelines.
155
+ - Use raw Hamming counts when exact mismatch positions matter more than a
156
+ normalized ratio.
157
+ - Normalize heterogeneous input types consistently before comparing large
158
+ collections.
159
+ - Pair this metric with domain-specific encoders when comparing symbolic or
160
+ categorical data.
161
+
162
+ ## License
163
+
164
+ This project is licensed under the Apache-2.0 License.
165
+
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "swarmauri_metric_hamming"
3
- version = "0.9.3.dev2"
4
- description = "Swarmauri Hamming distance metric community package."
3
+ version = "0.11.0.dev1"
4
+ description = "Hamming-distance metric for Swarmauri with raw mismatch counts, batched comparisons, and metric-axiom helpers."
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
7
7
  repository = "http://github.com/swarmauri/swarmauri-sdk"
@@ -11,7 +11,12 @@ classifiers = [
11
11
  "Natural Language :: English",
12
12
  "Development Status :: 3 - Alpha",
13
13
  "Intended Audience :: Developers",
14
+ "Intended Audience :: Science/Research",
15
+ "Operating System :: OS Independent",
16
+ "Topic :: Scientific/Engineering :: Information Analysis",
17
+ "Topic :: Scientific/Engineering :: Mathematics",
14
18
  "Topic :: Software Development :: Libraries :: Application Frameworks",
19
+ "Topic :: Software Development :: Libraries",
15
20
  "Programming Language :: Python",
16
21
  "Programming Language :: Python :: 3",
17
22
  "Programming Language :: Python :: 3 :: Only",
@@ -32,8 +37,11 @@ keywords = [
32
37
  "metric",
33
38
  "hamming",
34
39
  "distance",
35
- "community",
36
- "package",
40
+ "binary distance",
41
+ "sequence comparison",
42
+ "error correcting codes",
43
+ "discrete metrics",
44
+ "information analysis",
37
45
  ]
38
46
 
39
47
  [tool.uv.sources]
@@ -74,7 +82,7 @@ dev = [
74
82
  "pytest-xdist>=3.6.1",
75
83
  "pytest-json-report>=1.5.0",
76
84
  "python-dotenv",
77
- "requests>=2.32.3",
85
+ "httpx>=0.27",
78
86
  "flake8>=7.0",
79
87
  "pytest-timeout>=2.3.1",
80
88
  "ruff>=0.9.9",
@@ -111,7 +111,9 @@ class HammingMetric(MetricBase):
111
111
 
112
112
  if isinstance(value, Sequence):
113
113
  flattened = (
114
- list(value) if _is_scalar_sequence(value) else _flatten_once(value)
114
+ list(value)
115
+ if _is_scalar_sequence(value)
116
+ else _flatten_once(value)
115
117
  )
116
118
  return [_coerce_scalar(item) for item in flattened]
117
119
 
@@ -125,14 +127,18 @@ class HammingMetric(MetricBase):
125
127
  if isinstance(values, np.ndarray) and values.ndim > 1:
126
128
  return [row.flatten().tolist() for row in values]
127
129
 
128
- if isinstance(values, Sequence) and not isinstance(values, (str, bytes)):
130
+ if isinstance(values, Sequence) and not isinstance(
131
+ values, (str, bytes)
132
+ ):
129
133
  if values and not _is_scalar_sequence(values):
130
134
  return [self._normalise_single(item) for item in values] # type: ignore[arg-type]
131
135
 
132
136
  return [self._normalise_single(cast(MetricInput, values))]
133
137
 
134
138
  def normalise(self, value: MetricInput) -> List[object]:
135
- """Expose the internal normalisation logic for downstream components."""
139
+ """
140
+ Expose the internal normalisation logic for downstream components.
141
+ """
136
142
 
137
143
  return self._normalise_single(value)
138
144
 
@@ -140,7 +146,9 @@ class HammingMetric(MetricBase):
140
146
  self, x: List[object], y: List[object]
141
147
  ) -> Tuple[List[object], List[object]]:
142
148
  if len(x) != len(y):
143
- raise ValueError("Hamming distance requires inputs of equal length")
149
+ raise ValueError(
150
+ "Hamming distance requires inputs of equal length"
151
+ )
144
152
  return x, y
145
153
 
146
154
  def distance(self, x: MetricInput, y: MetricInput) -> float:
@@ -171,7 +179,9 @@ class HammingMetric(MetricBase):
171
179
  def check_non_negativity(self, x: MetricInput, y: MetricInput) -> bool:
172
180
  return self.distance(x, y) >= 0
173
181
 
174
- def check_identity_of_indiscernibles(self, x: MetricInput, y: MetricInput) -> bool:
182
+ def check_identity_of_indiscernibles(
183
+ self, x: MetricInput, y: MetricInput
184
+ ) -> bool:
175
185
  left, right = self._normalise_single(x), self._normalise_single(y)
176
186
  distance = self.distance(left, right)
177
187
  return distance == 0 if left == right else distance > 0
@@ -1,96 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: swarmauri_metric_hamming
3
- Version: 0.9.3.dev2
4
- Summary: Swarmauri Hamming distance metric community package.
5
- License-Expression: Apache-2.0
6
- License-File: LICENSE
7
- Keywords: swarmauri,metric,hamming,distance,community,package
8
- Author: Jacob Stewart
9
- Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.15
11
- Classifier: License :: OSI Approved :: Apache Software License
12
- Classifier: Natural Language :: English
13
- Classifier: Development Status :: 3 - Alpha
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
16
- Classifier: Programming Language :: Python
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3 :: Only
19
- Classifier: Programming Language :: Python :: 3.10
20
- Classifier: Programming Language :: Python :: 3.11
21
- Classifier: Programming Language :: Python :: 3.12
22
- Classifier: Programming Language :: Python :: 3.13
23
- Classifier: Programming Language :: Python :: 3.14
24
- Requires-Dist: numpy (>=1.26)
25
- Requires-Dist: swarmauri_base
26
- Requires-Dist: swarmauri_core
27
- Description-Content-Type: text/markdown
28
-
29
- ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
30
-
31
- <p align="center">
32
- <a href="https://pepy.tech/project/swarmauri_metric_hamming/">
33
- <img src="https://static.pepy.tech/badge/swarmauri_metric_hamming/month" alt="PyPI - Downloads"/></a>
34
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_metric_hamming/">
35
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_metric_hamming.svg"/></a>
36
- <a href="https://pypi.org/project/swarmauri_metric_hamming/">
37
- <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
38
- <a href="https://pypi.org/project/swarmauri_metric_hamming/">
39
- <img src="https://img.shields.io/pypi/l/swarmauri_metric_hamming" alt="PyPI - License"/></a>
40
- <a href="https://pypi.org/project/swarmauri_metric_hamming/">
41
- <img src="https://img.shields.io/pypi/v/swarmauri_metric_hamming?label=swarmauri_metric_hamming&color=green" alt="PyPI - swarmauri_metric_hamming"/></a>
42
- </p>
43
- ---
44
-
45
- # Swarmauri Metric Hamming
46
-
47
- The `swarmauri_metric_hamming` package delivers a production-ready implementation of the Hamming distance that integrates seamlessly with the Swarmauri metric ecosystem. It extends `MetricBase` with binary vector validation, pairwise distance calculations, and axiom verification utilities designed for error-correcting code workflows.
48
-
49
- ## Features
50
-
51
- - ✅ Fully compliant `MetricBase` implementation for binary sequences.
52
- - 🔁 Pairwise and batched distance calculations for matrices, vectors, and iterables.
53
- - 🧪 Built-in validation helpers for metric axioms and input compatibility checks.
54
- - 🧰 Utility conversion helpers for strings, dictionaries, NumPy arrays, and Swarmauri matrices/vectors.
55
-
56
- ## Installation
57
-
58
- ### Using `uv`
59
-
60
- ```bash
61
- uv pip install swarmauri_metric_hamming
62
- ```
63
-
64
- ### Using `pip`
65
-
66
- ```bash
67
- pip install swarmauri_metric_hamming
68
- ```
69
-
70
- ## Usage
71
-
72
- ```python
73
- from swarmauri_metric_hamming import HammingMetric
74
-
75
- metric = HammingMetric()
76
-
77
- codeword = [1, 0, 1, 1, 0, 0, 1]
78
- received = [1, 1, 1, 1, 0, 0, 1]
79
-
80
- # Compute the Hamming distance between two binary vectors
81
- print(metric.distance(codeword, received)) # 1.0
82
-
83
- # Verify the metric axioms for the provided inputs
84
- assert metric.check_symmetry(codeword, received)
85
- assert metric.check_triangle_inequality(codeword, received, codeword)
86
- ```
87
-
88
- ## Support
89
-
90
- - Python 3.10, 3.11, and 3.12
91
- - Licensed under the Apache-2.0 license
92
-
93
- ## Contributing
94
-
95
- We welcome contributions! Please submit issues and pull requests through the [Swarmauri SDK GitHub repository](https://github.com/swarmauri/swarmauri-sdk).
96
-
@@ -1,67 +0,0 @@
1
- ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
-
3
- <p align="center">
4
- <a href="https://pepy.tech/project/swarmauri_metric_hamming/">
5
- <img src="https://static.pepy.tech/badge/swarmauri_metric_hamming/month" alt="PyPI - Downloads"/></a>
6
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_metric_hamming/">
7
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_metric_hamming.svg"/></a>
8
- <a href="https://pypi.org/project/swarmauri_metric_hamming/">
9
- <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
10
- <a href="https://pypi.org/project/swarmauri_metric_hamming/">
11
- <img src="https://img.shields.io/pypi/l/swarmauri_metric_hamming" alt="PyPI - License"/></a>
12
- <a href="https://pypi.org/project/swarmauri_metric_hamming/">
13
- <img src="https://img.shields.io/pypi/v/swarmauri_metric_hamming?label=swarmauri_metric_hamming&color=green" alt="PyPI - swarmauri_metric_hamming"/></a>
14
- </p>
15
- ---
16
-
17
- # Swarmauri Metric Hamming
18
-
19
- The `swarmauri_metric_hamming` package delivers a production-ready implementation of the Hamming distance that integrates seamlessly with the Swarmauri metric ecosystem. It extends `MetricBase` with binary vector validation, pairwise distance calculations, and axiom verification utilities designed for error-correcting code workflows.
20
-
21
- ## Features
22
-
23
- - ✅ Fully compliant `MetricBase` implementation for binary sequences.
24
- - 🔁 Pairwise and batched distance calculations for matrices, vectors, and iterables.
25
- - 🧪 Built-in validation helpers for metric axioms and input compatibility checks.
26
- - 🧰 Utility conversion helpers for strings, dictionaries, NumPy arrays, and Swarmauri matrices/vectors.
27
-
28
- ## Installation
29
-
30
- ### Using `uv`
31
-
32
- ```bash
33
- uv pip install swarmauri_metric_hamming
34
- ```
35
-
36
- ### Using `pip`
37
-
38
- ```bash
39
- pip install swarmauri_metric_hamming
40
- ```
41
-
42
- ## Usage
43
-
44
- ```python
45
- from swarmauri_metric_hamming import HammingMetric
46
-
47
- metric = HammingMetric()
48
-
49
- codeword = [1, 0, 1, 1, 0, 0, 1]
50
- received = [1, 1, 1, 1, 0, 0, 1]
51
-
52
- # Compute the Hamming distance between two binary vectors
53
- print(metric.distance(codeword, received)) # 1.0
54
-
55
- # Verify the metric axioms for the provided inputs
56
- assert metric.check_symmetry(codeword, received)
57
- assert metric.check_triangle_inequality(codeword, received, codeword)
58
- ```
59
-
60
- ## Support
61
-
62
- - Python 3.10, 3.11, and 3.12
63
- - Licensed under the Apache-2.0 license
64
-
65
- ## Contributing
66
-
67
- We welcome contributions! Please submit issues and pull requests through the [Swarmauri SDK GitHub repository](https://github.com/swarmauri/swarmauri-sdk).