tsproisl / SoMeWeTa

A part-of-speech tagger with support for domain adaptation and external resources.
GNU General Public License v3.0
22 stars 3 forks source link

"fromstring deprecated" (warnings in Jupyter notebook) #5

Closed TScheffler closed 5 years ago

TScheffler commented 5 years ago

I'm trying to use SoMeWeTa in a notebook and get this error over and over:

self.weights = {f: np.fromstring(base64.b85decode(w), np.float64) for f, w in zip(features, weights)} /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/someweta/tagger.py:225: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead

The model (German social media) does not even load, I can't run this minimal example: asptagger = ASPTagger(beam_size=5, iterations=10) asptagger.load(pos_model) print("got model!")

much less actually tag something: asptagger.tag_sentence(["Ein", "Satz", "ist", "eine", "Liste", "von", "Tokens", "."])

This used to work before (i.e. last year) so I'm not sure what changed.

tsproisl commented 5 years ago

Unfortunately I wasn't able to replicate the DeprecationWarning. Nevertheless, I changed np.fromstring() to np.frombuffer(). Could you update to v1.6.2 and check if everything works as expected?

TScheffler commented 5 years ago

Thank you it works now! I managed to tag the test sentence. Many thanks for the quick fix.