public static double [ ] [ ] combine ( double [ ] fracRoot , double [ ] [ ] fracChild ) { int nplus = fracChild . length + 1 ; double [ ] [ ] scores = new double [ nplus ] [ nplus ] ; for ( int p = 0 ; p < nplus ; p ++ ) { for ( int c = 0 ; c < nplus ; c ++ ) { if ( c == 0 ) { scores [ p ] [ c ] = Double . NEGATIVE_INFINITY ; } else if ( p == 0 && c > 0 ) { scores [ p ] [ c ] = fracRoot [ c - 1 ] ; } else { scores [ p ] [ c ] = fracChild [ p - 1 ] [ c - 1 ] ; } } } return scores ; }
Combines a set of edge weights represented as wall and child weights into a single set of weights . The combined weights are indexed such that the wall has index 0 and the tokens of the sentence are 1 - indexed .