in core/src/main/scala/com/spotify/featran/FlatExtractor.scala [108:135]
@inline def apply[M[_]: CollectionType, T: ClassTag: FlatReader](
settings: M[String]
): FlatExtractor[M, T] = new FlatExtractor[M, T](settings)
/**
* Another useful operation is to use the Spec and Information we have to map from the Scala
* Object to read the data directly from the intermediate format for parsing
*
* @param spec
* Current FeatureSpec
* @tparam T
* The intermediate format where the data is stored
* @tparam X
* The Input Scala Object
* @return
* FeatureSpec for the intermediate format
*/
@nowarn(
"msg=evidence parameter evidence.* of type scala.reflect.ClassTag\\[.\\] .* is never used"
)
def flatSpec[T: ClassTag: FlatReader, X: ClassTag](spec: FeatureSpec[X]): FeatureSpec[T] = {
val features = spec.features.map { feature =>
val t = feature.transformer.asInstanceOf[Transformer[Any, _, _]]
new Feature(feature.transformer.flatRead, feature.default, t)
.asInstanceOf[Feature[T, _, _, _]]
}
new FeatureSpec[T](features, spec.crossings)
}