### Question:
CreateCandidatesMapper implements MapFunction<ParsedWikiDocument, WikiDocumentOutput> { @Override public WikiDocumentOutput map(ParsedWikiDocument doc) { Set<String> identifiers = doc.getIdentifiers().elementSet(); List<Relation> relations = Lists.newArrayList(); for (String identifier : identifiers) { List<Relation> candidates = generateCandidates(doc, identifier); if(config.getDefinitionMerging()){ selfMerge(candidates); } else { Collections.sort(candidates); Collections.reverse(candidates); } for (Relation rel : candidates) { if (rel.getScore() >= config.getThreshold()) { relations.add(rel); } } } return new WikiDocumentOutput(doc.getTitle(), relations, doc.getIdentifiers()); } CreateCandidatesMapper(BaseConfig config); @Override WikiDocumentOutput map(ParsedWikiDocument doc); static List<Integer> identifierPositions(List<Word> sentence, String identifier); static int closestIdentifierPosition(List<Integer> positions, int wordIdx); static int calculateMax(Multiset<String> frequencies); static List<Sentence> findSentencesWithIdentifier(List<Sentence> sentences, String identifier);  }### Answer:
@Test public void test() throws Exception { ParsedWikiDocument doc = read("com/formulasearchengine/mathosphere/mlp/augmentendwikitext.xml"); CreateCandidatesMapper candidatesMapper = new CreateCandidatesMapper(config); WikiDocumentOutput output = candidatesMapper.map(doc); for (Relation relation : output.getRelations()) { LOGGER.debug("relation: {}", relation); } }