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

epic.parser.morph.MorphFeat.scala Maven / Gradle / Ivy

There is a newer version: 0.4.4
Show newest version
package epic.parser.morph

case class MorphFeat(label: String, value: String);

object MorphFeat {
  def readMorphFeatsFromBit(morphBit: String): Set[MorphFeat] = {
    if (morphBit == "_") {
      Set();
    } else {
      val morphFeats = morphBit.split("\\|").filter(_ != "_");
      val morphFeatsSeq = for (feat <- morphFeats) yield {
        if (feat.contains("=")) {
          val equalsIndex = feat.indexOf("=");
          MorphFeat(feat.substring(0, equalsIndex), feat.substring(equalsIndex + 1));
        } else {
          MorphFeat(feat, "");
        }
      }
      morphFeatsSeq.toSet;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy