From 03799a2d330c6dbbe12154d4bcea236210b4f6ed Mon Sep 17 00:00:00 2001 From: Victor Chahuneau Date: Mon, 26 Aug 2013 20:12:32 -0400 Subject: Improve the package structure of pycdec This change should not break anything, but now you can run: python setup.py build_ext --inplace and use the cleaner: PYTHONPATH=/path/to/cdec/python python -m ... --- python/src/sa/features.pxi | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 python/src/sa/features.pxi (limited to 'python/src/sa/features.pxi') diff --git a/python/src/sa/features.pxi b/python/src/sa/features.pxi deleted file mode 100644 index 9b9ecf3c..00000000 --- a/python/src/sa/features.pxi +++ /dev/null @@ -1,33 +0,0 @@ -cdef StringMap FD = StringMap() # Feature name dictionary - -INITIAL_CAPACITY = 7 # default number of features -INCREMENT = INITIAL_CAPACITY # double size - -cdef class FeatureVector: - def __cinit__(self): - self.names = IntList(INITIAL_CAPACITY, INCREMENT) - self.values = FloatList(INITIAL_CAPACITY, INCREMENT) - - def set(self, unsigned name, float value): - self.names.append(name) - self.values.append(value) - - def __iter__(self): - cdef unsigned i - for i in range(self.names.len): - yield (FD.word(self.names[i]), self.values[i]) - - def __str__(self): - return ' '.join('%s=%s' % feat for feat in self) - -cdef class Scorer: - cdef models - def __init__(self, *models): - names = [FD.index(model.__name__) for model in models] - self.models = zip(names, models) - - cdef FeatureVector score(self, ctx): - cdef FeatureVector scores = FeatureVector() - for name, model in self.models: - scores.set(name, model(ctx)) - return scores -- cgit v1.2.3