获取语料库

        Return:
        corpus               -- 语料库，str类型

def get_corpus(self):
        """获取语料库

        Return:
        corpus               -- 语料库，str类型
        """

        # 正向判定
        corpus = []
        cd = 0
        tag = None
        for i in range(0, self.init_corpus[0][0]):
            init_unit = self.unit_raw[self.init_corpus[0][0] - i]
            cdm = CDM(init_unit)
            alpha = cdm.get_alpha()

            if cd <= self.cd_min and cdm.NC is not 0:
                tag = True
            if cd > self.cd_max or cdm.NC == 0:
                tag = False
            if cd in range(self.cd_min + 1, self.cd_max) and cdm.NC is not 0:
                if alpha > 0:
                    tag = True
                else:
                    tag = False

            if cdm.NC == 0:
                cd += 1
            else:
                cd = 0

            if tag == True:
                corpus.append(init_unit)
            elif tag == False:
                if alpha < 0 or cd > self.cd_max:
                    break
                else:
                    continue
        corpus = list(reversed(corpus))
        try:
            self.index = self.init_corpus[0][0] - i + 1
        except UnboundLocalError:
            log('err', '正向判定完成，索引定位出错')
            self.index = self.init_corpus[0][0]

        # 反向判定
        cd = 0
        tag = None
        for i in range(1, len(self.unit_raw) - self.init_corpus[0][0]):
            init_unit = self.unit_raw[self.init_corpus[0][0] + i]
            cdm = CDM(init_unit)
            alpha = cdm.get_alpha()

            if cd <= self.cd_min and cdm.NC is not 0:
                tag = True
            if cd > self.cd_max or cdm.NC == 0:
                tag = False
            if cd in range(self.cd_min + 1, self.cd_max) and cdm.NC is not 0:
                if alpha > 0:
                    tag = True
                else:
                    tag = False

            if cdm.NC == 0:
                cd += 1
            else:
                cd = 0

            if tag == True:
                corpus.append(init_unit)
            elif tag == False:
                if alpha < 0 or cd > self.cd_max:
                    break
                else:
                    continue
        log('debug', '\n获取语料库成功:【{}】\n'.format(corpus))
        return ''.join(corpus)