public WordAlignmentState(final Rule rule,final int start){
  trgPoints=new LinkedList<>();
  srcLength=rule.getFrench().length;
  numNT=rule.getArity();
  srcStart=start;
  final Map<Integer,List<Integer>> alignmentMap=rule.getAlignmentMap();
  final int[] nonTerminalSourcePositions=rule.getNonTerminalSourcePositions();
  final int[] trg=rule.getEnglish();
  for (int trgIndex=0; trgIndex < trg.length; trgIndex++) {
    final AlignedSourceTokens trgPoint=new AlignedSourceTokens();
    if (trg[trgIndex] >= 0) {
      if (alignmentMap.containsKey(trgIndex)) {
        for (        int srcIdx : alignmentMap.get(trgIndex)) {
          trgPoint.add(srcStart + srcIdx);
        }
      }
 else {
        trgPoint.setNull();
      }
    }
 else {
      trgPoint.setNonTerminal();
      final int absoluteNonTerminalSourcePosition=srcStart + nonTerminalSourcePositions[Math.abs(trg[trgIndex]) - 1];
      trgPoint.add(absoluteNonTerminalSourcePosition);
    }
    trgPoints.add(trgPoint);
  }
}

public WordAlignmentState ( final Rule rule , final int start ) { trgPoints = new LinkedList < > ( ) ; srcLength = rule . getFrench ( ) . length ; numNT = rule . getArity ( ) ; srcStart = start ; final Map < Integer , List < Integer > > alignmentMap = rule . getAlignmentMap ( ) ; final int [ ] nonTerminalSourcePositions = rule . getNonTerminalSourcePositions ( ) ; final int [ ] trg = rule . getEnglish ( ) ; for ( int trgIndex = 0 ; trgIndex < trg . length ; trgIndex ++ ) { final AlignedSourceTokens trgPoint = new AlignedSourceTokens ( ) ; if ( trg [ trgIndex ] >= 0 ) { if ( alignmentMap . containsKey ( trgIndex ) ) { for ( int srcIdx : alignmentMap . get ( trgIndex ) ) { trgPoint . add ( srcStart + srcIdx ) ; } } else { trgPoint . setNull ( ) ; } } else { trgPoint . setNonTerminal ( ) ; final int absoluteNonTerminalSourcePosition = srcStart + nonTerminalSourcePositions [ Math . abs ( trg [ trgIndex ] ) - 1 ] ; trgPoint . add ( absoluteNonTerminalSourcePosition ) ; } trgPoints . add ( trgPoint ) ; } }
construct alignmentstate object from a virgin rule and its source span . determines if state is complete ( if no nt present )
