@Test public void testGetHighlightedText() throws Exception { Vertex sourceVertex = graph.addVertex("1", visibility, authorizations); ArrayList<Vertex> terms = new ArrayList<Vertex>(); terms.add(createTermMention(sourceVertex, "joe ferner", PERSON_IRI, 18, 28)); terms.add(createTermMention(sourceVertex, "jeff kunkle", PERSON_IRI, 33, 44, "uniq1")); List<OffsetItem> termAndTermMetadata = new EntityHighlighter().convertTermMentionsToOffsetItems(terms, "", authorizations); String highlightText = EntityHighlighter.getHighlightedText("Test highlight of Joe Ferner and Jeff Kunkle.", termAndTermMetadata); assertEquals("Test highlight of <span class=\"vertex\" title=\"joe ferner\" data-info=\"{&quot;process&quot;:&quot;EntityHighlighterTest&quot;,&quot;id&quot;:&quot;TM_--18-28-EntityHighlighterTest&quot;,&quot;title&quot;:&quot;joe ferner&quot;,&quot;sandboxStatus&quot;:&quot;PRIVATE&quot;,&quot;http: highlightText); }
public String getHighlightedText(String text, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations) { List<OffsetItem> offsetItems = convertTermMentionsToOffsetItems(termMentions, workspaceId, authorizations); return getHighlightedText(text, offsetItems); }
EntityHighlighter { public String getHighlightedText(String text, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations) { List<OffsetItem> offsetItems = convertTermMentionsToOffsetItems(termMentions, workspaceId, authorizations); return getHighlightedText(text, offsetItems); } }
EntityHighlighter { public String getHighlightedText(String text, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations) { List<OffsetItem> offsetItems = convertTermMentionsToOffsetItems(termMentions, workspaceId, authorizations); return getHighlightedText(text, offsetItems); }  }
EntityHighlighter { public String getHighlightedText(String text, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations) { List<OffsetItem> offsetItems = convertTermMentionsToOffsetItems(termMentions, workspaceId, authorizations); return getHighlightedText(text, offsetItems); }  String getHighlightedText(String text, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations); static String getHighlightedText(String text, List<OffsetItem> offsetItems); VideoTranscript getHighlightedVideoTranscript(VideoTranscript videoTranscript, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations); List<OffsetItem> convertTermMentionsToOffsetItems(Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations); }
EntityHighlighter { public String getHighlightedText(String text, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations) { List<OffsetItem> offsetItems = convertTermMentionsToOffsetItems(termMentions, workspaceId, authorizations); return getHighlightedText(text, offsetItems); }  String getHighlightedText(String text, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations); static String getHighlightedText(String text, List<OffsetItem> offsetItems); VideoTranscript getHighlightedVideoTranscript(VideoTranscript videoTranscript, Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations); List<OffsetItem> convertTermMentionsToOffsetItems(Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations);  }