Class ZeroShotClassificationInput

java.lang.Object
ai.djl.modality.nlp.translator.ZeroShotClassificationInput

public class ZeroShotClassificationInput extends Object
A class that represents a ZeroShotClassificationInput object.
  • Constructor Details

    • ZeroShotClassificationInput

      public ZeroShotClassificationInput(String text, String[] candidates)
      Constructs a new ZeroShotClassificationInput instance.
      Parameters:
      text - the text to classify
      candidates - the candidate labels
    • ZeroShotClassificationInput

      public ZeroShotClassificationInput(String text, String[] candidates, boolean multiLabel)
      Constructs a new ZeroShotClassificationInput instance.
      Parameters:
      text - the text to classify
      candidates - the candidate labels
      multiLabel - true to classify multiple labels
    • ZeroShotClassificationInput

      public ZeroShotClassificationInput(String text, String[] candidates, boolean multiLabel, String hypothesisTemplate)
      Constructs a new ZeroShotClassificationInput instance.
      Parameters:
      text - the text to classify
      candidates - the candidate labels
      multiLabel - true to classify multiple labels
      hypothesisTemplate - the custom template
  • Method Details

    • parseInput

      public static ZeroShotClassificationInput parseInput(Input input) throws TranslateException
      Returns the ZeroShotClassificationInput from the Input.
      Parameters:
      input - the input object
      Returns:
      the ZeroShotClassificationInput from the Input
      Throws:
      TranslateException - if the input is invalid
    • getText

      public String getText()
      Returns the text.
      Returns:
      the text to be classified
    • getCandidates

      public String[] getCandidates()
      Returns the candidate labels.
      Returns:
      the candidate labels
    • isMultiLabel

      public boolean isMultiLabel()
      Returns true if to classify multiple labels.
      Returns:
      true if to classify multiple labels
    • getHypothesisTemplate

      public String getHypothesisTemplate()
      Returns the custom template.
      Returns:
      the custom template