Package ai.djl.modality.nlp.translator
Class ZeroShotClassificationInput
java.lang.Object
ai.djl.modality.nlp.translator.ZeroShotClassificationInput
A class that represents a
ZeroShotClassificationInput object.-
Constructor Summary
ConstructorsConstructorDescriptionZeroShotClassificationInput(String text, String[] candidates) Constructs a newZeroShotClassificationInputinstance.ZeroShotClassificationInput(String text, String[] candidates, boolean multiLabel) Constructs a newZeroShotClassificationInputinstance.ZeroShotClassificationInput(String text, String[] candidates, boolean multiLabel, String hypothesisTemplate) Constructs a newZeroShotClassificationInputinstance. -
Method Summary
Modifier and TypeMethodDescriptionString[]Returns the candidate labels.Returns the custom template.getText()Returns the text.booleanReturnstrueif to classify multiple labels.static ZeroShotClassificationInputparseInput(Input input) Returns theZeroShotClassificationInputfrom theInput.
-
Constructor Details
-
ZeroShotClassificationInput
Constructs a newZeroShotClassificationInputinstance.- Parameters:
text- the text to classifycandidates- the candidate labels
-
ZeroShotClassificationInput
Constructs a newZeroShotClassificationInputinstance.- Parameters:
text- the text to classifycandidates- the candidate labelsmultiLabel- true to classify multiple labels
-
ZeroShotClassificationInput
public ZeroShotClassificationInput(String text, String[] candidates, boolean multiLabel, String hypothesisTemplate) Constructs a newZeroShotClassificationInputinstance.- Parameters:
text- the text to classifycandidates- the candidate labelsmultiLabel- true to classify multiple labelshypothesisTemplate- the custom template
-
-
Method Details
-
parseInput
Returns theZeroShotClassificationInputfrom theInput.- Parameters:
input- the input object- Returns:
- the
ZeroShotClassificationInputfrom theInput - Throws:
TranslateException- if the input is invalid
-
getText
Returns the text.- Returns:
- the text to be classified
-
getCandidates
Returns the candidate labels.- Returns:
- the candidate labels
-
isMultiLabel
public boolean isMultiLabel()Returnstrueif to classify multiple labels.- Returns:
trueif to classify multiple labels
-
getHypothesisTemplate
Returns the custom template.- Returns:
- the custom template
-