Package opennlp.dl

# Class InferenceOptions

java.lang.Object
opennlp.dl.InferenceOptions

public class InferenceOptions extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InferenceOptions()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getDocumentSplitSize()`
  `int`
  `getGpuDeviceId()`
  `Boolean`
  `getLowerCase()`
  Returns whether tokenization should lower case the input text and strip accents, as required by uncased models.
  `int`
  `getSplitOverlapSize()`
  `boolean`
  `isGpu()`
  `boolean`
  `isIncludeAttentionMask()`
  `boolean`
  `isIncludeTokenTypeIds()`
  `boolean`
  `isNormalizeDashes()`
  Returns whether input dashes are normalized to the ASCII hyphen before inference.
  `boolean`
  `isNormalizeWhitespace()`
  Returns whether input whitespace is normalized to ASCII spaces before inference.
  `void`
  `setDocumentSplitSize(int documentSplitSize)`
  `void`
  `setGpu(boolean gpu)`
  `void`
  `setGpuDeviceId(int gpuDeviceId)`
  `void`
  `setIncludeAttentionMask(boolean includeAttentionMask)`
  `void`
  `setIncludeTokenTypeIds(boolean includeTokenTypeIds)`
  `void`
  `setLowerCase(boolean lowerCase)`
  Sets whether tokenization should lower case the input text and strip accents.
  `void`
  `setNormalizeDashes(boolean normalizeDashes)`
  Replaces Unicode dashes in the input with the ASCII hyphen-minus before inference.
  `void`
  `setNormalizeWhitespace(boolean normalizeWhitespace)`
  Replaces every Unicode whitespace character in the input with an ASCII space before inference.
  `void`
  `setSplitOverlapSize(int splitOverlapSize)`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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.