private Map<List<String>, Set<Integer>> BuildWordMatches(String[] hyp, 
                                      String[] ref) {
	Set<String> hwhash = new HashSet<String>();
	for (int i = 0; i < hyp.length; i++) {
      hwhash.add(hyp[i]);
	}
	boolean[] cor = new boolean[ref.length];
	for (int i = 0; i < ref.length; i++) {
      if (hwhash.contains(ref[i])) {
		cor[i] = true;
      } else {
		cor[i] = false;
      }
	}

	List<String> reflist = Arrays.asList(ref);
	HashMap<List<String>, Set<Integer>> to_return = new HashMap<List<String>, Set<Integer>>();
	for (int start = 0; start < ref.length; start++) {
      if (cor[start]) {
		for (int end = start; ((end < ref.length) &&
                               (end - start <= MAX_SHIFT_SIZE) &&
                               (cor[end]));
		     end++) {
          List<String> topush = reflist.subList(start, end+1);
          if (to_return.containsKey(topush)) {
			Set<Integer> vals = to_return.get(topush);
			vals.add(new Integer(start));
          } else {
			Set<Integer> vals = new TreeSet<Integer>();
			vals.add(new Integer(start));
			to_return.put(topush, vals);			
          }
		}
      }
	}
	return to_return;
  }