a
    h                     @  s6   d Z ddlmZ ddlZddlmZ G dd dZdS )a@  
This file contains deprecated code that can only be used with the old `model.fit`-style Sentence Transformers v2.X training.
It exists for backwards compatibility with the `model.old_fit` method, but will be removed in a future version.

Nowadays, with Sentence Transformers v3+, it is recommended to use the `SentenceTransformerTrainer` class to train models.
See https://www.sbert.net/docs/sentence_transformer/training_overview.html for more information.

Instead, you should create a `datasets` `Dataset` for training: https://huggingface.co/docs/datasets/create_dataset
    )annotationsN   )InputExamplec                   @  s$   e Zd ZdZd
ddZdddZd	S )LabelSentenceReaderzReads in a file that has at least two columns: a label and a sentence.
    This reader can for example be used with the BatchHardTripletLoss.
    Maps labels automatically to integers
    r   r   	c                 C  s"   || _ i | _|| _|| _|| _d S )N)folder	label_maplabel_col_idxsentence_col_idx	separator)selfr   r	   r
   r    r   m/var/www/html/assistant/venv/lib/python3.9/site-packages/sentence_transformers/readers/LabelSentenceReader.py__init__   s
    zLabelSentenceReader.__init__c                 C  s   g }d}t tj| j|ddD ]}| | j}|| j }|| j	 }|| j
vrbt| j
| j
|< | j
| }	d||f }
|d7 }|t|
|g|	d d|  k r|kr n q  qq |S )Nr   zutf-8)encodingz%s-%dr   )guidZtextslabel)openospathjoinr   stripsplitr   r	   r
   r   lenappendr   )r   filenameZmax_examplesZexamplesidlineZsplitsr   ZsentenceZlabel_idr   r   r   r   get_examples   s    



z LabelSentenceReader.get_examplesN)r   r   r   )r   )__name__
__module____qualname____doc__r   r   r   r   r   r   r      s   
r   )r"   
__future__r   r    r   r   r   r   r   r   <module>   s   
