Skip to content

Commit 6ced2ed

Browse files
authored
Merge pull request #1 from ahegel/float-embeddings
Float embeddings
2 parents d900971 + 1a75d4f commit 6ced2ed

File tree

4 files changed

+1941
-1261
lines changed

4 files changed

+1941
-1261
lines changed

pycrfsuite/_float_features.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from __future__ import print_function, absolute_import
2+
3+
4+
class FloatFeatures(object):
5+
def __init__(self, values):
6+
if not isinstance(values, list):
7+
raise ValueError("Values should be an instance of list()")
8+
try:
9+
self.values = [float(v) for v in values]
10+
except ValueError:
11+
print("All elements in values should be castable to type float.", file=sys.stderr)
12+
raise
13+
except:
14+
print("Unexpected error:", sys.exc_info()[0])
15+
raise

0 commit comments

Comments
 (0)