示例#1
0
def test_dimensionality():
    feature_list = [
        (features.StrokeCount(), 1),
        (
            features.ConstantPointCoordinates(strokes=4,
                                              points_per_stroke=20,
                                              fill_empty_with=0),
            160,
        ),
        (
            features.ConstantPointCoordinates(strokes=0,
                                              points_per_stroke=20,
                                              fill_empty_with=0),
            60,
        ),
        (
            features.ConstantPointCoordinates(strokes=0,
                                              points_per_stroke=20,
                                              pen_down=False),
            40,
        ),
        (features.AspectRatio(), 1),
        (features.Width(), 1),
        (features.Height(), 1),
        (features.Time(), 1),
        (features.CenterOfMass(), 2),
    ]
    for feat, dimension in feature_list:
        assert feat.get_dimension() == dimension
示例#2
0
def simple_execution_test():
    algorithms = [
        features.ConstantPointCoordinates(),
        features.ConstantPointCoordinates(strokes=0),
        features.FirstNPoints(),
        # features.Bitmap(),
        features.Ink(),
        features.AspectRatio(),
        features.Width(),
        features.Time(),
        features.CenterOfMass(),
        features.StrokeCenter(),
        features.StrokeCenter(8),
        features.StrokeIntersections(),
        features.ReCurvature()
    ]
    for algorithm in algorithms:
        recording = testhelper.get_symbol_as_handwriting(292934)
        algorithm(recording)
示例#3
0
def print_featurelist_test():
    """Test features.print_featurelist."""
    feature_list = [
        features.StrokeCount(),
        features.ConstantPointCoordinates(strokes=4,
                                          points_per_stroke=20,
                                          fill_empty_with=0),
        features.ConstantPointCoordinates(strokes=0,
                                          points_per_stroke=20,
                                          fill_empty_with=0),
        features.ConstantPointCoordinates(strokes=0,
                                          points_per_stroke=20,
                                          pen_down=False),
        features.AspectRatio(),
        features.Width(),
        features.Height(),
        features.Time(),
        features.CenterOfMass()
    ]
    features.print_featurelist(feature_list)