Permalink
Browse files

Addition of tri-gram queries to LM. Correction of n-gram queries (now…

… in proper sentence order).
  • Loading branch information...
1 parent 090487b commit 6592057f3a6705fb8b628a566eb88ea8fbd40c91 @julosaure committed Sep 25, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/decloder/translator.clj
@@ -27,10 +27,18 @@
(if (nil? pred-hypo)
lex-prob
- (let [n-grams (str trg-token " " (:token pred-hypo))
- lm-score (decloder.blm/score-ngrams (model :lm) n-grams)]
- ;(println "n-gram to score: " n-grams " -> " lm-score)
- (+ lex-prob (:score pred-hypo) lm-score)
+ (let [bi-gram (str (:token pred-hypo) " " trg-token)]
+ (if (nil? (:pred pred-hypo))
+ (let [lm-score (decloder.blm/score-ngrams (model :lm) bi-gram)]
+ ;(println "bi-gram to score: " bi-gram " -> " lm-score)
+ (+ lex-prob (:score pred-hypo) lm-score)
+ )
+ (let [tri-gram (str (:token (:pred pred-hypo)) " " bi-gram)
+ lm-score (decloder.blm/score-ngrams (model :lm) tri-gram)]
+ ;(println "tri-gram to score: " tri-gram " -> " lm-score)
+ (+ lex-prob (:score pred-hypo) lm-score)
+ )
+ )
)
)
)

0 comments on commit 6592057

Please sign in to comment.