anavec.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:anavec 作者: proycon 项目源码 文件源码
def __init__(self, candidate, index, length, decoder, parent=None):
        self.decoder = decoder #the decoder provides the necessary context, it is in turn tied to the corrector
        self.parent = parent #links to the parent hypothesis that generated this one
        self.candidate = candidate #or None for the initial root hypothesis
        self.index = index #the position of the last added candidate in the original testtokens sequence
        self.length = length #the length of the last added candidate
        #if parent is None:
        #    self.covered = np.zeros(len(self.decoder), dtype=np.byte)
        #else:
        #    self.covered = self.parent.covered.copy()
        #    self.covered[self.index:self.index+self.length+1] = 1
        self.logprob = self.computeprob()
        if self.decoder.corrector.args.debug:
            print("[DEBUG] Generated Hypothesis " + repr(self), file=sys.stderr)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号