Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Damereau-Levenshtein kills kernel inconsistently; Python 2 vs Python 3

$
0
0

I downloaded a package written for Python 2 that works fine except for one specific function call that frequently (but not always) kills the kernel. I found the package at https://pypi.org/project/weighted-levenshtein/, and copied and pasted the usage example at that link. Everything works except certain uses of dam_lev.

I've spent an hour trying to isolate which uses of dam_lev kill the kernel and which uses don't, but it's inconsistent. Sometimes the function call print(dam_lev('BANANA', 'ABNANA')) will kill it, sometimes not. Sometimes the simpler call (with default transpose costs) will run fine while the following will kill it:

transpose_costs = np.ones((128, 128), dtype=np.float64)

transpose_costs[ord('B'), ord('A')] = 0.75

print(dam_lev('BANANA', 'ABNANA', transpose_costs=transpose_costs))

Sometimes the entire usage example will run fine, but as I try to continue through pieces of the usage example that just ran moments before, the kernel will die again. The error thrown is "Kernel Restarting: The kernel appears to have died. It will restart automatically." (And then the kernel won't restart other than manually.)

Just now as I'm working through different examples, the kernel died when I ran the single line from weighted_levenshtein import lev, osa, dam_lev.

The pypi.org link says this package should work in Python 2 and Python 3, but the documentation at https://weighted-levenshtein.readthedocs.io/en/master/ says Python 3 is untested. I'm running Python 3 in Jupyter, in the Firefox browser, and I just installed Visual Studio C++ Build Tools before running pip install weighted-levenshtein. Did something about numpy or ordinals change between version 2 and 3? And why would this result in inconsistent killing of the kernel, especially when the regular lev has never thrown an error? Any help would be appreciated.


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>