/** * As sequence data set dataset. * * @param sequenceType the sequence type * @param featurizer the featurizer * @return the dataset */ default Dataset<Sequence> asSequenceDataSet( @NonNull AnnotationType sequenceType, @NonNull SequenceFeaturizer<Annotation> featurizer) { return Dataset.sequence() .type(getDataSetType()) .source( asSequenceStream(sequenceType).map(seq -> featurizer.extractSequence(seq.iterator()))) .build(); }
/** * As sequence data set dataset. * * @param labelFunction the label function * @param featurizer the featurizer * @return the dataset */ default Dataset<Sequence> asSequenceDataSet( @NonNull Function<? super Annotation, String> labelFunction, @NonNull SequenceFeaturizer<Annotation> featurizer) { return Dataset.sequence() .type(getDataSetType()) .source( asSequenceStream(labelFunction).map(seq -> featurizer.extractSequence(seq.iterator()))) .build(); }