// Path: src/main/java/com/asher_stern/crf/utilities/MiscellaneousUtilities.java
// public static <T> boolean equalObjects(T t1, T t2)
// {
// 	if (t1==t2) return true;
// 	if ( (t1==null) || (t2==null) ) return false;
// 	return t1.equals(t2);
// }
// 
// Path: src/main/java/com/asher_stern/crf/crf/CrfFeature.java
// public abstract class CrfFeature<K,G> implements Serializable // K = token, G = tag
// {
// 	private static final long serialVersionUID = 5422105702440104947L;
// 	
// 	public abstract double value(K[] sequence, int indexInSequence, G currentTag, G previousTag);
// 	
// 	public abstract boolean equals(Object obj);
// 	public abstract int hashCode();
// }


import static com.asher_stern.crf.utilities.MiscellaneousUtilities.equalObjects;
import com.asher_stern.crf.crf.CrfFeature;
package com.asher_stern.crf.postagging.postaggers.crf.features;



/**
 * A CRF feature the models that a certain token is assigned a certain tag.
 * The token is considered in a case-insensitivity manner, i.e., "AbC" is considered equal to "abc".
 * 
 * @author Asher Stern
 * Date: Nov 20, 2014
 *
 */
public class CaseInsensitiveTokenAndTagFeature extends CrfFeature<String, String>
{
	private static final long serialVersionUID = 2767104089617969815L;
	
	public CaseInsensitiveTokenAndTagFeature(String token, String tag)
	{
		super();
		this.tokenLowerCase = ( (token==null)?null:token.toLowerCase() );
		this.tag = tag;
	}

	@Override
	public double value(String[] sequence, int indexInSequence,
			String currentTag, String previousTag)
	{
		String tokenInSentence_lowerCase = sequence[indexInSequence];
		if (tokenInSentence_lowerCase!=null)
		{
			tokenInSentence_lowerCase = tokenInSentence_lowerCase.toLowerCase();
		}
		
		double ret = 0.0;
// Path: src/main/java/com/asher_stern/crf/utilities/MiscellaneousUtilities.java
// public static <T> boolean equalObjects(T t1, T t2)
// {
// 	if (t1==t2) return true;
// 	if ( (t1==null) || (t2==null) ) return false;
// 	return t1.equals(t2);
// }
// 
// Path: src/main/java/com/asher_stern/crf/crf/CrfFeature.java
// public abstract class CrfFeature<K,G> implements Serializable // K = token, G = tag
// {
// 	private static final long serialVersionUID = 5422105702440104947L;
// 	
// 	public abstract double value(K[] sequence, int indexInSequence, G currentTag, G previousTag);
// 	
// 	public abstract boolean equals(Object obj);
// 	public abstract int hashCode();
// }


// Path: src/main/java/com/asher_stern/crf/postagging/postaggers/crf/features/CaseInsensitiveTokenAndTagFeature.java
import static com.asher_stern.crf.utilities.MiscellaneousUtilities.equalObjects;
import com.asher_stern.crf.crf.CrfFeature;

package com.asher_stern.crf.postagging.postaggers.crf.features;



/**
 * A CRF feature the models that a certain token is assigned a certain tag.
 * The token is considered in a case-insensitivity manner, i.e., "AbC" is considered equal to "abc".
 * 
 * @author Asher Stern
 * Date: Nov 20, 2014
 *
 */
public class CaseInsensitiveTokenAndTagFeature extends CrfFeature<String, String>
{
	private static final long serialVersionUID = 2767104089617969815L;
	
	public CaseInsensitiveTokenAndTagFeature(String token, String tag)
	{
		super();
		this.tokenLowerCase = ( (token==null)?null:token.toLowerCase() );
		this.tag = tag;
	}

	@Override
	public double value(String[] sequence, int indexInSequence,
			String currentTag, String previousTag)
	{
		String tokenInSentence_lowerCase = sequence[indexInSequence];
		if (tokenInSentence_lowerCase!=null)
		{
			tokenInSentence_lowerCase = tokenInSentence_lowerCase.toLowerCase();
		}
		
		double ret = 0.0;
		if ( equalObjects(tokenInSentence_lowerCase, tokenLowerCase) && equalObjects(currentTag, tag))