<commit_before>package com.tom_e_white.set_game.predict;

import com.tom_e_white.set_game.model.Card;
import com.tom_e_white.set_game.train.*;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.text.ParseException;

/**
 * Predict the card that appears in an image using trained models.
 */
public class CardPredictor {

    private final FeatureFinder numberFinder = new FindCardNumberFeatures();
    private final FeatureFinder colourFinder = new FindCardColourFeatures();
    private final FeatureFinder shadingFinder = new FindCardShadingFeatures();
    private final FeatureFinder shapeFinder = new FindCardShapeFeatures();

    public Card predict(BufferedImage image) throws IOException, ParseException {
        return new Card(predict(numberFinder, image), predict(colourFinder, image),
                predict(shadingFinder, image), predict(shapeFinder, image));
    }

    private int predict(FeatureFinder finder, BufferedImage image) throws IOException, ParseException {
        double[] features = finder.find(image, false);
        return finder.getClassifier().predict(features);
    }
}<commit_msg>Version<commit_after>package com.tom_e_white.set_game.predict;

import com.tom_e_white.set_game.model.Card;
import com.tom_e_white.set_game.train.*;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.text.ParseException;

/**
 * Predict the card that appears in an image using trained models.
 */
public class CardPredictor {

    private final FeatureFinder numberFinder;
    private final FeatureFinder colourFinder;
    private final FeatureFinder shadingFinder;
    private final FeatureFinder shapeFinder;

    public CardPredictor() {
        this(1);
    }

    public CardPredictor(int version) {
        this.numberFinder = new FindCardNumberFeatures();
        this.colourFinder = new FindCardColourFeatures(version);
        this.shadingFinder = new FindCardShadingFeatures();
        this.shapeFinder = new FindCardShapeFeatures();
    }

    public Card predict(BufferedImage image) throws IOException, ParseException {
        return new Card(predict(numberFinder, image), predict(colourFinder, image),
                predict(shadingFinder, image), predict(shapeFinder, image));
    }

    private int predict(FeatureFinder finder, BufferedImage image) throws IOException, ParseException {
        double[] features = finder.find(image, false);
        return finder.getClassifier().predict(features);
    }
}
{'fraction_non_alphanumeric': 0.08543922984356198, 'fraction_numerical': 0.00040112314480545525, 'mean_word_length': 4.2505263157894735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6345953', 'n_tokens_mistral': 660, 'n_tokens_neox': 665, 'n_words': 174}