montreal_forced_aligner/transcription/transcriber.py
def score_transcriptions(self):
        """
        Score transcriptions if reference text is available in the corpus

        See Also
        --------
        :func:`~montreal_forced_aligner.transcription.multiprocessing.ScoreFunction`
            Multiprocessing helper function for each job
        :meth:`.Transcriber.score_arguments`
            Job method for generating arguments for this function

        """
        if self.evaluation_mode:
            best_wer = 10000
            best = None
            evaluations = list(
                itertools.product(
                    range(self.min_language_model_weight, self.max_language_model_weight),
                    self.word_insertion_penalties,
                )
            )
            with tqdm.tqdm(total=len(evaluations)) as pbar:
                for lmwt, wip in evaluations:
                    pbar.update(1)
                    self.language_model_weight = lmwt
                    self.word_insertion_penalty = wip
                    os.makedirs(self.evaluation_log_directory, exist_ok=True)

                    self.log_debug(
                        f"Evaluating with language model weight={lmwt} and word insertion penalty={wip}..."
                    )
                    self.score()

                    ser, wer = self.evaluate()
                    if wer < best_wer:
                        best = (lmwt, wip)
                        best_wer = wer
            self.language_model_weight = best[0]
            self.word_insertion_penalty = best[1]
            self.log_info(
                f"Best language model weight={best[0]}, best word insertion penalty={best[1]}, WER={best_wer:.2f}%"
            )
            for score_args in self.score_arguments():
                for p in score_args.tra_paths.values():
                    shutil.copyfile(
                        p,
                        p.replace(self.evaluation_directory, self.working_directory),
                    )
        else:
            self.score()

        Score transcriptions if reference text is available in the corpus

        See Also
        --------
        :func:`~montreal_forced_aligner.transcription.multiprocessing.ScoreFunction`
            Multiprocessing helper function for each job
        :meth:`.Transcriber.score_arguments`
            Job method for generating arguments for this function

        
Score transcriptions if reference text is available in the corpus
See Also
Score transcriptions if reference text is available in the corpus See Also
def score_transcriptions(self):
        if self.evaluation_mode:
            best_wer = 10000
            best = None
            evaluations = list(
                itertools.product(
                    range(self.min_language_model_weight, self.max_language_model_weight),
                    self.word_insertion_penalties,
                )
            )
            with tqdm.tqdm(total=len(evaluations)) as pbar:
                for lmwt, wip in evaluations:
                    pbar.update(1)
                    self.language_model_weight = lmwt
                    self.word_insertion_penalty = wip
                    os.makedirs(self.evaluation_log_directory, exist_ok=True)
                    self.log_debug(
                        f"Evaluating with language model weight={lmwt} and word insertion penalty={wip}..."
                    )
                    self.score()
                    ser, wer = self.evaluate()
                    if wer < best_wer:
                        best = (lmwt, wip)
                        best_wer = wer
            self.language_model_weight = best[0]
            self.word_insertion_penalty = best[1]
            self.log_info(
                f"Best language model weight={best[0]}, best word insertion penalty={best[1]}, WER={best_wer:.2f}%"
            )
            for score_args in self.score_arguments():
                for p in score_args.tra_paths.values():
                    shutil.copyfile(
                        p,
                        p.replace(self.evaluation_directory, self.working_directory),
                    )
        else:
            self.score()
def score_transcriptions ( self ) : if self . evaluation_mode : best_wer = 10000 best = None evaluations = list ( itertools . product ( range ( self . min_language_model_weight , self . max_language_model_weight ) , self . word_insertion_penalties , ) ) with tqdm . tqdm ( total = len ( evaluations ) ) as pbar : for lmwt , wip in evaluations : pbar . update ( 1 ) self . language_model_weight = lmwt self . word_insertion_penalty = wip os . makedirs ( self . evaluation_log_directory , exist_ok = True ) self . log_debug ( f"Evaluating with language model weight={lmwt} and word insertion penalty={wip}..." ) self . score ( ) ser , wer = self . evaluate ( ) if wer < best_wer : best = ( lmwt , wip ) best_wer = wer self . language_model_weight = best [ 0 ] self . word_insertion_penalty = best [ 1 ] self . log_info ( f"Best language model weight={best[0]}, best word insertion penalty={best[1]}, WER={best_wer:.2f}%" ) for score_args in self . score_arguments ( ) : for p in score_args . tra_paths . values ( ) : shutil . copyfile ( p , p . replace ( self . evaluation_directory , self . working_directory ) , ) else : self . score ( )
Score transcriptions if reference text is available in the corpus
See Also
Score transcriptions if reference text is available in the corpus See Also
"""
        Score transcriptions if reference text is available in the corpus

        See Also
        --------
        :func:`~montreal_forced_aligner.transcription.multiprocessing.ScoreFunction`
            Multiprocessing helper function for each job
        :meth:`.Transcriber.score_arguments`
            Job method for generating arguments for this function

        """
self
func
`~montreal_forced_aligner.transcription.multiprocessing.ScoreFunction`
Multiprocessing helper function for each job
` ~montreal_forced_aligner . transcription . multiprocessing . ScoreFunction ` Multiprocessing helper function for each job
meth
`.Transcriber.score_arguments`
Job method for generating arguments for this function
` . Transcriber . score_arguments ` Job method for generating arguments for this function