gt: 					if (score != Double.NEGATIVE_INFINITY) {
context: package model;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.List;
  
  import tberg.murphy.arrays.a;
  import tberg.murphy.tuple.Pair;
  import lm.LanguageModel;
  import main.Main;
  import model.CharacterNgramTransitionModel.CharacterNgramTransitionState;
  import model.CharacterNgramTransitionModel.TransitionStateType;
  import model.SparseTransitionModel.TransitionState;
  
  public class CharacterNgramTransitionModelMarkovOffset implements SparseTransitionModel {
  	
  	public class CharacterNgramTransitionState implements SparseTransitionModel.TransitionState {
  		private final int[] context;
  		private final TransitionStateType type;
  		private final int offset;
  
  		private final int charIndex;
  		private final int hashCode;
  		
  		public CharacterNgramTransitionState(int[] context, int offset, TransitionStateType type) {
  			this.context = context;
  			this.offset = offset;
  			this.type = type;
  			
  			if (context.length == 0 || type == TransitionStateType.LMRGN || type == TransitionStateType.LMRGN_HPHN || type == TransitionStateType.RMRGN || type == TransitionStateType.RMRGN_HPHN) {
  				this.charIndex = spaceCharIndex;
  			} else if (type == TransitionStateType.RMRGN_HPHN_INIT) {
  				this.charIndex = hyphenCharIndex;
  			} else {
  				this.charIndex = context[context.length-1];
  			}
  			
  			this.hashCode = 1013 * Arrays.hashCode(context) + 1009 * this.offset + 997 * this.type.ordinal();
  		}
  		
  		public boolean equals(Object other) {
  		    if (other instanceof CharacterNgramTransitionState) {
  		    	CharacterNgramTransitionState that = (CharacterNgramTransitionState) other;
  		    	if (this.type != that.type) {
  		    		return false;
  		    	} else if (this.offset != that.offset) {
  		    		return false;
  		    	} else if (!Arrays.equals(this.context, that.context)) {
  		    		return false;
  		    	} else {
  		    		return true;
  		    	}
  		    } else {
  		    	return false;
  		    }
  		}
  		
  		public int hashCode() {
  			return hashCode;
  		}
  		
  		public Collection<Pair<TransitionState,Double>> nextLineStartStates() {
  			List<Pair<TransitionState,Double>> result = new ArrayList<Pair<TransitionState,Double>>();
  			TransitionStateType type = getType();
  			int[] context = getContext();
  			if (type == TransitionStateType.TMPL) {
  				double scoreWithSpace =  Math.log(lm.getCharNgramProb(context, spaceCharIndex));
  				if (scoreWithSpace != Double.NEGATIVE_INFINITY) {
  					int[] contextWithSpace = shrinkContext(a.append(context, spaceCharIndex));
  					{
  						double score = Math.log(LINE_MRGN_PROB) + scoreWithSpace;
  						if (score != Double.NEGATIVE_INFINITY) {
  							result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(contextWithSpace, 0, TransitionStateType.LMRGN), score));
  						}
  					}
  					for (int c=0; c<lm.getCharacterIndexer().size(); ++c) {
  						double intermediateScore = Math.log((1.0 - LINE_MRGN_PROB)) + scoreWithSpace + Math.log(lm.getCharNgramProb(contextWithSpace, c));
  						if (intermediateScore != Double.NEGATIVE_INFINITY) {
  							int[] nextContext = shrinkContext(a.append(contextWithSpace, c));
  							for (int offset=-CharacterTemplate.MAX_OFFSET; offset<=CharacterTemplate.MAX_OFFSET; ++offset) {
  								double score = intermediateScore + LOG_OFFSET_START_PROBS[offset+CharacterTemplate.MAX_OFFSET];
  								if (score != Double.NEGATIVE_INFINITY) {
  									result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(nextContext, offset, TransitionStateType.TMPL), score));
  								}
  							}
  						}
  					}
  				}
  			} else if (type == TransitionStateType.RMRGN) {
  				{
  					double score = Math.log(LINE_MRGN_PROB);
  					if (score != Double.NEGATIVE_INFINITY) {
  						result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(context, 0, TransitionStateType.LMRGN), score));
  					}
  				}
  				for (int c=0; c<lm.getCharacterIndexer().size(); ++c) {
  					double intermediateScore = Math.log((1.0 - LINE_MRGN_PROB)) + Math.log(lm.getCharNgramProb(context, c));
  					if (intermediateScore != Double.NEGATIVE_INFINITY) {
  						int[] nextContext = shrinkContext(a.append(context, c));
  						for (int offset=-CharacterTemplate.MAX_OFFSET; offset<=CharacterTemplate.MAX_OFFSET; ++offset) {
  							double score = intermediateScore + LOG_OFFSET_START_PROBS[offset+CharacterTemplate.MAX_OFFSET];
  							if (score != Double.NEGATIVE_INFINITY) {
  								result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(nextContext, offset, TransitionStateType.TMPL), score));
  							}
  						}
  					}
  				}
  			} else if (type == TransitionStateType.RMRGN_HPHN || type == TransitionStateType.RMRGN_HPHN_INIT) {
  				{
  					double score = Math.log(LINE_MRGN_PROB);
  					if (score != Double.NEGATIVE_INFINITY) {
  						result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(context, 0, TransitionStateType.LMRGN_HPHN), score));
  					}
  				}
  				for (int c=0; c<lm.getCharacterIndexer().size(); ++c) {
  					if (c != spaceCharIndex && !isPunc[c]) {
  						double intermedateScore = Math.log((1.0 - LINE_MRGN_PROB)) + Math.log(lm.getCharNgramProb(context, c));
  						if (intermedateScore != Double.NEGATIVE_INFINITY) {
  							int[] nextContext = shrinkContext(a.append(context, c));
  							for (int offset=-CharacterTemplate.MAX_OFFSET; offset<=CharacterTemplate.MAX_OFFSET; ++offset) {
  								double score = intermedateScore + LOG_OFFSET_START_PROBS[offset+CharacterTemplate.MAX_OFFSET];
  								result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(nextContext, offset, TransitionStateType.TMPL), score));
  							}
  						}
  					}
  				}
  			} else if (type == TransitionStateType.LMRGN || type == TransitionStateType.LMRGN_HPHN) {
  				{
  					double score = Math.log(LINE_MRGN_PROB);
  					if (score != Double.NEGATIVE_INFINITY) {
  						result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(new int[0], 0, TransitionStateType.LMRGN), score));
  					}
  				}
  				for (int c=0; c<lm.getCharacterIndexer().size(); ++c) {
  					double intermediateScore = Math.log((1.0 - LINE_MRGN_PROB)) + Math.log(lm.getCharNgramProb(context, c));
  					if (intermediateScore != Double.NEGATIVE_INFINITY) {
  						for (int offset=-CharacterTemplate.MAX_OFFSET; offset<=CharacterTemplate.MAX_OFFSET; ++offset) {
  							double score = intermediateScore + LOG_OFFSET_START_PROBS[offset+CharacterTemplate.MAX_OFFSET];
  							if (score != Double.NEGATIVE_INFINITY) {
  								result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(new int[] {c}, offset, TransitionStateType.TMPL), score));
  							}
  						}
  					}
  				}
  			}
  			return result;
  		}
  		
  		public double endLogProb() {
  			return 0.0;
  		}
  		
  		public Collection<Pair<TransitionState,Double>> forwardTransitions() {
  			int[] context = getContext();
  			TransitionStateType type = getType();
  			List<Pair<TransitionState,Double>> result = new ArrayList<Pair<TransitionState,Double>>();
  			if (type == TransitionStateType.LMRGN) {
  				{
  					double score = Math.log(LINE_MRGN_PROB);
  					if (score != Double.NEGATIVE_INFINITY) {
  						result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(context, 0, TransitionStateType.LMRGN), score));
  					}
  				}
  				for (int c=0; c<lm.getCharacterIndexer().size(); ++c) {
  					double intermediateScore = Math.log((1.0 - LINE_MRGN_PROB)) + Math.log(lm.getCharNgramProb(context, c));
  					if (intermediateScore != Double.NEGATIVE_INFINITY) {
  						int[] nextContext = shrinkContext(a.append(context, c));
  						for (int offset=-CharacterTemplate.MAX_OFFSET; offset<=CharacterTemplate.MAX_OFFSET; ++offset) {
  							double score = intermediateScore + LOG_OFFSET_START_PROBS[offset+CharacterTemplate.MAX_OFFSET];
  							if (score != Double.NEGATIVE_INFINITY) {
  								result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(nextContext, offset, TransitionStateType.TMPL), score));
  							}
  						}
  					}
  				}
  			} else if (type == TransitionStateType.LMRGN_HPHN) {
  				{
  					double score = Math.log(LINE_MRGN_PROB);
  					if (score != Double.NEGATIVE_INFINITY) {
  						result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(context, 0, TransitionStateType.LMRGN_HPHN), score));
  					}
  				}
  				for (int c=0; c<lm.getCharacterIndexer().size(); ++c) {
  					if (c != spaceCharIndex && !isPunc[c]) {
  						double intermediateScore = Math.log((1.0 - LINE_MRGN_PROB)) + Math.log(lm.getCharNgramProb(context, c));
  						if (intermediateScore != Double.NEGATIVE_INFINITY) {
  							int[] nextContext = shrinkContext(a.append(context, c));
  							for (int offset=-CharacterTemplate.MAX_OFFSET; offset<=CharacterTemplate.MAX_OFFSET; ++offset) {
  								double score = intermediateScore + LOG_OFFSET_START_PROBS[offset+CharacterTemplate.MAX_OFFSET];
  								if (score != Double.NEGATIVE_INFINITY) {
  									result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(nextContext, offset, TransitionStateType.TMPL), score));
  								}
  							}
  						}
  					}
  				}
  			} else if (type == TransitionStateType.RMRGN) {
  				double score = Math.log(LINE_MRGN_PROB);
  				if (score != Double.NEGATIVE_INFINITY) {
  					result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(context, 0, TransitionStateType.RMRGN), score));
  				}
  			} else if (type == TransitionStateType.RMRGN_HPHN) {
  				double score = Math.log(LINE_MRGN_PROB);
  				if (score != Double.NEGATIVE_INFINITY) {
  					result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(context, 0, TransitionStateType.RMRGN_HPHN), score));
  				}
  			} else if (type == TransitionStateType.RMRGN_HPHN_INIT) {
  				double score = Math.log(LINE_MRGN_PROB);
  				if (score != Double.NEGATIVE_INFINITY) {
  					result.add(Pair.makePair((TransitionState) new CharacterNgramTransitionState(context, 0, TransitionStateType.RMRGN_HPHN), score));
  				}
  			} else if (type == TransitionStateType.TMPL) {
  				{
  					double score = Math.log(LINE_MRGN_PROB) + Math.log(1.0 - LINE_END_HYPHEN_PROB) + Math.log(lm.getCharNgramProb(context, spaceCharIndex));
  