mpkorstanje / simmetrics

Similarity or Distance Metrics, e.g. Levenshtein, for Java
Apache License 2.0
41 stars 15 forks source link

Static Metric build method. #7

Closed mpkorstanje closed 9 years ago

mpkorstanje commented 9 years ago

The current builder is a bit verbose:

        StringMetric metric = new StringMetricBuilder()
                .with(new CosineSimilarity<String>())
                .simplify(new CaseSimplifier.Lower())
                .tokenize(new QGramTokenizer(2))
                .build();

Could be much shorter by using import static org.simmetrics.StringMetricBuilder.with;

        StringMetric metric = with(new CosineSimilarity<String>())
                .simplify(new CaseSimplifier.Lower())
                .tokenize(new QGramTokenizer(2))
                .build();
mpkorstanje commented 9 years ago

Done.