Exemplo n.º 1
0
def constant_point_coordinates_test():
    """Test features.ConstantPointCoordinates."""
    f = features.ConstantPointCoordinates(strokes=0,
                                          points_per_stroke=2,
                                          pen_down=False)
    g = features.ConstantPointCoordinates(strokes=0,
                                          points_per_stroke=200,
                                          pen_down=False)
    recording = testhelper.get_symbol_as_handwriting(292934)
    f._features_without_strokes(recording)
    g._features_without_strokes(recording)
    space_evenly = preprocessing.SpaceEvenly()
    space_evenly(recording)
    f._features_without_strokes(recording)
Exemplo n.º 2
0
def test_simple_execution_test():
    algorithms = [
        preprocessing.RemoveDuplicateTime(),
        preprocessing.RemoveDots(),
        preprocessing.SpaceEvenly(),
        preprocessing.SpaceEvenlyPerStroke(),
        preprocessing.DouglasPeucker(),
        preprocessing.StrokeConnect(),
        preprocessing.DotReduction(),
        preprocessing.WildPointFilter(),
        preprocessing.WeightedAverageSmoothing(),
    ]
    for algorithm in algorithms:
        a = testhelper.get_symbol_as_handwriting(292934)
        algorithm(a)
Exemplo n.º 3
0
def test_preprocessing_detection_test():
    preprocessing_queue = [
        {"ScaleAndShift": None},
        {"StrokeConnect": None},
        {"DouglasPeucker": [{"epsilon": 0.2}]},
        {"SpaceEvenly": [{"number": 100}]},
    ]
    correct = [
        preprocessing.ScaleAndShift(),
        preprocessing.StrokeConnect(),
        preprocessing.DouglasPeucker(epsilon=0.2),
        preprocessing.SpaceEvenly(number=100),
    ]
    feature_list = preprocessing.get_preprocessing_queue(preprocessing_queue)
    # TODO: Not only compare lengths of lists but actual contents.
    assert len(feature_list) == len(correct)
Exemplo n.º 4
0
def preprocessing_detection_test():
    preprocessing_queue = [{
        'ScaleAndShift': None
    }, {
        'StrokeConnect': None
    }, {
        'DouglasPeucker': [{
            'epsilon': 0.2
        }]
    }, {
        'SpaceEvenly': [{
            'number': 100
        }]
    }]
    correct = [
        preprocessing.ScaleAndShift(),
        preprocessing.StrokeConnect(),
        preprocessing.DouglasPeucker(epsilon=0.2),
        preprocessing.SpaceEvenly(number=100)
    ]
    feature_list = preprocessing.get_preprocessing_queue(preprocessing_queue)
    # TODO: Not only compare lengths of lists but actual contents.
    nose.tools.assert_equal(len(feature_list), len(correct))