// Path: src/main/java/hu/ppke/itk/nlpg/purepos/cli/configuration/Configuration.java
// public class Configuration {
// 	private String guessedLemmaMarker;
// 
// 	public String getGuessedLemmaMarker() {
// 		return guessedLemmaMarker;
// 	}
// 	
// 	public Configuration() {
// 		this(new ArrayList<StringMapping>(), new ArrayList<StringMapping>(), "", null);
// 	}
// 
// 	public Configuration(List<StringMapping> tagMappings, List<StringMapping> lemmaMappings, String guessedLemmaMarker, Double weight) {
// 		this.tagMappings = tagMappings;
// 		this.lemmaMappings = lemmaMappings;
// 		this.guessedLemmaMarker = guessedLemmaMarker;
// 		this.weight = weight;
// 	}
// 
// 	protected List<StringMapping> tagMappings;
// 	protected List<StringMapping> lemmaMappings;
// 	public Double weight;
// 
// 	public Double getWeight() {
// 		return weight;
// 	}
// 
// 	public List<StringMapping> getTagMappings() {
// 		return tagMappings;
// 	}
// 
// 	public List<StringMapping> getLemmaMappings() {
// 		return lemmaMappings;
// 	}
// }
// 
// Path: src/main/java/hu/ppke/itk/nlpg/purepos/decoder/StemFilter.java
// public class StemFilter {
// 	private Set<String> stems = null;
// 
// 	public StemFilter(File source) throws FileNotFoundException {
// 		stems = readFile(source);
// 	}
// 
// 	protected Set<String> readFile(File path) throws FileNotFoundException {
// 		Set<String> ret = new HashSet<String>();
// 
// 		Scanner fileScanner = new Scanner(path);
// 		while (fileScanner.hasNext())
// 			ret.add(fileScanner.next());
// 
// 		return ret;
// 	}
// 
// 	public Collection<IToken> filterStem(Collection<IToken> candidates) {
// 		if (stems.isEmpty())
// 			return candidates;
// 		List<IToken> ret = new ArrayList<IToken>();
// 		for (IToken c : candidates) {
// 			if (stems.contains(c.getStem()))
// 				ret.add(c);
// 		}
// 		if (ret.isEmpty())
// 			return candidates;
// 		else
// 			return ret;
// 
// 	}
// }
// 
// Path: src/main/java/hu/ppke/itk/nlpg/purepos/model/IVocabulary.java
// public interface IVocabulary<W, I extends Comparable<I>> extends Serializable {
// 
// 	/**
// 	 * Returns the size of the dictionary
// 	 * 
// 	 * @return
// 	 */
// 	public int size();
// 
// 	/**
// 	 * Returns the index for a specific word
// 	 * 
// 	 * @param word
// 	 * @return
// 	 */
// 	public I getIndex(W word);
// 
// 	/**
// 	 * Returns the word for a specific index
// 	 * 
// 	 * @param index
// 	 * @return
// 	 */
// 	public W getWord(I index);
// 
// 	@Deprecated
// 	public NGram<I> getIndeces(List<W> words);
// 
// 	public I addElement(W element);
// 
// 	public Set<I> getTagIndeces();
// 
// 	// public I getExtremalElement();
// 
// 	public void storeMaximalElement();
// 
// 	public I getMaximalIndex();
// }
// 
// Path: src/main/java/hu/ppke/itk/nlpg/purepos/model/internal/StringMapping.java
// public class StringMapping {
// 	/**
// 	 * 
// 	 * @param tagPattern
// 	 *            pattern of the tag, should be an unsescaped Java regexp
// 	 * @param replacement
// 	 *            replacement string
// 	 * 
// 	 */
// 	public StringMapping(String tagPattern, String replacement) {
// 		// this.tagPattern = Pattern.compile(Pattern.quote(tagPattern));
// 		this.tagPattern = Pattern.compile(tagPattern);
// 		this.replacement = replacement;
// 	}
// 
// 	protected Pattern tagPattern;
// 	protected String replacement;
// 
// 	public Pattern getTagPattern() {
// 		return tagPattern;
// 	}
// 
// 	public String getReplacement() {
// 		return replacement;
// 	}
// 
// }


import hu.ppke.itk.nlpg.purepos.model.internal.StringMapping;
import java.io.File;
import java.io.FileNotFoundException;
import java.text.DecimalFormat;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import hu.ppke.itk.nlpg.docmodel.IToken;
import hu.ppke.itk.nlpg.docmodel.internal.ModToken;
import hu.ppke.itk.nlpg.purepos.cli.configuration.Configuration;
import hu.ppke.itk.nlpg.purepos.decoder.StemFilter;
import hu.ppke.itk.nlpg.purepos.model.IVocabulary;
import hu.ppke.itk.nlpg.purepos.model.internal.CompiledModelData;
import hu.ppke.itk.nlpg.purepos.model.internal.StringMapper;
import hu.ppke.itk.nlpg.purepos.model.internal.TagMapper;

	public static String toLower(String word) {
		return word.toLowerCase();
	}

	public static <E> boolean isNotEmpty(Collection<E> c) {
		return c != null && c.size() > 0;
	}

	public static <E> boolean isEmpty(Collection<E> c) {
		return !isNotEmpty(c);
	}

	public static StemFilter createStemFilter() {
		File localFile = new File(STEM_FILTER_FILE);
		String path = null;
		if (STEM_FILTER_PROPERTY != null) {
			File propFile = new File(STEM_FILTER_PROPERTY);
			if (propFile.exists()) {
				path = propFile.getAbsolutePath();
			}
		}

		if (localFile.exists()) {
			path = localFile.getAbsolutePath();
		}

		if (path == null)
			return null;
		try {
// Path: src/main/java/hu/ppke/itk/nlpg/purepos/cli/configuration/Configuration.java
// public class Configuration {
// 	private String guessedLemmaMarker;
// 
// 	public String getGuessedLemmaMarker() {
// 		return guessedLemmaMarker;
// 	}
// 	
// 	public Configuration() {
// 		this(new ArrayList<StringMapping>(), new ArrayList<StringMapping>(), "", null);
// 	}
// 
// 	public Configuration(List<StringMapping> tagMappings, List<StringMapping> lemmaMappings, String guessedLemmaMarker, Double weight) {
// 		this.tagMappings = tagMappings;
// 		this.lemmaMappings = lemmaMappings;
// 		this.guessedLemmaMarker = guessedLemmaMarker;
// 		this.weight = weight;
// 	}
// 
// 	protected List<StringMapping> tagMappings;
// 	protected List<StringMapping> lemmaMappings;
// 	public Double weight;
// 
// 	public Double getWeight() {
// 		return weight;
// 	}
// 
// 	public List<StringMapping> getTagMappings() {
// 		return tagMappings;
// 	}
// 
// 	public List<StringMapping> getLemmaMappings() {
// 		return lemmaMappings;
// 	}
// }
// 
// Path: src/main/java/hu/ppke/itk/nlpg/purepos/decoder/StemFilter.java
// public class StemFilter {
// 	private Set<String> stems = null;
// 
// 	public StemFilter(File source) throws FileNotFoundException {
// 		stems = readFile(source);
// 	}
// 
// 	protected Set<String> readFile(File path) throws FileNotFoundException {
// 		Set<String> ret = new HashSet<String>();
// 
// 		Scanner fileScanner = new Scanner(path);
// 		while (fileScanner.hasNext())
// 			ret.add(fileScanner.next());
// 
// 		return ret;
// 	}
// 
// 	public Collection<IToken> filterStem(Collection<IToken> candidates) {
// 		if (stems.isEmpty())
// 			return candidates;
// 		List<IToken> ret = new ArrayList<IToken>();
// 		for (IToken c : candidates) {
// 			if (stems.contains(c.getStem()))
// 				ret.add(c);
// 		}
// 		if (ret.isEmpty())
// 			return candidates;
// 		else
// 			return ret;
// 
// 	}
// }
// 
// Path: src/main/java/hu/ppke/itk/nlpg/purepos/model/IVocabulary.java
// public interface IVocabulary<W, I extends Comparable<I>> extends Serializable {
// 
// 	/**
// 	 * Returns the size of the dictionary
// 	 * 
// 	 * @return
// 	 */
// 	public int size();
// 
// 	/**
// 	 * Returns the index for a specific word
// 	 * 
// 	 * @param word
// 	 * @return
// 	 */
// 	public I getIndex(W word);
// 
// 	/**
// 	 * Returns the word for a specific index
// 	 * 
// 	 * @param index
// 	 * @return
// 	 */
// 	public W getWord(I index);
// 
// 	@Deprecated
// 	public NGram<I> getIndeces(List<W> words);
// 
// 	public I addElement(W element);
// 
// 	public Set<I> getTagIndeces();
// 
// 	// public I getExtremalElement();
// 
// 	public void storeMaximalElement();
// 
// 	public I getMaximalIndex();
// }
// 
// Path: src/main/java/hu/ppke/itk/nlpg/purepos/model/internal/StringMapping.java
// public class StringMapping {
// 	/**
// 	 * 
// 	 * @param tagPattern
// 	 *            pattern of the tag, should be an unsescaped Java regexp
// 	 * @param replacement
// 	 *            replacement string
// 	 * 
// 	 */
// 	public StringMapping(String tagPattern, String replacement) {
// 		// this.tagPattern = Pattern.compile(Pattern.quote(tagPattern));
// 		this.tagPattern = Pattern.compile(tagPattern);
// 		this.replacement = replacement;
// 	}
// 
// 	protected Pattern tagPattern;
// 	protected String replacement;
// 
// 	public Pattern getTagPattern() {
// 		return tagPattern;
// 	}
// 
// 	public String getReplacement() {
// 		return replacement;
// 	}
// 
// }


// Path: src/main/java/hu/ppke/itk/nlpg/purepos/common/Util.java
import hu.ppke.itk.nlpg.purepos.model.internal.StringMapping;
import java.io.File;
import java.io.FileNotFoundException;
import java.text.DecimalFormat;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import hu.ppke.itk.nlpg.docmodel.IToken;
import hu.ppke.itk.nlpg.docmodel.internal.ModToken;
import hu.ppke.itk.nlpg.purepos.cli.configuration.Configuration;
import hu.ppke.itk.nlpg.purepos.decoder.StemFilter;
import hu.ppke.itk.nlpg.purepos.model.IVocabulary;
import hu.ppke.itk.nlpg.purepos.model.internal.CompiledModelData;
import hu.ppke.itk.nlpg.purepos.model.internal.StringMapper;
import hu.ppke.itk.nlpg.purepos.model.internal.TagMapper;


	public static String toLower(String word) {
		return word.toLowerCase();
	}

	public static <E> boolean isNotEmpty(Collection<E> c) {
		return c != null && c.size() > 0;
	}

	public static <E> boolean isEmpty(Collection<E> c) {
		return !isNotEmpty(c);
	}

	public static StemFilter createStemFilter() {
		File localFile = new File(STEM_FILTER_FILE);
		String path = null;
		if (STEM_FILTER_PROPERTY != null) {
			File propFile = new File(STEM_FILTER_PROPERTY);
			if (propFile.exists()) {
				path = propFile.getAbsolutePath();
			}
		}

		if (localFile.exists()) {
			path = localFile.getAbsolutePath();
		}

		if (path == null)
			return null;
		try {
			return new StemFilter(new File(path));