private LevelResults compareWords(BxPage expected, BxPage actual) { Map<BxChunk, BxWord> map = BxModelUtils.mapChunksToWords(actual); LevelResults results = new LevelResults(); for (BxZone expectedZone : expected) { if (ignoredLabels.contains(expectedZone.getLabel())) { continue; } for (BxLine expectedLine : expectedZone) { for (BxWord expectedWord : expectedLine) { Set<BxWord> actualWords = new HashSet<BxWord>(); for (BxChunk chunk : expectedWord) { actualWords.add(map.get(chunk)); } if (actualWords.size() == 1) { for (BxWord actualWord : actualWords) { if (actualWord.childrenCount() == expectedWord.childrenCount()) { results.matched++; } } } results.all++; } } } return results; }