public class MxBertVocabulary
extends java.lang.Object
implements ai.djl.modality.nlp.Vocabulary
| Constructor and Description |
|---|
MxBertVocabulary() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(java.lang.String token) |
long |
getIndex(java.lang.String token) |
java.lang.String |
getToken(long index) |
static MxBertVocabulary |
parse(java.io.InputStream is)
Parses the vocabulary file and create
MxBertVocabulary. |
static MxBertVocabulary |
parse(java.nio.file.Path path)
Parses the vocabulary file and create
MxBertVocabulary. |
static MxBertVocabulary |
parse(java.lang.String url)
Parses the vocabulary file and create
MxBertVocabulary. |
long |
size() |
public static MxBertVocabulary parse(java.nio.file.Path path)
MxBertVocabulary.path - the input file pathMxBertVocabularypublic static MxBertVocabulary parse(java.lang.String url)
MxBertVocabulary.url - the input vocabulary file urlMxBertVocabularypublic static MxBertVocabulary parse(java.io.InputStream is)
MxBertVocabulary.is - the input InputStream of the vocabulary fileMxBertVocabularypublic long getIndex(java.lang.String token)
getIndex in interface ai.djl.modality.nlp.Vocabularypublic boolean contains(java.lang.String token)
contains in interface ai.djl.modality.nlp.Vocabularypublic long size()
size in interface ai.djl.modality.nlp.Vocabularypublic java.lang.String getToken(long index)
getToken in interface ai.djl.modality.nlp.Vocabulary