我们如何在stanford ner中使用自己的模式匹配?

i86rm4rw  于 2021-05-27  发布在  Spark
关注(0)|答案(0)|浏览(190)
classifier = CRFClassifier.getJarClassifier("/edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz", null)

def getLocationValues(filePath: String, pStr: String): String = {
        val str: String = classifier.classifyWithInlineXML(pStr).toString
        val person: HashSet[String] = new HashSet[String]
        val location: HashSet[String] = new HashSet[String]
        val organization: HashSet[String] = new HashSet[String]
        val time: HashSet[String] = new HashSet[String]
        val date: HashSet[String] = new HashSet[String]
        val rs: Map[String, AnyRef] = new HashMap[String, AnyRef]
        val locMatcher: Matcher = locationPattern.matcher(str)
        val personMatcher: Matcher = personPattern.matcher(str)
        val orgMatcher: Matcher = orgPattern.matcher(str)
        val timeMatcher: Matcher = timePattern.matcher(str)
        val dateMatcher: Matcher = datePattern.matcher(str)
    }

我正在使用这个分类器,如果我想要一些其他的模式匹配,如数量,速度(滞后,慢,快),可用性(东使用,等等)这是可能的吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题