import{s as Y,n as Z,o as ee}from"../chunks/scheduler.c3dfb84c.js";import{S as te,i as ae,e as d,s,c as T,h as ne,a as m,d as a,b as o,f as A,g as w,j as V,k as N,l as c,m as l,n as C,t as L,o as q,p as E}from"../chunks/index.47c20be5.js";import{C as se,H as oe,E as le}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.423d8c15.js";import{D as X}from"../chunks/Docstring.164b8e5f.js";function ie(R){let i,P,y,M,u,z,f,H,n,h,U,b,B="Create templated examples for a reference dataset or reference labels.",W,x,J=`If <code>candidate_labels</code> is supplied, use it for generating the templates.
Otherwise, use the labels loaded from <code>reference_dataset</code>.`,j,$,K=`If input Dataset is supplied, add the examples to it, otherwise create a new Dataset.
The input Dataset is assumed to have a text column with the name <code>text_column</code> and a
label column with the name <code>label_column</code>, which contains one-hot or multi-hot
encoded label sequences.`,F,r,_,G,v,Q="Samples a Dataset to create an equal number of samples per class (when possible).",I,g,O,D,S;return u=new se({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),f=new oe({props:{title:"Utility Functions",local:"setfit.get_templated_dataset",headingTag:"h1"}}),h=new X({props:{name:"setfit.get_templated_dataset",anchor:"setfit.get_templated_dataset",parameters:[{name:"dataset",val:": typing.Optional[datasets.arrow_dataset.Dataset] = None"},{name:"candidate_labels",val:": typing.Optional[typing.List[str]] = None"},{name:"reference_dataset",val:": typing.Optional[str] = None"},{name:"template",val:": str = 'This sentence is {}'"},{name:"sample_size",val:": int = 2"},{name:"text_column",val:": str = 'text'"},{name:"label_column",val:": str = 'label'"},{name:"multi_label",val:": bool = False"},{name:"label_names_column",val:": str = 'label_text'"}],parametersDescription:[{anchor:"setfit.get_templated_dataset.dataset",description:"<strong>dataset</strong> (<code>Dataset</code>, <em>optional</em>) &#x2014; A Dataset to add templated examples to.",name:"dataset"},{anchor:"setfit.get_templated_dataset.candidate_labels",description:`<strong>candidate_labels</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014; The list of candidate
labels to be fed into the template to construct examples.`,name:"candidate_labels"},{anchor:"setfit.get_templated_dataset.reference_dataset",description:`<strong>reference_dataset</strong> (<code>str</code>, <em>optional</em>) &#x2014; A dataset to take labels
from, if <code>candidate_labels</code> is not supplied.`,name:"reference_dataset"},{anchor:"setfit.get_templated_dataset.template",description:`<strong>template</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;This sentence is {}&quot;</code>) &#x2014; The template
used to turn each label into a synthetic training example. This template
must include a {} for the candidate label to be inserted into the template.
For example, the default template is &#x201C;This sentence is {}.&#x201D; With the
candidate label &#x201C;sports&#x201D;, this would produce an example
&#x201C;This sentence is sports&#x201D;.`,name:"template"},{anchor:"setfit.get_templated_dataset.sample_size",description:`<strong>sample_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014; The number of examples to make for
each candidate label.`,name:"sample_size"},{anchor:"setfit.get_templated_dataset.text_column",description:`<strong>text_column</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;text&quot;</code>) &#x2014; The name of the column
containing the text of the examples.`,name:"text_column"},{anchor:"setfit.get_templated_dataset.label_column",description:`<strong>label_column</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;label&quot;</code>) &#x2014; The name of the column
in <code>dataset</code> containing the labels of the examples.`,name:"label_column"},{anchor:"setfit.get_templated_dataset.multi_label",description:`<strong>multi_label</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014; Whether or not multiple
candidate labels can be true.`,name:"multi_label"},{anchor:"setfit.get_templated_dataset.label_names_column",description:`<strong>label_names_column</strong> (<code>str</code>, <em>optional</em>, defaults to &#x201C;label_text&#x201D;) &#x2014; The name of the
label column in the <code>reference_dataset</code>, to be used in case there is no ClassLabel
feature for the label column.`,name:"label_names_column"}],source:"https://github.com/huggingface/setfit/blob/main/src/setfit/data.py#L23",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A copy of the input Dataset with templated examples added.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>Dataset</code></p>
`,raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><code>ValueError</code> — If the input Dataset is not empty and one or both of the
provided column names are missing.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code></p>
`}}),_=new X({props:{name:"setfit.sample_dataset",anchor:"setfit.sample_dataset",parameters:[{name:"dataset",val:": Dataset"},{name:"label_column",val:": str = 'label'"},{name:"num_samples",val:": int = 8"},{name:"seed",val:": int = 42"}],source:"https://github.com/huggingface/setfit/blob/main/src/setfit/data.py#L146"}}),g=new le({props:{source:"https://github.com/huggingface/setfit/blob/main/docs/source/en/reference/utility.mdx"}}),{c(){i=d("meta"),P=s(),y=d("p"),M=s(),T(u.$$.fragment),z=s(),T(f.$$.fragment),H=s(),n=d("div"),T(h.$$.fragment),U=s(),b=d("p"),b.textContent=B,W=s(),x=d("p"),x.innerHTML=J,j=s(),$=d("p"),$.innerHTML=K,F=s(),r=d("div"),T(_.$$.fragment),G=s(),v=d("p"),v.textContent=Q,I=s(),T(g.$$.fragment),O=s(),D=d("p"),this.h()},l(e){const t=ne("svelte-u9bgzb",document.head);i=m(t,"META",{name:!0,content:!0}),t.forEach(a),P=o(e),y=m(e,"P",{}),A(y).forEach(a),M=o(e),w(u.$$.fragment,e),z=o(e),w(f.$$.fragment,e),H=o(e),n=m(e,"DIV",{class:!0});var p=A(n);w(h.$$.fragment,p),U=o(p),b=m(p,"P",{"data-svelte-h":!0}),V(b)!=="svelte-1cgnucd"&&(b.textContent=B),W=o(p),x=m(p,"P",{"data-svelte-h":!0}),V(x)!=="svelte-1qfxemt"&&(x.innerHTML=J),j=o(p),$=m(p,"P",{"data-svelte-h":!0}),V($)!=="svelte-vganoc"&&($.innerHTML=K),p.forEach(a),F=o(e),r=m(e,"DIV",{class:!0});var k=A(r);w(_.$$.fragment,k),G=o(k),v=m(k,"P",{"data-svelte-h":!0}),V(v)!=="svelte-mhbctk"&&(v.textContent=Q),k.forEach(a),I=o(e),w(g.$$.fragment,e),O=o(e),D=m(e,"P",{}),A(D).forEach(a),this.h()},h(){N(i,"name","hf:doc:metadata"),N(i,"content",re),N(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(r,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){c(document.head,i),l(e,P,t),l(e,y,t),l(e,M,t),C(u,e,t),l(e,z,t),C(f,e,t),l(e,H,t),l(e,n,t),C(h,n,null),c(n,U),c(n,b),c(n,W),c(n,x),c(n,j),c(n,$),l(e,F,t),l(e,r,t),C(_,r,null),c(r,G),c(r,v),l(e,I,t),C(g,e,t),l(e,O,t),l(e,D,t),S=!0},p:Z,i(e){S||(L(u.$$.fragment,e),L(f.$$.fragment,e),L(h.$$.fragment,e),L(_.$$.fragment,e),L(g.$$.fragment,e),S=!0)},o(e){q(u.$$.fragment,e),q(f.$$.fragment,e),q(h.$$.fragment,e),q(_.$$.fragment,e),q(g.$$.fragment,e),S=!1},d(e){e&&(a(P),a(y),a(M),a(z),a(H),a(n),a(F),a(r),a(I),a(O),a(D)),a(i),E(u,e),E(f,e),E(h),E(_),E(g,e)}}}const re='{"title":"Utility Functions","local":"setfit.get_templated_dataset","sections":[],"depth":1}';function de(R){return ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fe extends te{constructor(i){super(),ae(this,i,de,ie,Y,{})}}export{fe as component};
