예제 #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 test_execution():
    """
    Test if analyze_data.filter_label and analyze_data.analyze_feature are
    executable at all.
    """
    analyze_data.filter_label("\\dag", replace_by_similar=True)
    analyze_data.filter_label("\\diameter", replace_by_similar=True)
    analyze_data.filter_label("\\degree", replace_by_similar=True)
    analyze_data.filter_label("\\alpha", replace_by_similar=True)

    raw_datasets = testhelper.get_raw_datasets()
    feature = features.AspectRatio()
    filename = "aspect_ratio.csv"
    analyze_data.analyze_feature(raw_datasets, feature, filename)
예제 #3
0
파일: feature_test.py 프로젝트: lyqsr/hwrt
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)
예제 #4
0
파일: feature_test.py 프로젝트: lyqsr/hwrt
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)