public void insertCandidatesIntoText(DirectedSparseGraph<Node, String> graph, Document document, double threshholdTrigram) {
NamedEntitiesInText namedEntities = document.getProperty(NamedEntitiesInText.class);
String text = document.getProperty(DocumentText.class).getText();
HashMap<String, Node> nodes = new HashMap<String, Node>();
Collections.sort(namedEntities.getNamedEntities(), new NamedEntityLengthComparator());
<BUG>Collections.reverse(namedEntities.getNamedEntities());
for (NamedEntityInText entity : namedEntities) {</BUG>
String label = text.substring(entity.getStartPos(), entity.getEndPos());
log.info("\tLabel: " + label);
<BUG>long start = System.currentTimeMillis();
if (nodeType.equals("http://yago-knowledge.org/resource/")) {</BUG>
checkRdfsLabelCandidates(graph, threshholdTrigram, nodes, entity, label, nodeType);

public void insertCandidatesIntoText(DirectedSparseGraph<Node, String> graph, Document document, double threshholdTrigram) {
NamedEntitiesInText namedEntities = document.getProperty(NamedEntitiesInText.class);
String text = document.getProperty(DocumentText.class).getText();
HashMap<String, Node> nodes = new HashMap<String, Node>();
Collections.sort(namedEntities.getNamedEntities(), new NamedEntityLengthComparator());
Collections.reverse(namedEntities.getNamedEntities());
HashSet<String> heuristicExpansion = new HashSet<String>();
for (NamedEntityInText entity : namedEntities) {
String label = text.substring(entity.getStartPos(), entity.getEndPos());
log.info("\tLabel: " + label);
long start = System.currentTimeMillis();
label = heuristicExpansion(heuristicExpansion, label);
if (nodeType.equals("http://yago-knowledge.org/resource/")) {
checkRdfsLabelCandidates(graph, threshholdTrigram, nodes, entity, label, nodeType);
