Package opennlp.dl

Class InferenceOptions

java.lang.Object
opennlp.dl.InferenceOptions

public class InferenceOptions extends Object
  • Constructor Details

    • InferenceOptions

      public InferenceOptions()
  • Method Details

    • isIncludeAttentionMask

      public boolean isIncludeAttentionMask()
    • setIncludeAttentionMask

      public void setIncludeAttentionMask(boolean includeAttentionMask)
    • isIncludeTokenTypeIds

      public boolean isIncludeTokenTypeIds()
    • setIncludeTokenTypeIds

      public void setIncludeTokenTypeIds(boolean includeTokenTypeIds)
    • isGpu

      public boolean isGpu()
    • setGpu

      public void setGpu(boolean gpu)
    • getGpuDeviceId

      public int getGpuDeviceId()
    • setGpuDeviceId

      public void setGpuDeviceId(int gpuDeviceId)
    • getDocumentSplitSize

      public int getDocumentSplitSize()
    • setDocumentSplitSize

      public void setDocumentSplitSize(int documentSplitSize)
    • getSplitOverlapSize

      public int getSplitOverlapSize()
    • setSplitOverlapSize

      public void setSplitOverlapSize(int splitOverlapSize)
    • isNormalizeWhitespace

      public boolean isNormalizeWhitespace()
      Returns whether input whitespace is normalized to ASCII spaces before inference.
      Returns:
      whether input whitespace is normalized to ASCII spaces before inference
    • setNormalizeWhitespace

      public void setNormalizeWhitespace(boolean normalizeWhitespace)
      Replaces every Unicode whitespace character in the input with an ASCII space before inference. This is offset preserving (each whitespace code point maps to one space), so any spans a model produces still align with the input. Off by default.

      This is a one-for-one replacement, not the collapse-and-trim whitespace fold of the runtime TextNormalizer.whitespace() rung: runs of whitespace are not merged and leading or trailing whitespace is not removed, so offsets are preserved.

      Parameters:
      normalizeWhitespace - Whether to normalize whitespace.
    • isNormalizeDashes

      public boolean isNormalizeDashes()
      Returns whether input dashes are normalized to the ASCII hyphen before inference.
      Returns:
      whether input dashes are normalized to the ASCII hyphen before inference
    • setNormalizeDashes

      public void setNormalizeDashes(boolean normalizeDashes)
      Replaces Unicode dashes in the input with the ASCII hyphen-minus before inference. This is offset preserving for the dash characters in the Basic Multilingual Plane (the common case). The mathematical minus signs are not affected. Off by default.

      A supplementary-plane dash shrinks from two chars to one, which shifts later offsets, so with this enabled find(...) reports offsets into the normalized text in that case. Use NameFinderDL.findInOriginal(...) for offsets mapped back to the original input.

      Parameters:
      normalizeDashes - Whether to normalize dashes.
    • getLowerCase

      public Boolean getLowerCase()
      Returns whether tokenization should lower case the input text and strip accents, as required by uncased models.
      Returns:
      Boolean.TRUE for uncased models, Boolean.FALSE for cased models, or null if not set, in which case each component applies the default that matches its commonly used models.
    • setLowerCase

      public void setLowerCase(boolean lowerCase)
      Sets whether tokenization should lower case the input text and strip accents. Set true for uncased models and false for cased models. If not set, each component applies the default that matches its commonly used models.
      Parameters:
      lowerCase - Whether to lower case the input text during tokenization.