prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  fix(hashing): ignore casting to float
  Fixes #83 
  
  ```python
  >>> x = Document(text="float test 2.56")
  >>> x.get_vocabulary()
  Counter({'float': 1, 'test': 1, '2': 1, '56': 1})
  ```
  
  </issue>
  <code>
  [start of docarray/document/mixins/featurehash.py]
  1 import hashlib
  2 import json
  3 from typing import Tuple, TYPE_CHECKING
  4 
  5 import numpy as np
  6 
  7 if TYPE_CHECKING:
  8     from ...types import T
  9 
  10 
  11 class FeatureHashMixin:
  12     """Provide helper functions for feature hashing."""
  13 
  14     def embed_feature_hashing(
  15         self: 'T',
  16         n_dim: int = 256,
  17         sparse: bool = False,
  18         fields: Tuple[str, ...] = ('text', 'tags'),
  19         max_value: int = 1_000_000,
  20     ) -> 'T':
  21         """Convert an arbitrary set of attributes into a fixed-dimensional matrix using the hashing trick.
  22 
  23         :param n_dim: the dimensionality of each document in the output embedding.
  24             Small numbers of features are likely to cause hash collisions,
  25             but large numbers will cause larger overall parameter dimensions.
  26         :param sparse: whether the resulting feature matrix should be a sparse csr_matrix or dense ndarray.
  27             Note that this feature requires ``scipy``
  28         :param fields: which attributes to be considered as for feature hashing.
  29         """
  30         if sparse:
  31             from scipy.sparse import csr_matrix
  32 
  33         idxs, data = [], []  # sparse
  34         table = np.zeros(n_dim)  # dense
  35 
  36         for f in fields:
  37             if 'text' in fields:
  38                 all_tokens = self.get_vocabulary(('text',))
  39                 for f_id, val in all_tokens.items():
  40                     _hash_column(f_id, val, n_dim, max_value, idxs, data, table)
  41 
  42             if 'tags' in fields:
  43                 for k, v in self.tags.items():
  44                     _hash_column(k, v, n_dim, max_value, idxs, data, table)
  45 
  46             v = getattr(self, f, None)
  47             if v:
  48                 _hash_column(f, v, n_dim, max_value, idxs, data, table)
  49 
  50         if sparse:
  51             self.embedding = csr_matrix((data, zip(*idxs)), shape=(1, n_dim))
  52         else:
  53             self.embedding = table
  54         return self
  55 
  56 
  57 def _hash_column(col_name, col_val, n_dim, max_value, idxs, data, table):
  58     h = _any_hash(col_name)
  59     col_val = _any_hash(col_val) % max_value
  60     col = h % n_dim
  61     idxs.append((0, col))
  62     data.append(np.sign(h) * col_val)
  63     table[col] += np.sign(h) * col_val
  64 
  65 
  66 def _any_hash(v):
  67     try:
  68         return int(v)  # parse int parameter
  69     except ValueError:
  70         try:
  71             return float(v)  # parse float parameter
  72         except ValueError:
  73             if not v:
  74                 # ignore it when the parameter is empty
  75                 return 0
  76             if isinstance(v, str):
  77                 v = v.strip()
  78                 if v.lower() in {'true', 'yes'}:  # parse boolean parameter
  79                     return 1
  80                 if v.lower() in {'false', 'no'}:
  81                     return 0
  82             if isinstance(v, (tuple, dict, list)):
  83                 v = json.dumps(v, sort_keys=True)
  84 
  85     return int(hashlib.md5(str(v).encode('utf-8')).hexdigest(), base=16)
  86
  [end of docarray/document/mixins/featurehash.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/docarray/document/mixins/featurehash.py b/docarray/document/mixins/featurehash.py
  --- a/docarray/document/mixins/featurehash.py
  +++ b/docarray/document/mixins/featurehash.py
  @@ -64,22 +64,24 @@
   
   
   def _any_hash(v):
  -    try:
  -        return int(v)  # parse int parameter
  -    except ValueError:
  +    if not v:
  +        # ignore it when the parameter is empty
  +        return 0
  +    elif isinstance(v, (tuple, dict, list, str)):
  +        if isinstance(v, str):
  +            v = v.strip()
  +            if v.lower() in {'true', 'yes'}:  # parse boolean parameter
  +                return 1
  +            if v.lower() in {'false', 'no'}:
  +                return 0
  +        else:
  +            v = json.dumps(v, sort_keys=True)
  +        return int(hashlib.md5(str(v).encode('utf-8')).hexdigest(), base=16)
  +    else:
           try:
  -            return float(v)  # parse float parameter
  +            return int(v)  # parse int parameter
           except ValueError:
  -            if not v:
  -                # ignore it when the parameter is empty
  -                return 0
  -            if isinstance(v, str):
  -                v = v.strip()
  -                if v.lower() in {'true', 'yes'}:  # parse boolean parameter
  -                    return 1
  -                if v.lower() in {'false', 'no'}:
  -                    return 0
  -            if isinstance(v, (tuple, dict, list)):
  -                v = json.dumps(v, sort_keys=True)
  -
  -    return int(hashlib.md5(str(v).encode('utf-8')).hexdigest(), base=16)
  +            try:
  +                return float(v)  # parse float parameter
  +            except ValueError:
  +                return 0  # unable to hash
  
verification_info: {"golden_diff": "diff --git a/docarray/document/mixins/featurehash.py b/docarray/document/mixins/featurehash.py\n--- a/docarray/document/mixins/featurehash.py\n+++ b/docarray/document/mixins/featurehash.py\n@@ -64,22 +64,24 @@\n \n \n def _any_hash(v):\n-    try:\n-        return int(v)  # parse int parameter\n-    except ValueError:\n+    if not v:\n+        # ignore it when the parameter is empty\n+        return 0\n+    elif isinstance(v, (tuple, dict, list, str)):\n+        if isinstance(v, str):\n+            v = v.strip()\n+            if v.lower() in {'true', 'yes'}:  # parse boolean parameter\n+                return 1\n+            if v.lower() in {'false', 'no'}:\n+                return 0\n+        else:\n+            v = json.dumps(v, sort_keys=True)\n+        return int(hashlib.md5(str(v).encode('utf-8')).hexdigest(), base=16)\n+    else:\n         try:\n-            return float(v)  # parse float parameter\n+            return int(v)  # parse int parameter\n         except ValueError:\n-            if not v:\n-                # ignore it when the parameter is empty\n-                return 0\n-            if isinstance(v, str):\n-                v = v.strip()\n-                if v.lower() in {'true', 'yes'}:  # parse boolean parameter\n-                    return 1\n-                if v.lower() in {'false', 'no'}:\n-                    return 0\n-            if isinstance(v, (tuple, dict, list)):\n-                v = json.dumps(v, sort_keys=True)\n-\n-    return int(hashlib.md5(str(v).encode('utf-8')).hexdigest(), base=16)\n+            try:\n+                return float(v)  # parse float parameter\n+            except ValueError:\n+                return 0  # unable to hash\n", "issue": "fix(hashing): ignore casting to float\nFixes #83 \r\n\r\n```python\r\n>>> x = Document(text=\"float test 2.56\")\r\n>>> x.get_vocabulary()\r\nCounter({'float': 1, 'test': 1, '2': 1, '56': 1})\r\n```\n", "before_files": [{"content": "import hashlib\nimport json\nfrom typing import Tuple, TYPE_CHECKING\n\nimport numpy as np\n\nif TYPE_CHECKING:\n    from ...types import T\n\n\nclass FeatureHashMixin:\n    \"\"\"Provide helper functions for feature hashing.\"\"\"\n\n    def embed_feature_hashing(\n        self: 'T',\n        n_dim: int = 256,\n        sparse: bool = False,\n        fields: Tuple[str, ...] = ('text', 'tags'),\n        max_value: int = 1_000_000,\n    ) -> 'T':\n        \"\"\"Convert an arbitrary set of attributes into a fixed-dimensional matrix using the hashing trick.\n\n        :param n_dim: the dimensionality of each document in the output embedding.\n            Small numbers of features are likely to cause hash collisions,\n            but large numbers will cause larger overall parameter dimensions.\n        :param sparse: whether the resulting feature matrix should be a sparse csr_matrix or dense ndarray.\n            Note that this feature requires ``scipy``\n        :param fields: which attributes to be considered as for feature hashing.\n        \"\"\"\n        if sparse:\n            from scipy.sparse import csr_matrix\n\n        idxs, data = [], []  # sparse\n        table = np.zeros(n_dim)  # dense\n\n        for f in fields:\n            if 'text' in fields:\n                all_tokens = self.get_vocabulary(('text',))\n                for f_id, val in all_tokens.items():\n                    _hash_column(f_id, val, n_dim, max_value, idxs, data, table)\n\n            if 'tags' in fields:\n                for k, v in self.tags.items():\n                    _hash_column(k, v, n_dim, max_value, idxs, data, table)\n\n            v = getattr(self, f, None)\n            if v:\n                _hash_column(f, v, n_dim, max_value, idxs, data, table)\n\n        if sparse:\n            self.embedding = csr_matrix((data, zip(*idxs)), shape=(1, n_dim))\n        else:\n            self.embedding = table\n        return self\n\n\ndef _hash_column(col_name, col_val, n_dim, max_value, idxs, data, table):\n    h = _any_hash(col_name)\n    col_val = _any_hash(col_val) % max_value\n    col = h % n_dim\n    idxs.append((0, col))\n    data.append(np.sign(h) * col_val)\n    table[col] += np.sign(h) * col_val\n\n\ndef _any_hash(v):\n    try:\n        return int(v)  # parse int parameter\n    except ValueError:\n        try:\n            return float(v)  # parse float parameter\n        except ValueError:\n            if not v:\n                # ignore it when the parameter is empty\n                return 0\n            if isinstance(v, str):\n                v = v.strip()\n                if v.lower() in {'true', 'yes'}:  # parse boolean parameter\n                    return 1\n                if v.lower() in {'false', 'no'}:\n                    return 0\n            if isinstance(v, (tuple, dict, list)):\n                v = json.dumps(v, sort_keys=True)\n\n    return int(hashlib.md5(str(v).encode('utf-8')).hexdigest(), base=16)\n", "path": "docarray/document/mixins/featurehash.py"}]}