
    Ch                    <    S r SSKJr  SSKrSSKJr   " S S5      rg)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                  ,    \ rS rSrSrSS jrSS jrSrg)	LabelSentenceReader   zReads 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
c                B    Xl         0 U l        X l        X0l        X@l        g )N)folder	label_maplabel_col_idxsentence_col_idx	separator)selfr
   r   r   r   s        i/var/www/html/shao/venv/lib/python3.13/site-packages/sentence_transformers/readers/LabelSentenceReader.py__init__LabelSentenceReader.__init__   s    * 0"    c           	        / nSn[        [        R                  R                  U R                  U5      SS9 H  nUR                  5       R                  U R                  5      nX`R                     nX`R                     nXpR                  ;  a"  [        U R                  5      U R                  U'   U R                  U   n	SX4-  n
US-  nUR                  [        X/U	S95        SUs=:  a  U::  d  M  O  M    U$    U$ )Nr   zutf-8)encodingz%s-%dr   )guidtextslabel)openospathjoinr
   stripsplitr   r   r   r   lenappendr   )r   filenamemax_examplesexamplesidlinesplitsr   sentencelabel_idr   s              r   get_examples LabelSentenceReader.get_examples   s    dkk8<wODZZ\''7F--.E334HNN*(+DNN(;u%~~e,Hh^+D!GBOOLd*HUV<%2%%! P  r   )r
   r   r   r   r   N)r   r   	)r   )__name__
__module____qualname____firstlineno____doc__r   r)   __static_attributes__ r   r   r   r      s    
#r   r   )r0   
__future__r   r    r   r   r2   r   r   <module>r5      s    # 	 ! !r   