Created
November 7, 2011 03:04
-
-
Save kumanan/1344093 to your computer and use it in GitHub Desktop.
Scored word generation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val PIPELINE = new AnnotationPipeline( | |
new PtbRegexTokenizer, new StanfordMaxentTagger, new StanfordNameTagger, new HyphenWordExtractorAnnotator, | |
new MweExtractorAnnotator(GLOSSARY_WORDS), new SimplePatternAnnotator | |
) | |
def toScoredWords(md : Metadata , as : AnnotatedSentence) : java.util.List[ScoredWord] = { | |
val annoSentence = toAnnoSentence(as) | |
annoSentence.setMetadata(md) | |
PIPELINE.process(annoSentence) | |
val scoredWords = new ArrayList[ScoredWord] | |
ScoredWordExtractor.getScoredWords(annoSentence, List("tokens", "hyphenword", "ne", "mwe"), Some(GLOSSARY_WORDS), true, new ScoredWordRanker).foreach(swa => { | |
val sw = toScoredWord(swa) | |
sw.setSentenceId(as.getId) | |
scoredWords.add(sw) | |
}) | |
scoredWords | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment