montreal_forced_aligner/transcription/transcriber.py
def score(self) -> None:
        """
        Score the decoded transcriptions

        See Also
        -------
        :class:`~montreal_forced_aligner.transcription.multiprocessing.ScoreFunction`
            Multiprocessing function
        :class:`~montreal_forced_aligner.transcription.multiprocessing.ScoreArguments`
            Arguments for function
        """
        with tqdm.tqdm(total=self.num_utterances) as pbar, open(
            os.path.join(self.evaluation_directory, "score_costs.csv"), "w", encoding="utf8"
        ) as log_file:
            log_file.write("utterance,graph_cost,acoustic_cost,total_cost,num_frames\n")
            if self.use_mp:
                manager = mp.Manager()
                error_dict = manager.dict()
                return_queue = manager.Queue()
                stopped = Stopped()
                procs = []
                for i, args in enumerate(self.score_arguments()):
                    function = ScoreFunction(args)
                    p = KaldiProcessWorker(i, return_queue, function, error_dict, stopped)
                    procs.append(p)
                    p.start()
                while True:
                    try:
                        (
                            utterance,
                            graph_cost,
                            acoustic_cost,
                            total_cost,
                            num_frames,
                        ) = return_queue.get(timeout=1)
                        log_file.write(
                            f"{utterance},{graph_cost},{acoustic_cost},{total_cost},{num_frames}\n"
                        )
                        if stopped.stop_check():
                            continue
                    except Empty:
                        for proc in procs:
                            if not proc.finished.stop_check():
                                break
                        else:
                            break
                        continue
                    pbar.update(1)
                for p in procs:
                    p.join()
                if error_dict:
                    for v in error_dict.values():
                        raise v
            else:
                for args in self.score_arguments():
                    function = ScoreFunction(args)
                    for (
                        utterance,
                        graph_cost,
                        acoustic_cost,
                        total_cost,
                        num_frames,
                    ) in function.run():
                        log_file.write(
                            f"{utterance},{graph_cost},{acoustic_cost},{total_cost},{num_frames}\n"
                        )
                        pbar.update(1)

        Score the decoded transcriptions

        See Also
        -------
        :class:`~montreal_forced_aligner.transcription.multiprocessing.ScoreFunction`
            Multiprocessing function
        :class:`~montreal_forced_aligner.transcription.multiprocessing.ScoreArguments`
            Arguments for function
        
Score the decoded transcriptions
See Also
Score the decoded transcriptions See Also
def score(self) -> None:
        with tqdm.tqdm(total=self.num_utterances) as pbar, open(
            os.path.join(self.evaluation_directory, "score_costs.csv"), "w", encoding="utf8"
        ) as log_file:
            log_file.write("utterance,graph_cost,acoustic_cost,total_cost,num_frames\n")
            if self.use_mp:
                manager = mp.Manager()
                error_dict = manager.dict()
                return_queue = manager.Queue()
                stopped = Stopped()
                procs = []
                for i, args in enumerate(self.score_arguments()):
                    function = ScoreFunction(args)
                    p = KaldiProcessWorker(i, return_queue, function, error_dict, stopped)
                    procs.append(p)
                    p.start()
                while True:
                    try:
                        (
                            utterance,
                            graph_cost,
                            acoustic_cost,
                            total_cost,
                            num_frames,
                        ) = return_queue.get(timeout=1)
                        log_file.write(
                            f"{utterance},{graph_cost},{acoustic_cost},{total_cost},{num_frames}\n"
                        )
                        if stopped.stop_check():
                            continue
                    except Empty:
                        for proc in procs:
                            if not proc.finished.stop_check():
                                break
                        else:
                            break
                        continue
                    pbar.update(1)
                for p in procs:
                    p.join()
                if error_dict:
                    for v in error_dict.values():
                        raise v
            else:
                for args in self.score_arguments():
                    function = ScoreFunction(args)
                    for (
                        utterance,
                        graph_cost,
                        acoustic_cost,
                        total_cost,
                        num_frames,
                    ) in function.run():
                        log_file.write(
                            f"{utterance},{graph_cost},{acoustic_cost},{total_cost},{num_frames}\n"
                        )
                        pbar.update(1)
def score ( self ) -> None : with tqdm . tqdm ( total = self . num_utterances ) as pbar , open ( os . path . join ( self . evaluation_directory , "score_costs.csv" ) , "w" , encoding = "utf8" ) as log_file : log_file . write ( "utterance,graph_cost,acoustic_cost,total_cost,num_frames\n" ) if self . use_mp : manager = mp . Manager ( ) error_dict = manager . dict ( ) return_queue = manager . Queue ( ) stopped = Stopped ( ) procs = [ ] for i , args in enumerate ( self . score_arguments ( ) ) : function = ScoreFunction ( args ) p = KaldiProcessWorker ( i , return_queue , function , error_dict , stopped ) procs . append ( p ) p . start ( ) while True : try : ( utterance , graph_cost , acoustic_cost , total_cost , num_frames , ) = return_queue . get ( timeout = 1 ) log_file . write ( f"{utterance},{graph_cost},{acoustic_cost},{total_cost},{num_frames}\n" ) if stopped . stop_check ( ) : continue except Empty : for proc in procs : if not proc . finished . stop_check ( ) : break else : break continue pbar . update ( 1 ) for p in procs : p . join ( ) if error_dict : for v in error_dict . values ( ) : raise v else : for args in self . score_arguments ( ) : function = ScoreFunction ( args ) for ( utterance , graph_cost , acoustic_cost , total_cost , num_frames , ) in function . run ( ) : log_file . write ( f"{utterance},{graph_cost},{acoustic_cost},{total_cost},{num_frames}\n" ) pbar . update ( 1 )
Score the decoded transcriptions
See Also
Score the decoded transcriptions See Also
"""
        Score the decoded transcriptions

        See Also
        -------
        :class:`~montreal_forced_aligner.transcription.multiprocessing.ScoreFunction`
            Multiprocessing function
        :class:`~montreal_forced_aligner.transcription.multiprocessing.ScoreArguments`
            Arguments for function
        """
self
class
`~montreal_forced_aligner.transcription.multiprocessing.ScoreFunction`
Multiprocessing function
` ~montreal_forced_aligner . transcription . multiprocessing . ScoreFunction ` Multiprocessing function
class
`~montreal_forced_aligner.transcription.multiprocessing.ScoreArguments`
Arguments for function
` ~montreal_forced_aligner . transcription . multiprocessing . ScoreArguments ` Arguments for function