-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I put together the test code below based on a few things I read, and it seems like it would work, but I keep getting this error:
Traceback (most recent call last):
File "/Users/seaver/Seaver_Lab/Projects/Biochemistry_Functions/./test_neofuzz.py", line 36, in <module>
neofuzz_process.index(options)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/opt/anaconda3/envs/fuzzy-matching/lib/python3.13/site-packages/neofuzz/process.py", line 79, in index
self.nearest_neighbours.add_item(i_option, vector)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/fuzzy-matching/lib/python3.13/site-packages/scipy/sparse/_base.py", line 449, in __len__
raise TypeError("sparse array length is ambiguous; use getnnz()"
" or shape[0]")
#!/usr/bin/env python
import random
import string
def generate_random_word(length: int) -> str:
"""This bad boy generates random words of given length"""
letters = string.ascii_lowercase
return "".join(random.choice(letters) for _ in range(length))
# Let's generate 20 000 unique random words of length 10 to search in
options = list(set(generate_random_word(length=10) for _ in range(20_000)))
from neofuzz import char_ngram_process
neofuzz_process = char_ngram_process(ngram_range=(1,5), metric="angular", tf_idf=True)
neofuzz_process.index(options)
I've been back and forth but I can't figure out what I'm doing wrong here. I'm using version 0.4 as installed via pip
raresaxpo
Metadata
Metadata
Assignees
Labels
No labels