def sample_noun(self, vector):
"""Sample a noun at random.
The probability of word :math:`w` is
.. math::
\log(p(w))\propto w^Tv`
where :math:`p` is the poem vector and :math:`w` the word vector"""
p = util.softmax(self.noun_vectors.dot(vector) / self.tau)
return npr.choice(self.nouns, p=p)
评论列表
文章目录