Class NamedEntityEnricher

java.lang.Object
io.goobi.viewer.controller.model.alto.NamedEntityEnricher
All Implemented Interfaces:
TextEnricher

public class NamedEntityEnricher extends Object implements TextEnricher
TextEnricher implementation that wraps ALTO word tokens referenced by named-entity tags in interactive HTML buttons. Each button carries data attributes for the entity type, authority URI, and a pre-built search URL for further lookup.
  • Constructor Details

    • NamedEntityEnricher

      public NamedEntityEnricher()
  • Method Details

    • enrich

      public String enrich(String content, de.intranda.digiverso.ocr.alto.model.structureclasses.lineelements.LineElement element)
      Wraps every word that references a named-entity tag in an interactive HTML button. Each referenced word becomes its own inline button whose visible text is the word's own content; the styling (see .view-fulltext__entity-action-button) renders adjacent word-buttons as a single underlined phrase. The tag's normalized LABEL is intentionally not used as the button text (it would repeat the whole entity label on every word of a multi-word entity); the label and authority data remain reachable through the entity popover.
      Specified by:
      enrich in interface TextEnricher
      Parameters:
      content - the textual content of the word being enriched, used as the button text
      element - the ALTO line element whose word content is being processed
      Returns:
      the enriched HTML button markup if the element is referenced by at least one named-entity tag, otherwise the unchanged content string