コード例 #1
0
def loadDetectedTokenListFromMlfTest():
    PATH_TEST_DATASET = '../example/'
       
    audioName = '01_Bakmiyor_3_nakarat'
#     annotationURI = os.path.join(PATH_TEST_DATASET,  audioName + ANNOTATION_EXT)
    detectedHTK_URI = os.path.join(PATH_TEST_DATASET,  audioName +  DETECTED_EXT)
    detectedHTK_URI = '/Users/joro/Documents/Phd/UPF/JingjuSingingAnnotation/lyrics2audio/praat/shiwenhui_tingxiongyan_30.3531146852_61.6663629537.out.mlf'
#     audioURI = os.path.join(PATH_TEST_DATASET,  audioName + AUDIO_EXT)
    whichEvalLevel = tierAliases.words
   
      # load result from file into python list
    detectedTokenList = loadDetectedTokenListFromMlf( detectedHTK_URI, whichEvalLevel )
    print detectedTokenList
コード例 #2
0
    def decodeAudioWithHTK(self):
        dict_ = self.URIrecordingChunkNoExt + '.dict'
        mlf = self.URIrecordingChunkNoExt + '.mlf'
        self.lyricsWithModels.printDict(dict_, 0)
        self.lyricsWithModels.printDict(mlf, 1)

        outputHTKPhoneAlignedURI = alignWithHTK(self.URIrecordingChunkNoExt,
                                                dict_, mlf)
        # TODO: parse output
        pathEvaluation = os.path.join(parentDir, 'AlignmentEvaluation')
        if pathEvaluation not in sys.path:
            sys.path.append(pathEvaluation)
        from WordLevelEvaluator import loadDetectedTokenListFromMlf

        detectedTokenList = loadDetectedTokenListFromMlf(
            outputHTKPhoneAlignedURI, whichLevel=2)
        return detectedTokenList
コード例 #3
0
def mlfResult2TextGrid(argv):
    '''
    open mlf in praat. 
    '''
    if len(argv) != 3 :
            print ("  usage: {}  <detectedHTK_URI> <whichLevel>".format(argv[0]) )
            sys.exit();
    detectedHTK_URI= argv[1]
    whichEvalLevel =  int(argv[2])
    
    tokenAlignedSuffix, dummy = determineSuffixOld(withDuration=False, withSynthesis='dummy', evalLevel=whichEvalLevel)
    
    # load result from file into python list
    detectedTokenList = loadDetectedTokenListFromMlf( detectedHTK_URI, whichEvalLevel )
    
        # write to tsv file.  praat can open only tsv-s
    baseNameAudioFile = os.path.splitext(detectedHTK_URI)[0]
    tokenAlignedfileName =  tokenList2TabFile(detectedTokenList, baseNameAudioFile, tokenAlignedSuffix)
    
    tab2PraatAndOpenWithPRaat(['dummy', tokenAlignedfileName])
コード例 #4
0
def evalAccuracy(URIrecordingAnno, outputHTKPhoneAlignedURI, whichTier=2 ):
    
    detectedTokenList = loadDetectedTokenListFromMlf( outputHTKPhoneAlignedURI, whichTier )
    durationCorrect, totalDuration = _evalAccuracy(URIrecordingAnno, detectedTokenList, whichTier)
    return  durationCorrect, totalDuration