Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Float embeddings #1

Merged
merged 3 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pycrfsuite/_float_features.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import print_function, absolute_import


class FloatFeatures(object):
def __init__(self, values):
if not isinstance(values, list):
raise ValueError("Values should be an instance of list()")
try:
self.values = [float(v) for v in values]
except ValueError:
print("All elements in values should be castable to type float.", file=sys.stderr)
raise
except:
print("Unexpected error:", sys.exc_info()[0])
raise
Loading