<commit_before>package ml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;

import learner.Experience;
import learner.Learner;
import learner.features.ContinuousFeature;
import learner.features.Feature;
import learner.features.NominalFeature;
import learner.utils.Pair;

import org.apache.commons.lang3.SerializationUtils;

/**
 * Implements a model backed by a Learner.
 * 
 * @author woodser
 */
public class ModelLearner implements Model {
  
  private Learner learner;
  
  public ModelLearner() {
    this.learner = new Learner();
  }

  @Override
  public void load(byte[] bytes) {
    this.learner = SerializationUtils.deserialize(bytes);
  }

  @Override
  public byte[] export() {
    return SerializationUtils.serialize(learner);
  }

  @Override
  public void train() {
    // nothing to do
  }

  @Override
  public void addTrainingInstance(Instance instance) {
    learner.learn(getExperience(instance));
  }

  @Override<commit_msg>Cast model deserialization to Learner.<commit_after>package ml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;

import learner.Experience;
import learner.Learner;
import learner.features.ContinuousFeature;
import learner.features.Feature;
import learner.features.NominalFeature;
import learner.utils.Pair;

import org.apache.commons.lang3.SerializationUtils;

/**
 * Implements a model backed by a Learner.
 * 
 * @author woodser
 */
public class ModelLearner implements Model {
  
  private Learner learner;
  
  public ModelLearner() {
    this.learner = new Learner();
  }

  @Override
  public void load(byte[] bytes) {
    this.learner = (Learner) SerializationUtils.deserialize(bytes);
  }

  @Override
  public byte[] export() {
    return SerializationUtils.serialize(learner);
  }

  @Override
  public void train() {
    // nothing to do
  }

  @Override
  public void addTrainingInstance(Instance instance) {
    learner.learn(getExperience(instance));
  }

  @Override
{'fraction_non_alphanumeric': 0.10135450723960766, 'fraction_numerical': 0.0009341429238673517, 'mean_word_length': 4.186440677966102, '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': '889403', 'n_tokens_mistral': 669, 'n_tokens_neox': 651, 'n_words': 158}