You eventually want to create your own preprocessing steps, your own features or another implementation of the same feature. You can do so by specifying a Python script in preprocessing or features.
If a preprocessing class or a feature class exists in the official hwrt and in a plugin simultaniously, the hwrt implementation is used.
Every feature class must have a __str__, __repr__ and a __call__ function where
Every feature class must have a __str__, __repr__, __call__ and get_dimension function where
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hwrt.handwritten_data as HandwrittenData
class Nullify(object):
def __repr__(self):
return "Nullify"
def __str__(self):
return "Nullify"
def __call__(self, hwr_obj):
assert isinstance(hwr_obj, handwritten_data.HandwrittenData), \
"handwritten data is not of type HandwrittenData, but of %r" % \
type(hwr_obj)
# pointlist = hwr_obj.get_pointlist()
new_pointlist = []
new_stroke = []
new_stroke.append({'x': 0, 'y': 0, 'time': 0})
new_pointlist.append(new_stroke)
hwr_obj.set_pointlist(new_pointlist)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hwrt.handwritten_data as HandwrittenData
class StrokeCountTata(object):
"""Stroke count as a 1 dimensional recording."""
normalize = True
def __repr__(self):
return "StrokeCount"
def __str__(self):
return "stroke count"
def get_dimension(self):
return 1
def __call__(self, hwr_obj):
assert isinstance(hwr_obj, handwritten_data.HandwrittenData), \
"handwritten data is not of type HandwrittenData, but of %r" % \
type(hwr_obj)
return [len(hwr_obj.get_pointlist())]