PageSourceSearch

https://www.tokenworks.ai/assets/WorkflowStudio-B5ABWY0L.js

js tokenworks.ai collected 2026-10-05 15:55:21 UTC 11,743 bytes, 1 lines download raw bytes

1import{r as e,j as s}from"./react-vendor-3j0hp6R8.js";import{f as n,bY as i,bZ as t}from"./components-Cn-udBT4.js";import{b as a}from"./router-vendor-Dg-IODGf.js";import{bF as l,aC as o}from"./icons-vendor-Ct9oFFFD.js";import"./vendor-CQdPkgkm.js";import"./charts-vendor-DRVidz11.js";import"./guides-general-CJN1k0im.js";const r=[{key:"word-frequency",label:"Word Frequency",description:"Count Unicode tokens."},{key:"ngrams",label:"N-grams",description:"Count sequences from 1 to 8 tokens."},{key:"kwic",label:"KWIC / Concordance",description:"Find literal queries with offsets."},{key:"text-statistics",label:"Text Statistics",description:"Measure characters, tokens, types, and hapax forms."}],c=[{key:"language-identification",label:"Language Identification",description:"Lingua 2.2.0 for English, German, French, Italian, Russian, and Turkish."},{key:"sentence-tokenization",label:"Sentence Segmentation + Tokenization",description:"English sentence and token boundaries from en_core_web_sm 3.8.0."},{key:"lemmatization",label:"Lemmatization",description:"English tokenization and lemmas from en_core_web_sm 3.8.0."},{key:"pos-morphology",label:"POS + Morphology",description:"English UPOS, XPOS, and morphological features."},{key:"named-entity-recognition",label:"Named Entity Recognition",description:"English named entities from the reviewed general-purpose model."},{key:"dependency-parsing",label:"Dependency Parsing",description:"English dependency heads and relations with CoNLL-U export."},{key:"full-linguistic-analysis",label:"Full Linguistic Analysis",description:"English tokens, lemmas, tags, morphology, entities, and dependencies."}],d=new Set(c.map(e=>e.key)),u=new Set(["dependency-parsing","full-linguistic-analysis"]);function h({workflows:e,selected:n,onSelect:i,availability:t}){return s.jsx("div",{className:"studio-choice-grid",children:e.map(e=>{const a=!0===t.get(e.key)?.enabled;return s.jsxs("label",{className:`${a&&n===e.key?"selected":""}${a?"":" unavailable"}`,children:[s.jsx("input",{type:"radio",name:"workflow",value:e.key,checked:a&&n===e.key,disabled:!a,onChange:()=>i(e.key)}),s.jsxs("span",{children:[s.jsx("strong",{children:e.label}),s.jsx("small",{children:e.description}),a?null:s.jsx("small",{className:"studio-availability",children:"Not available to run"})]})]},e.key)})})}function m(){const m=a(),{makeAuthRequest:g,makeAuthenticatedFetch:p}=n(),[x,b]=e.useState("word-frequency"),[j,y]=e.useState(""),[f,w]=e.useState({language:"en",minimumCount:1,n:2,query:"",contextWidth:40,maximumResults:100,caseSensitive:!1,useStopwords:!1,stopwordLanguage:"en",caseLocale:"und"}),[k,v]=e.useState("idle"),[S,C]=e.useState(null),[N,L]=e.useState(""),[q,E]=e.useState({status:"loading",workflows:[],error:""}),T=e.useMemo(()=>new Map(q.workflows.map(e=>[e.key,e])),[q.workflows]),R=!0===T.get(x)?.enabled,O=Array.from(j).length,U=d.has(x),F=U?2e4:1e5,P=O<=F,_=Array.from(f.query).length,z=_<=500,A=P&&("kwic"!==x||z),I=U?Math.max(1,Math.ceil(Math.max(1,O)/1e3))*("language-identification"===x?25:100):1e3,$=e.useCallback(async()=>{E(e=>({...e,status:"loading",error:""}));try{const e=await g("/api/tools/catalog"),s=e.data?.workflows||[];E({status:"ready",workflows:s,error:""}),b(e=>s.some(s=>s.key===e&&s.enabled)?e:s.find(e=>e.enabled)?.key||e)}catch(e){E({status:"error",workflows:[],error:e.message})}},[g]);async function M(e){const s=S?.outputs?.[0];if(s)try{const n=await p(`/api/tools/jobs/${S.id}/outputs/${s.id}/download?format=${e}`),i=await n.blob(),t=URL.createObjectURL(i),a=document.createElement("a");a.href=t,a.download=`tool-result-${S.id}.${e}`,a.click(),URL.revokeObjectURL(t)}catch(n){L(n.message)}}e.useEffect(()=>{$()},[$]);const W=S?.outputs?.[0]?.result,D=W?.results??W?.candidates??W?.tokens;return s.jsxs(i,{title:"Linguistic Workflows",description:"Explore corpus analysis and modern-language workflows, with clear availability before you begin.",children:["loading"===q.status?s.jsx(t,{title:"Checking availability",message:"Loading the current workflow catalogue."}):null,"error"===q.status?s.jsx(t,{title:"Availability unavailable",message:q.error,tone:"error",action:s.jsx("button",{type:"button",className:"studio-button",onClick:$,children:"Try again"})}):null,"ready"!==q.status||q.workflows.some(e=>e.enabled)?null:s.jsxs("div",{className:"studio-disabled-banner",role:"status",children:[s.jsx("strong",{children:"Workflows are open to explore."}),s.jsx("span",{children:"Running is not available for your account yet. A workflow becomes actionable only after its processing configuration and customer release are approved."})]}),s.jsxs("form",{className:"studio-workflow",onSubmit:async function(e){if(e.preventDefault(),!R)return L("This workflow is not available to run yet."),void v("error");
1if(!P)return L(`Source text must contain no more than ${F.toLocaleString()} code points.`),void v("error");if("kwic"===x&&!z)return L("The KWIC query must contain no more than 500 Unicode code points."),void v("error");v("running"),L(""),C(null);try{const e=U?"language-identification"===x?{}:{language:"en"}:f,s=await g("/api/tools/jobs",{method:"POST",headers:{"Idempotency-Key":crypto.randomUUID()},body:JSON.stringify({toolKey:"corpus",workflowKey:x,options:e,input:{kind:"pasted_text",text:j}})});await g(`/api/tools/jobs/${s.data.id}/inspect`,{method:"POST",body:"{}"});const n=await g(`/api/tools/jobs/${s.data.id}/submit`,{method:"POST",body:"{}"});if(["queued","running"].includes(n.data.state))return void m(`/studio/jobs/${s.data.id}`);const i=n.data;if("succeeded"!==i.state)throw new Error(i.error?.message||"The linguistic workflow did not complete.");C(i),v("complete")}catch(s){L(s.message),v("error")}},children:[s.jsxs("fieldset",{children:[s.jsx("legend",{children:"1. Choose a workflow"}),s.jsx("h2",{children:"Deterministic Corpus Tools"}),s.jsx(h,{workflows:r,selected:x,onSelect:b,availability:T}),s.jsx("h2",{children:"Linguistic Workflows"}),s.jsx("p",{children:"Language ID supports English, German, French, Italian, Russian, and Turkish. The linguistic pipeline currently supports English only. Scores are relative confidence, not calibrated probabilities."}),s.jsx(h,{workflows:c,selected:x,onSelect:b,availability:T})]}),s.jsxs("fieldset",{children:[s.jsx("legend",{children:"2. Add text"}),s.jsxs("label",{className:"studio-field",children:[s.jsx("span",{children:"Source text"}),s.jsx("textarea",{value:j,required:!0,rows:10,onChange:e=>y(e.target.value),"aria-describedby":"text-limit","aria-invalid":!P}),s.jsxs("small",{id:"text-limit",children:[O.toLocaleString()," / ",F.toLocaleString()," Unicode code points. Text is normalized to NFC."]})]})]}),s.jsxs("fieldset",{children:[s.jsx("legend",{children:"3. Configure"}),s.jsxs("div",{className:"studio-form-grid",children:[U&&"language-identification"!==x?s.jsxs("label",{className:"studio-field",children:[s.jsx("span",{children:"Language"}),s.jsx("select",{value:"en",disabled:!0,children:s.jsx("option",{value:"en",children:"English"})}),s.jsx("small",{children:"Other linguistic pipeline languages are not enabled."})]}):null,U?null:s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"studio-field",children:[s.jsx("span",{children:"Case locale"}),s.jsxs("select",{value:f.caseLocale,onChange:e=>w({...f,caseLocale:e.target.value}),children:[s.jsx("option",{value:"und",children:"Language-neutral"}),s.jsx("option",{value:"tr",children:"Turkish"}),s.jsx("option",{value:"de",children:"German"}),s.jsx("option",{value:"fr",children:"French"}),s.jsx("option",{value:"it",children:"Italian"})]})]}),s.jsxs("label",{className:"studio-check",children:[s.jsx("input",{type:"checkbox",checked:f.caseSensitive,onChange:e=>w({...f,caseSensitive:e.target.checked})}),"Case-sensitive (otherwise locale-aware lowercase matching)"]}),"word-frequency"===x||"ngrams"===x?s.jsxs("label",{className:"studio-field",children:[s.jsx("span",{children:"Minimum count"}),s.jsx("input",{type:"number",min:"1",max:"1000000",value:f.minimumCount,onChange:e=>w({...f,minimumCount:Number(e.target.value)})})]}):null,"word-frequency"===x?s.jsxs("label",{className:"studio-check",children:[s.jsx("input",{type:"checkbox",checked:f.useStopwords,onChange:e=>w({...f,useStopwords:e.target.checked})}),"Use reviewed stopwords"]}):null,"ngrams"===x?s.jsxs("label",{className:"studio-field",children:[s.jsx("span",{children:"N"}),s.jsx("input",{type:"number",min:"1",max:"8",value:f.n,onChange:e=>w({...f,n:Number(e.target.value)})})]}):null,"text-statistics"!==x?s.jsxs("label",{className:"studio-field",children:[s.jsx("span",{children:"Maximum results"}),s.jsx("input",{type:"number",min:"1",max:"10000",value:f.maximumResults,onChange:e=>w({...f,maximumResults:Number(e.target.value)})})]}):null,"kwic"===x?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"studio-field",children:[s.jsx("span",{children:"Literal query"}),s.jsx("input",{required:!0,value:f.query,onChange:e=>w({...f,query:e.target.value}),"aria-describedby":"kwic-literal-only","aria-invalid":!z}),s.jsxs("small",{id:"kwic-literal-only",children:[_.toLocaleStr
1ing()," / 500 code points. Literal matching only; arbitrary regular expressions are unavailable."]})]}),s.jsxs("label",{className:"studio-field",children:[s.jsx("span",{children:"Context width"}),s.jsx("input",{type:"number",min:"0",max:"1000",value:f.contextWidth,onChange:e=>w({...f,contextWidth:Number(e.target.value)})})]})]}):null]})]}),U?s.jsxs("div",{className:"studio-note",children:[s.jsx("strong",{children:"Processing details"}),s.jsxs("p",{children:["Provider/model:"," ","language-identification"===x?"Lingua 2.2.0":"spaCy en_core_web_sm 3.8.0",". Analysis: ",c.find(e=>e.key===x)?.label,". Input limit: 20,000 characters. Estimated Processing Credits:"," ",(I/1e3).toLocaleString(void 0,{maximumFractionDigits:3}),". Output: JSON and CSV",u.has(x)?", plus CoNLL-U":"","."]})]}):null]}),N?s.jsxs("div",{className:"studio-error",role:"alert",children:[s.jsx("strong",{children:"Workflow could not run"}),s.jsx("span",{children:N})]}):null,s.jsxs("button",{className:"studio-button",type:"submit",disabled:"running"===k||!A||!R,children:[s.jsx(l,{size:17}),"running"===k?"Processing…":R?"Run workflow":"Not available to run"]})]}),W?s.jsxs("section",{className:"studio-result","aria-live":"polite",children:[s.jsxs("div",{className:"studio-panel__heading",children:[s.jsxs("div",{children:[s.jsx("h2",{children:"Result"}),s.jsxs("p",{children:[W.schemaVersion," ·"," ",(W.textLength??W.inputLength?.codePoints??O).toLocaleString()," ","code points"]})]}),s.jsxs("div",{className:"studio-actions",children:[s.jsxs("button",{type:"button",onClick:()=>M("json"),children:[s.jsx(o,{size:15})," JSON"]}),s.jsxs("button",{type:"button",onClick:()=>M("csv"),children:[s.jsx(o,{size:15})," CSV"]}),u.has(x)?s.jsxs("button",{type:"button",onClick:()=>M("conllu"),children:[s.jsx(o,{size:15})," CoNLL-U"]}):null]})]}),W.resultsTruncated?s.jsxs("p",{role:"status",children:["Showing the first ",W.results.length.toLocaleString()," of"," ",W.totalResultTypes.toLocaleString()," result types."]}):null,s.jsx("pre",{tabIndex:"0",children:JSON.stringify(D,null,2)}),s.jsxs("small",{children:["Source SHA-256: ",W.sourceChecksum]})]}):null,s.jsxs("section",{className:"studio-note",children:[s.jsx("h2",{children:"Known limitations"}),s.jsx("p",{children:"Deterministic corpus tokenization remains model-free and is not language-aware word segmentation. Model-backed workflows accept up to 20,000 characters and are available only when their reviewed model and processing capacity are ready. Akkadian is unsupported; transliteration is returned as unknown and is never sent to the English pipeline. OCR and Smart Corrections remain unavailable."})]})]})}export{m as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.