我已经成功下载了使用CNN-LSTM训练的1B单词语言模型(https://github.com/tensorflow/models/tree/master/research/lm_1b),我希望能够输入句子或部分句子来获得句子中每个后续单词的概率 .

例如,如果我有一个句子,如“说动物的动物”,我想知道下一个词是“woof”与“meow”的概率 .

我知道运行以下命令会生成LSTM嵌入:

bazel-bin/lm_1b/lm_1b_eval --mode dump_lstm_emb \
                           --pbtxt data/graph-2016-09-10.pbtxt \
                           --vocab_file data/vocab-2016-09-10.txt \
                           --ckpt 'data/ckpt-*' \
                           --sentence "An animal that says woof" \                             
                           --save_dir output

这将产生文件 lstm_emb_step_*.npy ,其中每个文件是句子中每个单词的LSTM嵌入 . 如何将这些变换为训练模型的概率,以便能够比较 P(woof|An animal that says)P(meow|An animal that says)

提前致谢 .