o
    SiE	                     @   s   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 e
 dd Ze e jd	e jd
dde jde jd
dde jde jd
dddde jdeddde jdddde jddd
dddd	e	de	de	ded ed!efd"d#ZdS )$    N)tqdm)cli)load_manifest_lazy_or_eager)SupervisionSet)Pathlikec                   C   s   dS )z7Commands related to manipulating supervision manifests.N r   r   r   P/home/ubuntu/.local/lib/python3.10/site-packages/lhotse/bin/modes/supervision.pysupervision
   s   r	   in_supervision_manifestT)
allow_dash)typeout_supervision_manifestz
--ctm-fileF)existsdir_okayz&CTM file containing alignments to add.)r   helpz--alignment-typewordz,Type of alignment to add (default = `word`).)r   defaultr   z"--match-channel/--no-match-channelzNWhether to match channel between CTM and SupervisionSegment (default = False).)r   r   z	--verbosez-vz Whether to print verbose output.)is_flagr   r   ctm_filealignment_typematch_channelverbosec           	      C   sx   t | t}|j||||d}tj|dd}|rt|ddn|}|D ]}|| q"W d   dS 1 s5w   Y  dS )a"  
    Add alignments from CTM file to the supervision set.

    :param in_supervision_manifest: Path to input supervision manifest.
    :param out_supervision_manifest: Path to output supervision manifest.
    :param ctm_file: Path to CTM file.
    :param alignment_type: Alignment type (optional, default = `word`).
    :param match_channel: if True, also match channel between CTM and SupervisionSegment
    :param verbose: Whether to print verbose output.
    :return: A new SupervisionSet with AlignmentItem objects added to the segments.
    )r   r   r   r   T)	overwritezWriting supervisions)descN)r   r   with_alignment_from_ctmopen_writerr   write)	r
   r   r   r   r   r   supervisionswritersr   r   r   r      s   
-"r   )clickr   lhotse.bin.modes.cli_baser   lhotse.serializationr   lhotse.supervisionr   lhotse.utilsr   groupr	   commandargumentPathoptionstrboolr   r   r   r   r   <module>   s^    
