1"use strict";(self.webpackChunktomaarsen_com_frontend=self.webpackChunktomaarsen_com_frontend||[]).push([[256],{1256:function(e,t,s){s.r(t),s.d(t,{default:function(){return N}});var r=s(885),o=s(5671),a=s(3144),n=s(7326),i=s(136),l=s(8505),d=s(2791),c=s(4483),h=s(3174),p=s(3307),u=s(9291),m=s(7345),f=s(4270),g=(s(8762),s(7762)),v=(s(1213),s(429),s(3214)),x=s(184),b=["rgba(38, 70, 83, 0.6)","rgba(42, 157, 143, 0.6)","rgba(233, 196, 106, 0.6)","rgba(244, 162, 97, 0.6)","rgba(231, 111, 81, 0.6)"];v.ce.global.pointHitDetectionRadius=1;var y={animation:{duration:750},layout:{padding:{top:10}},scales:{yAxes:[{ticks:{min:90,max:100}}]},tooltips:{enabled:!1,mode:"index",position:"nearest",custom:function(e){var t=document.getElementById("chartjs-tooltip");if(t||((t=document.createElement("div")).id="chartjs-tooltip",t.innerHTML="<table></table>",this._chart.canvas.parentNode.appendChild(t)),0!==e.opacity){if(t.classList.remove("above","below","no-transform"),e.yAlign?t.classList.add(e.yAlign):t.classList.add("no-transform"),e.body){var s=e.title||[],r=e.body.map((function(e){return e.lines})),o="<thead>";s.forEach((function(e){o+="<tr><th>"+e+"</th><th>Accuracy</th></tr>"})),o+="</thead><tbody>",r.forEach((function(t,s){var r=e.labelColors[s],a="background:"+r.backgroundColor;a+="; border-color:"+r.borderColor;var n='<span class="chartjs-tooltip-key" style="'+(a+="; border-width: 2px")+'"></span>',i=t[0].split(":"),l=i[0],d=parseFloat(i[1]).toFixed(2)+"%";o+="<tr><td>"+n+l+'</td><td style="text-align:right"> '+d+"</td></tr>"})),o+="</tbody>",t.querySelector("table").innerHTML=o}var a=this._chart.canvas.offsetTop,n=this._chart.canvas.offsetLeft,i=e.caretX;i<e.width?i=e.width:e.caretX>this._chart.width-e.width&&(i=this._chart.width-e.width),t.style.opacity=1,t.style.left=n+i+"px",t.style.top=a+e.caretY+"px",t.style.fontFamily=e._bodyFontFamily,t.style.fontSize=e.bodyFontSize+"px",t.style.fontStyle=e._bodyFontStyle,t.style.padding=e.yPadding+"px "+e.xPadding+"px"}else t.style.opacity=0}},plugins:{datalabels:{anchor:"end",align:"top",clamp:!0,formatter:function(e,t){return e.toFixed(2)+"%"}},zoom:{pan:{enabled:!0,mode:"y",rangeMin:{y:0},rangeMax:{y:100}},zoom:{enabled:!0,mode:"y",rangeMin:{y:0},rangeMax:{y:100}}}},maintainAspectRatio:!1,responsive:!0},j={sing:"Singular",plur:"Plural",past:"Past",pres_part:"Present Participle",past_part:"Past Participle",comp:"Comparative",super:"Superlative"},w={n:"Nouns",v:"Verbs",a:"Adjectives"},k=["sing","plur","past","pres_part","past_part","comp","super"],P=function(e){(0,i.Z)(s,e);var t=(0,l.Z)(s);function s(){return(0,o.Z)(this,s),t.apply(this,arguments)}return(0,a.Z)(s,[{key:"componentDidMount",value:function(){function e(e,t){var s=new v.kL.NewLegend({ctx:e.chart.ctx,options:t,chart:e});e.legend&&(v.kL.layouts.removeBox(e,e.legend),delete e.newLegend),e.newLegend=s,v.kL.layouts.addBox(e,s)}v.kL.NewLegend=v.kL.Legend.extend({afterFit:function(){this.height=this.height+20}}),v.kL.plugins.register({beforeInit:function(t){var s=t.options.legend;s&&e(t,s)},beforeUpdate:function(t){var s=t.options.legend;s?(s=v.kL.helpers.configMerge(v.kL.defaults.global.legend,s),t.newLegend?t.newLegend.options=s:e(t,s)):(v.kL.layouts.removeBox(t,t.newLegend),delete t.newLegend)},afterEvent:function(e,t){var s=e.newLegend;s&&s.handleEvent(t)}})}},{key:"render",value:function(){var e,t=[],s=0,o=(0,g.Z)(Object.entries(this.props.performance).sort((function(e,t){return k.indexOf(e[0])-k.indexOf(t[0])})));try{for(o.s();!(e=o.n()).done;){var a=(0,r.Z)(e.value,2),n=a[0],i=a[1];t.push({label:"From ".concat(j[n]),data:i,backgroundColor:b[s],borderWidth:10,categoryPercentage:.95,barPercentage:1}),s++}}catch(d){o.e(d)}finally{o.f()}var l={labels:this.props.labels,datasets:t};return(0,x.jsxs)("div",{className:"chart-container",children:[(0,x.jsxs)("div",{style:{textAlign:"center"},children:["Accuracy of Python Modules when converting ",w[this.props.pos]," to ",j[this.props.wordform]," (",this.props.nTerms," terms tested)"]}),(0,x.jsx)(v.$Q,{data:l,options:y})]})}}]),s}(d.Component),L=P,_=s(49),N=function(e){(0,i.Z)(s,e);var t=(0,l.Z)(s);function s(){var e;return(0,o.Z)(this,s),(e=t.call(this)).state={loading:!1,pos:"n",wordform:"sing",source:"celex_word",labels:[],performance:{},nTerms:0}
1,e.wordforms=[["sing","To Singular"],["plur","To Plural"],["past","To Past"],["past_part","To Past Participle"],["pres_part","To Present Participle"],["comp","To Comparative"],["super","To Superlative"]],e.posToWordforms={v:["sing","plur","past","past_part","pres_part"],n:["sing","plur"],a:["comp","super"]},e.startLoading=e.startLoading.bind((0,n.Z)(e)),e.postPerformance=e.postPerformance.bind((0,n.Z)(e)),e.toggleWordformDisabled=e.toggleWordformDisabled.bind((0,n.Z)(e)),e.handlePos=e.handlePos.bind((0,n.Z)(e)),e.handleWordform=e.handleWordform.bind((0,n.Z)(e)),e.handleSource=e.handleSource.bind((0,n.Z)(e)),e}return(0,a.Z)(s,[{key:"startLoading",value:function(){this.setState({loading:!0})}},{key:"postPerformance",value:function(){var e=this;this.startLoading(),(0,_.u)("/api/performance",{pos:this.state.pos,wordform:this.state.wordform,source:this.state.source}).then((function(t){e.setState({labels:t.labels,performance:t.performance,nTerms:t.n_terms,loading:!1})}))}},{key:"toggleWordformDisabled",value:function(){this.posToWordforms[this.state.pos].includes(this.state.wordform)?this.postPerformance():this.setState({wordform:this.posToWordforms[this.state.pos][0]},this.postPerformance)}},{key:"handlePos",value:function(e){this.state.pos!==e.target.value&&this.setState({pos:e.target.value},this.toggleWordformDisabled)}},{key:"handleWordform",value:function(e){this.state.wordform!==e.target.value&&this.setState({wordform:e.target.value},this.postPerformance)}},{key:"handleSource",value:function(e){this.state.source!==e.target.value&&this.setState({source:e.target.value},this.postPerformance)}},{key:"componentDidMount",value:function(){this.postPerformance()}},{key:"getInfoMessages",value:function(){var e=[];return this.state.source.startsWith("celex")?e.push(["Dutch ",(0,x.jsx)("b",{children:"Ce"}),"ntre for ",(0,x.jsx)("b",{children:"Lex"}),"ical Information (CELEX) data is gathered from ",(0,x.jsx)("a",{href:"http://celex.mpi.nl",children:"WebCelex"}),"."]):this.state.source.startsWith("agid")?e.push([(0,x.jsx)("b",{children:"A"}),"utomatically ",(0,x.jsx)("b",{children:"G"}),"enerated ",(0,x.jsx)("b",{children:"I"}),"nflection ",(0,x.jsx)("b",{children:"D"}),"atabase (AGID) data is gathered from ",(0,x.jsx)("a",{href:"https://raw.githubusercontent.com/en-wl/wordlist/master/agid/infl.txt",children:"here"}),". See Kevin Atkinson's ",(0,x.jsx)("a",{href:"http://wordlist.aspell.net/agid-readme/",children:"readme"})," for more information."]):this.state.source.startsWith("wiktionary")&&e.push(["Wiktionary data is gathered from ",(0,x.jsx)("a",{href:"https://kaikki.org/dictionary/English/inflected.html",children:"here"}),". See ",(0,x.jsx)("a",{href:"https://github.com/tatuylonen/wiktextract",children:"here"})," for more information on wikextract, the tool used to gather this data."]),"n"===this.state.pos&&"sing"===this.state.wordform||"v"===this.state.pos&&"plur"===this.state.wordform?e.push(["NLTK and PyInflect returned no output for some test cases. These are counted as incorrect."]):e.push(["PyInflect returned no output for some test cases. These are counted as incorrect."]),"agid"===this.state.source&&e.push(["The PyInflect module is built using AGID data. As a result, its good performance as shown here is not indicative of good performance in a real scenario. Try the other data sources for a better indication of PyInflect's performance."]),e}},{key:"render",value:function(){var e=this.getInfoMessages(),t=e.map((function(e,t){return(0,x.jsx)("li",{className:"list-group-item",children:e},t)})),s=(0,x.jsxs)(p.Z,{id:"popover-basic",children:[(0,x.jsx)(p.Z.Title,{as:"h3",children:"Notes"}),(0,x.jsx)(p.Z.Content,{children:(0,x.jsx)("ul",{className:"list-group list-group-flush",children:t})})]}),o=this.posToWordforms[this.state.pos];return(0,x.jsxs)("div",{className:"performance-wrapper",style:{overflow:"hidden"},children:[(0,x.jsxs)(f.q,{children:[(0,x.jsx)("script",{src:"https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"}),(0,x.jsx)("script",{src:"https://cdn.jsdelivr.net/npm/[email protected]"}),(0,x.jsx)("script",{src:"https://cdn.jsdelivr.net/npm/[email protected]"}),(0,x.jsx)("script",{src:"https://cdn.jsdelivr.net/npm/[email protected]"})]}),(0,x.jsxs)("div",{className:"box",style:{position:"relative"},children:[(0,x.jsx)("div",{className:"spinner-border",style:{position:"absolute",right:"1.5rem",opacity:this.state.loading?1:0}}),(0,x.jsxs)("form",{id:"inflex_form",className:"row needs-validation",method:"post",noValidate:!0,children:[(0,x.jsxs)("div",{className:"col-auto",children:[(0,x.jsx)("label",{htmlFor:"pos",className:"form-label",children:"Part of Speech"}),(0,x.jsxs)("select",{className:"form-select",name:"pos",id:"pos",value:this.state.pos,onChange:this.handlePos,required:!0,children:[(0,x.jsx)("option",{value:"n",children:"Noun"}),(0,x.jsx)("option",{value:"v",children:"Verb"}),(0,x.jsx)("option",{value:"a",children:"Adjective"})]})]}),(0,x.jsxs)("div",{className:"col-auto",children:[(0,x.jsx)("label",{htmlFor:"wordform",className:"form-label",children:"Wordform"}),(0,x.jsx)("select",{className:"form-select",name:"wordform",id:"wordform",value:this.state.wordform,onChange:this.handleWordform,required:!0,children:this.wordforms.map((function(e){var t=(0,r.Z)(e,2),s=t[0],a=t[1];return(0,x.jsx)("option",{value:s,disabled:!o.includes(s),children:a})}))}),(0,x.jsx)("div",{className:"invalid-feedback",children:"Please select a valid wordform for this Part of Speech."})]}),(0,x.jsxs)("div",{className:"col-auto",children:[(0,x.jsx)("label",{htmlFor:"data_source",className:"form-label",children:"Data Source"}),(0,x.jsxs)("select",{className:"form-select",name:"data_source",id:"data_source",value:this.state.source,onCh
1ange:this.handleSource,required:!0,children:[(0,x.jsx)("option",{value:"celex",children:"CELEX"}),(0,x.jsx)("option",{value:"celex_word",children:"CELEX (Words only)"}),(0,x.jsx)("option",{value:"celex_collocation",children:"CELEX (Collocations only)"}),(0,x.jsx)("option",{value:"agid",children:"AGID"}),(0,x.jsx)("option",{value:"wiktionary",children:"Wiktionary"}),(0,x.jsx)("option",{value:"wiktionary_word",children:"Wiktionary (Words only)"}),(0,x.jsx)("option",{value:"wiktionary_collocation",children:"Wiktionary (Collocations only)"})]})]}),e.length?(0,x.jsxs)("div",{className:"col-auto",children:[(0,x.jsx)("label",{htmlFor:"info",className:"form-label",children:"\xa0"}),(0,x.jsx)(u.Z,{trigger:["focus"],placement:"right",overlay:s,children:(0,x.jsx)(m.Z,{id:"info",className:"d-block",variant:"outline-warning",children:(0,x.jsx)(c.G,{icon:h.YHc})})})]}):null]})]}),(0,x.jsx)("div",{className:"box",style:{overflow:"hidden"},children:(0,x.jsx)(L,{pos:this.state.pos,wordform:this.state.wordform,labels:this.state.labels,performance:this.state.performance,nTerms:this.state.nTerms})})]})}}]),s}(d.Component)}}]); 2//# sourceMappingURL=256.4ffd6422.chunk.js.map
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.