package com.asher_stern.crf.crf.run;


import java.util.List;
import java.util.Set;

import com.asher_stern.crf.crf.filters.CrfFilteredFeature;
import com.asher_stern.crf.postagging.postaggers.crf.CrfPosTagger;
import com.asher_stern.crf.utilities.TaggedToken;

/**
 * Generates set of features to be used by the CRF algorithm for training and inference of {@link CrfPosTagger}.
 * 
 * @author Asher Stern
 * Date: Nov 10, 2014
 *
 */
public abstract class CrfFeatureGenerator<K,G>
{
	public CrfFeatureGenerator(Iterable<? extends List<? extends TaggedToken<K, G> >> corpus, Set<String> tags)
	{
		super();
		this.corpus = corpus;
		this.tags = tags;
	}
	
	/**
	 * Generate the features (to be lated retrieved by {@link #getFeatures()}).
	 */
	public abstract void generateFeatures();
	
	/**
	 * Return the set of features earlier generated by {@link #generateFeatures()}.
	 * @return the set of features earlier generated by {@link #generateFeatures()}.
	 */
	public abstract Set<CrfFilteredFeature<K, G>> getFeatures();

	
	
	protected final Iterable<? extends List<? extends TaggedToken<K, G> >> corpus;
	protected final Set<String> tags;
}

package com.asher_stern.crf.crf.run;


import java.util.List;
import java.util.Set;

import com.asher_stern.crf.crf.filters.CrfFilteredFeature;
import com.asher_stern.crf.postagging.postaggers.crf.CrfPosTagger;
import com.asher_stern.crf.utilities.TaggedToken;

/**
 * Generates set of features to be used by the CRF algorithm for training and inference of {@link CrfPosTagger}.
 * 
 * @author Asher Stern
 * Date: Nov 10, 2014
 *
 */
public abstract class CrfFeatureGenerator<K,G>
{
	public CrfFeatureGenerator(Iterable<? extends List<? extends TaggedToken<K, G> >> corpus, Set<G> tags)
	{
		super();
		this.corpus = corpus;
		this.tags = tags;
	}
	
	/**
	 * Generate the features (to be lated retrieved by {@link #getFeatures()}).
	 */
	public abstract void generateFeatures();
	
	/**
	 * Return the set of features earlier generated by {@link #generateFeatures()}.
	 * @return the set of features earlier generated by {@link #generateFeatures()}.
	 */
	public abstract Set<CrfFilteredFeature<K, G>> getFeatures();

	
	
	protected final Iterable<? extends List<? extends TaggedToken<K, G> >> corpus;
	protected final Set<G> tags;
}

Change String to generic parameter in CrfFeatureGenerator