1import{a as C,r as p,j as a,B as g}from"./index-ns1xYkE3.js";import{T}from"./ToolTextResult-Cvq523nC.js";import{T as w}from"./service-DtLXrt_H.js";import{T as v}from"./ToolTextInput-DfyWQL6-.js";import{T as D}from"./ToolContent-CAEuGU2l.js";import{T as y}from"./TextFieldWithDesc-C7cjd3t6.js";import{C as d}from"./CheckboxWithDesc-BcbjlaHI.js";import"./ContentPaste-BtIU-5c9.js";import"./ResultFooter-D3pWGvfO.js";import"./index-D0txp6_X.js";import"./TextField-C2-ggeEL.js";import"./InputFooter-DxcfFvIG.js";import"./FormControlLabel-Dq83jjDQ.js";import"./Checkbox-DFMyd1TK.js";import"./SwitchBase-D71fLuiH.js";function b(e,s){return s.emptyLines?e.split(` 2`).length:e.split(` 3`).filter(n=>n.trim()!=="").length}function S(e){return e.length}function q(e,s){const t=s.sentenceDelimiters?s.sentenceDelimiters.split(",").map(i=>i.trim()):[".","!","?","..."],n=new RegExp(`[${t.join("")}]`,"g");return e.split(n).filter(i=>i.trim()!=="").length}function L(e,s){const n=s.wordDelimiters||'\\s.,;:!?"ââ«»()â¦',l=new RegExp(`[${n}]`,"gu"),i=e.split(l).filter(h=>h.trim()!==""),u=w("regex","count","percentage","",i,!1,!0,!1);return s.wordCount?[i.length,u]:[i.length,""]}function j(e){return e.split(/\r?\n\s*\r?\n/).filter(s=>s.trim()!=="").length}function k(e,s){return s.characterCount?w("symbol","count","percentage","",e,!0,!0,!1):""}function F(e,s){if(!e)return"";const t=b(e,s),n=S(e),l=q(e,s),[i,u]=L(e,s),h=j(e),m=k(e,s),o=`Text Statistics 4================== 5Characters: ${n} 6Words: ${i} 7Lines: ${t} 8Sentences: ${l} 9Paragraphs: ${h}`,c=`Characters Frequency 10================== 11${m}`,r=`Words Frequency 12================== 13${u}`;let f=o;return s.wordCount&&(f+=` 14 15${r}`),s.characterCount&&(f+=` 16 17${c}`),f}const x={emptyLines:!1,sentenceDelimiters:"",wordDelimiters:"",characterCount:!1,wordCount:!1},$=[{title:"Text Statistics without any Flag",description:"This example shows basic text statistics without any additional flags.",sampleText:"Giraffes have long necks that can be up to 6 feet (1.8 meters) long, but they only have 7 neck vertebrae, the same as humans.",sampleResult:`Text Statistics 18================== 19Characters: 125 20Words: 26 21Lines: 1 22Sentences: 1 23Paragraphs: 1`,sampleOptions:x},{title:"Text Statistics with Characters Frequency",description:"This example shows basic text statistics with characters frequency.",sampleText:"The Great Barrier Reef is the world's largest coral reef system, located off the coast of Australia. It consists of over 2,900 individual reefs and 900 islands. The reef is home to thousands of species of marine life, including fish, sea turtles, sharks, and dolphins. It is also a popular tourist destination, attracting millions of visitors every year. However, the reef is facing many threats, including climate change, pollution, and overfishing. Conservation efforts are being made to protect this unique and valuable ecosystem for future generations.",sampleResult:`Text Statistics 24================== 25Characters: 556 26Words: 87 27Lines: 1 28Sentences: 1 29Paragraphs: 1 30 31Characters Frequency 32================== 330: 4 (0.72%) 342: 1 (0.18%) 359: 2 (0.36%) 36â£: 85 (15.29%) 37e: 51 (9.17%) 38i: 40 (7.19%) 39s: 40 (7.19%) 40t: 39 (7.01%) 41a: 37 (6.65%) 42o: 34 (6.12%) 43r: 33 (5.94%) 44n: 29 (5.22%) 45l: 21 (3.78%) 46f: 20 (3.60%) 47h: 15 (2.70%) 48d: 15 (2.70%) 49c: 14 (2.52%) 50u: 14 (2.52%) 51,: 11 (1.98%) 52g: 10 (1.80%) 53m: 8 (1.44%) 54v: 8 (1.44%) 55.: 6 (1.08%) 56p: 6 (1.08%) 57y: 5 (0.90%) 58b: 3 (0.54%) 59w: 2 (0.36%) 60': 1 (0.18%) 61k: 1 (0.18%) 62q: 1 (0.18%)`,sampleOptions:{emptyLines:!1,sentenceDelimiters:"",wordDelimiters:"",characterCount:!0,wordCount:!1}},{title:"Text Statistics with Characters and Words Frequencies",description:"This example shows basic text statistics with characters and words frequencies.",sampleText:"The Great Barrier Reef is the world's largest coral reef system, located off the coast of Australia. It consists of over 2,900 individual reefs and 900 islands. The reef is home to thousands of species of marine life, including fish, sea turtles, sharks, and dolphins. It is also a popular tourist destination, attracting millions of visitors every year. However, the reef is facing many threats, including climate change, pollution, and overfishing. Conservation efforts are being made to protect this unique and valuable ecosystem for future generations.",sampleResult:`Text Statistics 63================== 64Characters: 556 65Words: 87 66Lines: 1 67Sentences: 1 68Paragraphs: 1 69 70Words Frequency 71================== 722: 1 (1.15%) 73900: 2 (2.30%) 74the: 5 (5.75%) 75of: 5 (5.75%) 76reef: 4 (4.60%) 77is: 4 (4.60%) 78and: 4 (4.60%)
79it: 2 (2.30%) 80to: 2 (2.30%) 81including: 2 (2.30%) 82great: 1 (1.15%) 83barrier: 1 (1.15%) 84world's: 1 (1.15%) 85largest: 1 (1.15%) 86coral: 1 (1.15%) 87system: 1 (1.15%) 88located: 1 (1.15%) 89off: 1 (1.15%) 90coast: 1 (1.15%) 91australia: 1 (1.15%) 92consists: 1 (1.15%) 93over: 1 (1.15%) 94individual: 1 (1.15%) 95reefs: 1 (1.15%) 96islands: 1 (1.15%) 97home: 1 (1.15%) 98thousands: 1 (1.15%) 99species: 1 (1.15%) 100marine: 1 (1.15%) 101life: 1 (1.15%) 102fish: 1 (1.15%) 103sea: 1 (1.15%) 104turtles: 1 (1.15%) 105sharks: 1 (1.15%) 106dolphins: 1 (1.15%) 107also: 1 (1.15%) 108a: 1 (1.15%) 109popular: 1 (1.15%) 110tourist: 1 (1.15%) 111destination: 1 (1.15%) 112attracting: 1 (1.15%) 113millions: 1 (1.15%) 114visitors: 1 (1.15%) 115every: 1 (1.15%) 116year: 1 (1.15%) 117however: 1 (1.15%) 118facing: 1 (1.15%) 119many: 1 (1.15%) 120threats: 1 (1.15%) 121climate: 1 (1.15%) 122change: 1 (1.15%) 123pollution: 1 (1.15%) 124overfishing: 1 (1.15%) 125conservation: 1 (1.15%) 126efforts: 1 (1.15%) 127are: 1 (1.15%) 128being: 1 (1.15%) 129made: 1 (1.15%) 130protect: 1 (1.15%) 131this: 1 (1.15%) 132unique: 1 (1.15%) 133valuable: 1 (1.15%) 134ecosystem: 1 (1.15%) 135for: 1 (1.15%) 136future: 1 (1.15%) 137generations: 1 (1.15%) 138 139Characters Frequency 140================== 1410: 4 (0.72%) 1422: 1 (0.18%) 1439: 2 (0.36%) 144â£: 85 (15.29%) 145e: 51 (9.17%) 146i: 40 (7.19%) 147s: 40 (7.19%) 148t: 39 (7.01%) 149a: 37 (6.65%) 150o: 34 (6.12%) 151r: 33 (5.94%) 152n: 29 (5.22%) 153l: 21 (3.78%) 154f: 20 (3.60%) 155h: 15 (2.70%) 156d: 15 (2.70%) 157c: 14 (2.52%) 158u: 14 (2.52%) 159,: 11 (1.98%) 160g: 10 (1.80%) 161m: 8 (1.44%) 162v: 8 (1.44%) 163.: 6 (1.08%) 164p: 6 (1.08%) 165y: 5 (0.90%) 166b: 3 (0.54%) 167w: 2 (0.36%) 168': 1 (0.18%) 169k: 1 (0.18%) 170q: 1 (0.18%)`,sampleOptions:{emptyLines:!1,sentenceDelimiters:"",wordDelimiters:"",characterCount:!0,wordCount:!0}}];function N({title:e,longDescription:s}){const{t}=C("string"),[n,l]=p.useState(""),[i,u]=p.useState("");function h(o,c){u(F(c,o))}const m=({values:o,updateField:c})=>[{title:t("statistic.delimitersOptions"),component:a.jsxs(g,{children:[a.jsx(y,{value:o.sentenceDelimiters,onOwnChange:r=>c("sentenceDelimiters",r),placeholder:t("statistic.sentenceDelimitersPlaceholder"),description:t("statistic.sentenceDelimitersDescription")}),a.jsx(y,{value:o.wordDelimiters,onOwnChange:r=>c("wordDelimiters",r),placeholder:t("statistic.wordDelimitersPlaceholder"),description:t("statistic.wordDelimitersDescription")})]})},{title:t("statistic.statisticsOptions"),component:a.jsxs(g,{children:[a.jsx(d,{checked:o.wordCount,onChange:r=>c("wordCount",r),title:t("statistic.wordFrequencyAnalysis"),description:t("statistic.wordFrequencyAnalysisDescription")}),a.jsx(d,{checked:o.characterCount,onChange:r=>c("characterCount",r),title:t("statistic.characterFrequencyAnalysis"),description:t("statistic.characterFrequencyAnalysisDescription")}),a.jsx(d,{checked:o.emptyLines,onChange:r=>c("emptyLines",r),title:t("statistic.includeEmptyLines"),description:t("statistic.includeEmptyLinesDescription")})]})}];return a.jsx(D,{title:e,initialValues:x,getGroups:m,compute:h,input:n,setInput:l,inputComponent:a.jsx(v,{title:t("statistic.inputTitle"),value:n,onChange:l}),resultComponent:a.jsx(T,{title:t("statistic.resultTitle"),value:i}),toolInfo:{title:t("statistic.toolInfo.title",{title:e}),description:s},exampleCards:$})}export{N 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.