forked from scrapinghub/python-crfsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ahegel/float-embeddings
Float embeddings
- Loading branch information
Showing
4 changed files
with
1,941 additions
and
1,261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.