Class LabelsSource
- java.lang.Object
-
- org.deeplearning4j.text.documentiterator.LabelsSource
-
- All Implemented Interfaces:
Serializable
public class LabelsSource extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LabelsSource()
LabelsSource(@NonNull String template)
Build LabelsSource using string template.LabelsSource(@NonNull List<String> labels)
Build LabelsSource using externally defined list of string labels.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getLabels()
This method returns the list of labels used by this generator instance.int
getNumberOfLabelsUsed()
This method returns number of labels used up to the method's callint
indexOf(String label)
String
nextLabel()
Returns next label.void
reset()
This method should be called from Iterator's reset() method, to keep labels in sync with iteratorint
size()
void
storeLabel(String label)
This method is intended for storing labels retrieved from external sources.
-
-
-
Constructor Detail
-
LabelsSource
public LabelsSource()
-
LabelsSource
public LabelsSource(@NonNull @NonNull String template)
Build LabelsSource using string template. Template can be raw string, in this case document counter will be appended to resulting label. I.e. "SENT_" template will produce labels SENT_0, SENT_1, SENT_2 etc. You can also use %d formatter tag, which will be replaced with counter. I.e. "SENT_%i_FLOW_1" will produce labels "SENT_0_FLOW_1", "SENT_1_FLOW_1", "SENT_2_FLOW_1" etc- Parameters:
template
-
-
-
Method Detail
-
indexOf
public int indexOf(String label)
-
size
public int size()
-
nextLabel
public String nextLabel()
Returns next label.- Returns:
- next label, generated or predefined one
-
getLabels
public List<String> getLabels()
This method returns the list of labels used by this generator instance. If external list os labels was used as source, whole list will be returned.- Returns:
- list of labels
-
storeLabel
public void storeLabel(String label)
This method is intended for storing labels retrieved from external sources.- Parameters:
label
-
-
reset
public void reset()
This method should be called from Iterator's reset() method, to keep labels in sync with iterator
-
getNumberOfLabelsUsed
public int getNumberOfLabelsUsed()
This method returns number of labels used up to the method's call- Returns:
-
-