public double condLogProbGivenPrevious ( int position , int label , int [ ] prevLabels ) { if ( prevLabels . length + 1 == windowSize ) { return factorTables [ position ] . conditionalLogProbGivenPrevious ( prevLabels , label ) ; } else if ( prevLabels . length + 1 < windowSize ) { FactorTable ft = factorTables [ position ] . sumOutFront ( ) ; while ( ft . windowSize ( ) > prevLabels . length + 1 ) { ft = ft . sumOutFront ( ) ; } return ft . conditionalLogProbGivenPrevious ( prevLabels , label ) ; } else { int [ ] p = new int [ windowSize - 1 ] ; System . arraycopy ( prevLabels , prevLabels . length - p . length , p , 0 , p . length ) ; return factorTables [ position ] . conditionalLogProbGivenPrevious ( p , label ) ; } }
Gives the probability of a tag at a single position conditioned on a sequence of previous labels .