Beispiel #1
0
    def load_corpus(self):
        ############
        ## CORPUS ##
        ############
        self.p.logsection("CORPUS")
        self.cps = concatenativeclasses.corpus(
            self.ops.CORPUS, self.ops.CORPUS_GLOBAL_ATTRIBUTES,
            self.ops.RESTRICT_CORPUS_SELECT_PERCENTAGE_BY_STRING,
            self.ops.SEARCH_PATHS, self.AnalInterface, self.p)

        htmlCorpusTable = [['', 'minimum', 'maximum', 'average']]
        segmentLength = [
            c.segmentDurationSec for c in self.cps.postLimitSegmentNormList
        ]
        htmlCorpusTable.append([
            'segment length',
            min(segmentLength),
            max(segmentLength),
            np.mean(segmentLength)
        ])
        power = [
            c.desc.get('power-seg') for c in self.cps.postLimitSegmentNormList
        ]
        htmlCorpusTable.append(
            ['power', np.min(power),
             np.max(power),
             np.mean(power)])
        self.p.maketable(htmlCorpusTable, resolution=5)
##############################
if ops.TARGET_PLOT_DESCRIPTORS_FILEPATH != None:
    tgt.plotMetrics(ops.TARGET_PLOT_DESCRIPTORS_FILEPATH, AnalInterface, p)
###############################
## target segmentation graph ##
###############################
if ops.TARGET_SEGMENTATION_GRAPH_FILEPATH != None:
    tgt.plotSegmentation(ops.TARGET_SEGMENTATION_GRAPH_FILEPATH, AnalInterface,
                         p)

############
## CORPUS ##
############
p.logsection("CORPUS")
cps = concatenativeclasses.corpus(
    ops.CORPUS, ops.CORPUS_GLOBAL_ATTRIBUTES,
    ops.RESTRICT_CORPUS_SELECT_PERCENTAGE_BY_STRING, ops.SEARCH_PATHS,
    AnalInterface, p)

###################
## NORMALIZATION ##
###################
p.logsection("NORMALIZATION")

if ops.NORMALIZATION_METHOD == 'standard':
    normalizationTable = [[
        'descriptor', 'norm method', 'target mean', 'target stddev',
        'corpus mean', 'corpus stddev', 'freedom'
    ]]
    for dobj in AnalInterface.normalizeDescriptors:
        if dobj.norm == 1:
            # normalize both together