public Collection<Tuple2<TransitionState,Double>> startStates(){
  List<Tuple2<TransitionState,Double>> result=new ArrayList<Tuple2<TransitionState,Double>>();
{
    double score=Math.log(LINE_MRGN_PROB);
    addNoSubGlyphStartState(result,new int[0],TransitionStateType.LMRGN,-1,score);
  }
  for (int destLanguage=0; destLanguage < numLanguages; ++destLanguage) {
    SingleLanguageModel destLM=lm.get(destLanguage);
    double destLanguagePrior=lm.languagePrior(destLanguage);
    for (    int c : destLM.getActiveCharacters()) {
      if (c != spaceCharIndex) {
        double score=Math.log(1.0 - LINE_MRGN_PROB) + Math.log(getNgramProb(destLM,new int[0],c)) + Math.log(destLanguagePrior);
        addGlyphStartStates(result,c,new int[]{c},TransitionStateType.TMPL,destLanguage,score);
      }
    }
  }
{
    double totalSpaceProb=0.0;
    for (int language=0; language < numLanguages; ++language)     totalSpaceProb+=getNgramProb(lm.get(language),new int[0],spaceCharIndex) * lm.languagePrior(language);
    double score=Math.log(1.0 - LINE_MRGN_PROB) + Math.log(totalSpaceProb);
    addNoSubGlyphStartState(result,new int[]{spaceCharIndex},TransitionStateType.TMPL,-1,score);
  }
  return result;
}

public Collection < Tuple2 < TransitionState , Double > > startStates ( ) { List < Tuple2 < TransitionState , Double > > result = new ArrayList < Tuple2 < TransitionState , Double > > ( ) ; { double score = Math . log ( LINE_MRGN_PROB ) ; addNoSubGlyphStartState ( result , new int [ 0 ] , TransitionStateType . LMRGN , - 1 , score ) ; } for ( int destLanguage = 0 ; destLanguage < numLanguages ; ++ destLanguage ) { SingleLanguageModel destLM = lm . get ( destLanguage ) ; double destLanguagePrior = lm . languagePrior ( destLanguage ) ; for ( int c : destLM . getActiveCharacters ( ) ) { if ( c != spaceCharIndex ) { double score = Math . log ( 1.0 - LINE_MRGN_PROB ) + Math . log ( getNgramProb ( destLM , new int [ 0 ] , c ) ) + Math . log ( destLanguagePrior ) ; addGlyphStartStates ( result , c , new int [ ] { c } , TransitionStateType . TMPL , destLanguage , score ) ; } } } { double totalSpaceProb = 0.0 ; for ( int language = 0 ; language < numLanguages ; ++ language ) totalSpaceProb += getNgramProb ( lm . get ( language ) , new int [ 0 ] , spaceCharIndex ) * lm . languagePrior ( language ) ; double score = Math . log ( 1.0 - LINE_MRGN_PROB ) + Math . log ( totalSpaceProb ) ; addNoSubGlyphStartState ( result , new int [ ] { spaceCharIndex } , TransitionStateType . TMPL , - 1 , score ) ; } return result ; }
make a collection of states that can be the start of a line . first possibility : l - margin , with no context . has probability line_mrgn_prob * prior prob of the language . ( 1 of this ) other possibilities : tmpl , with any individual single character c as context ( ~ 75 of these ) - probability is : 1 - line_mrgn_prob * probability of c with no context * prior prob of the language .
