package enju.ccg.parser
import enju.ccg.lexicon.{PoS, JapanesePoS, Category}
import enju.ccg.lexicon.Direction._

trait HeadFinder {
  type NodeInfo = HeadFinder.NodeInfo
  def get(left:NodeInfo, right:NodeInfo): Direction
}
object HeadFinder {
  case class NodeInfo(pos:PoS, category:Category, headCategory:Category)
}

// TODO: write rule; currently deterministic
object EnglishHeadFinder extends HeadFinder { def get(left:NodeInfo, right:NodeInfo) = Right }

object JapaneseHeadFinder extends HeadFinder {
  def get(left:NodeInfo, right:NodeInfo) = Right // (left, right) match {
  //   case (JapanesePoS(_,vL,conjL,hierarL), JapanesePoS(_,vR,conjR,hierarR)) => Right
  //   case _ => throw new RuntimeException("JapaneseHeadFinder should be used with JapanesePoS")
  // }
}

package enju.ccg.parser
import enju.ccg.lexicon.{PoS, JapanesePoS, Category}
import enju.ccg.lexicon.Direction._

trait HeadFinder {
  type NodeInfo = HeadFinder.NodeInfo
  def get(left:NodeInfo, right:NodeInfo): Direction
}
object HeadFinder {
  case class NodeInfo(pos:PoS, category:Category, headCategory:Category)
}

// TODO: write rule; currently deterministic
object EnglishHeadFinder extends HeadFinder { def get(left:NodeInfo, right:NodeInfo) = Right }

object JapaneseHeadFinder extends HeadFinder {
  val Symbol = "記号"
  def get(left:NodeInfo, right:NodeInfo) = {
    val leftPos = left.pos.first.v
    val rightPos = right.pos.first.v
    if (rightPos == Symbol) Left else Right
  }
}

Implement hard-coded head finding rules for Japanese based on PoS
Implement hard-coded head finding rules for Japanese based on PoS
