All Downloads are FREE. Search and download functionalities are using the official Maven repository.

epic.features.MultiWordFeaturizer.scala Maven / Gradle / Ivy

The newest version!
package epic.features

import epic.framework.Feature

/**
 *
 * @author dlwh
 */
@SerialVersionUID(1L)
case class MultiWordFeaturizer[W](featurizers: IndexedSeq[WordFeaturizer[W]]) extends WordFeaturizer[W] with Serializable {
  def this(feats: WordFeaturizer[W]*) = this(feats.toArray)

  def anchor(w: IndexedSeq[W]): WordFeatureAnchoring[W] = new WordFeatureAnchoring[W] {
    val anchs = featurizers.map(_.anchor(w)).toArray
    def words: IndexedSeq[W] = w

    def featuresForWord(pos: Int): Array[Feature] = anchs.flatMap(_.featuresForWord(pos))
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy