Skip to content

Commit

Permalink
sore sentence for bigram
Browse files Browse the repository at this point in the history
  • Loading branch information
ysc committed Dec 21, 2015
1 parent 3f18b0f commit c12bae6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/apdplat/word/corpus/Bigram.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ public static Map<List<Word>, Float> bigram(List<Word>... sentences){

return map;
}
public static float sentenceScore(List<Word> words){
if(words.size() > 1){
float total = words.size() - 1;
float match = 0;
for(int i=0; i<words.size()-1; i++){
if(getScore(words.get(i).getText(), words.get(i+1).getText()) > 0){
match++;
}
}
return match/total;
}
return 0;
}
/**
* 计算分词结果的二元模型分值
* @param words 分词结果
Expand Down

0 comments on commit c12bae6

Please sign in to comment.