我正在使用斯坦福大學NLP分析工具包。鑑於詞典中的一個詞,我怎麼能找到它的頻率*?或者,給定一個頻率等級,我怎樣才能確定相應的單詞?Java斯坦福大學NLP:查找單詞頻率?
*在整個語言中,而不僅僅是文本示例。
這是我使用的工具的演示:
class ParserDemo {
public static void main(String[] args) {
LexicalizedParser lp = new LexicalizedParser("englishPCFG.ser.gz");
lp.setOptionFlags(new String[]{"-maxLength", "80", "-retainTmpSubcategories"});
String[] sent = { "Sincerity", "may", "frighten", "the", "boy", "." };
Tree parse = (Tree) lp.apply(Arrays.asList(sent));
parse.pennPrint();
System.out.println();
TreebankLanguagePack tlp = new PennTreebankLanguagePack();
GrammaticalStructureFactory gsf = tlp.grammaticalStructureFactory();
GrammaticalStructure gs = gsf.newGrammaticalStructure(parse);
Collection tdl = gs.typedDependenciesCollapsed();
System.out.println(tdl);
System.out.println();
TreePrint tp = new TreePrint("penn,typedDependenciesCollapsed");
tp.printTree(parse);
}
}
我不認爲我理解這個問題。這是什麼現象單詞的頻率與解析呢? – Stompchicken 2009-11-30 10:28:33
我想通過查看詞語的詞彙頻率來衡量某人的詞彙量。 – 2009-12-01 01:31:43