Class DocumentMerges

java.lang.Object
opennlp.tools.document.DocumentMerges

final class DocumentMerges extends Object
The argument and duplicate layer checks shared by the merge implementations.
  • Constructor Details

    • DocumentMerges

      private DocumentMerges()
  • Method Details

    • checkMergeable

      static void checkMergeable(Document document, Document other, Document.DuplicateLayerPolicy duplicateLayers)
      Checks the arguments of a merge.
      Parameters:
      document - The document merged into.
      other - The document whose layers are added.
      duplicateLayers - How to treat a layer key present on both documents.
      Throws:
      IllegalArgumentException - Thrown if other or duplicateLayers is null, or if the two documents carry different text content.
    • checkDuplicateLayer

      static void checkDuplicateLayer(Document base, LayerKey<?> layer, Document other, Document.DuplicateLayerPolicy duplicateLayers)
      Checks that a layer present on both documents of a merge can be kept as it is.
      Parameters:
      base - The document merged into, which carries layer.
      layer - The layer key present on both documents.
      other - The document whose layers are added, which carries layer.
      duplicateLayers - How to treat a layer key present on both documents.
      Throws:
      IllegalArgumentException - Thrown if duplicateLayers is not Document.DuplicateLayerPolicy.KEEP_EQUAL, or if the two documents carry different contents for layer; the exception names the key.