// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java
// public class CrfException extends RuntimeException
// {
// 	private static final long serialVersionUID = 5414394233000815286L;
// 
// 	public CrfException()
// 	{
// 		super();
// 	}
// 
// 	public CrfException(String message, Throwable cause,
// 			boolean enableSuppression, boolean writableStackTrace)
// 	{
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// 	public CrfException(String message, Throwable cause)
// 	{
// 		super(message, cause);
// 	}
// 
// 	public CrfException(String message)
// 	{
// 		super(message);
// 	}
// 
// 	public CrfException(Throwable cause)
// 	{
// 		super(cause);
// 	}
// 	
// 
// }


import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import com.asher_stern.crf.utilities.CrfException;
		for (G tag : canPrecede.keySet())
		{
			Set<G> newSet = new LinkedHashSet<G>();
			for (G precede : canPrecede.get(tag))
			{
				if (precede!=null)
				{
					newSet.add(precede);	
				}
			}
			canPrecedeNonNull.put(tag, newSet);
		}
	}
	
	private void initPrecedeWhenFirst()
	{
		precedeWhenFirst = new LinkedHashMap<G, Set<G>>();
		boolean debug_firstDetected = false;
		for (G tag : canPrecede.keySet())
		{
			if (canPrecede.get(tag).contains(null))
			{
				precedeWhenFirst.put(tag, Collections.singleton(null));
				debug_firstDetected = true;
			}
			else
			{
				precedeWhenFirst.put(tag, Collections.emptySet());
			}
		}
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java
// public class CrfException extends RuntimeException
// {
// 	private static final long serialVersionUID = 5414394233000815286L;
// 
// 	public CrfException()
// 	{
// 		super();
// 	}
// 
// 	public CrfException(String message, Throwable cause,
// 			boolean enableSuppression, boolean writableStackTrace)
// 	{
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// 	public CrfException(String message, Throwable cause)
// 	{
// 		super(message, cause);
// 	}
// 
// 	public CrfException(String message)
// 	{
// 		super(message);
// 	}
// 
// 	public CrfException(Throwable cause)
// 	{
// 		super(cause);
// 	}
// 	
// 
// }


// Path: src/main/java/com/asher_stern/crf/crf/CrfTags.java
import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import com.asher_stern.crf.utilities.CrfException;

		for (G tag : canPrecede.keySet())
		{
			Set<G> newSet = new LinkedHashSet<G>();
			for (G precede : canPrecede.get(tag))
			{
				if (precede!=null)
				{
					newSet.add(precede);	
				}
			}
			canPrecedeNonNull.put(tag, newSet);
		}
	}
	
	private void initPrecedeWhenFirst()
	{
		precedeWhenFirst = new LinkedHashMap<G, Set<G>>();
		boolean debug_firstDetected = false;
		for (G tag : canPrecede.keySet())
		{
			if (canPrecede.get(tag).contains(null))
			{
				precedeWhenFirst.put(tag, Collections.singleton(null));
				debug_firstDetected = true;
			}
			else
			{
				precedeWhenFirst.put(tag, Collections.emptySet());
			}
		}
		if (!debug_firstDetected) {throw new CrfException("Error: no tag has null in its can-precede set. This means that no tag can appear as the first tag in a sentence, which is an error.");}