import{S as ct,i as mt,s as ft,e as n,k as c,w as re,t as l,M as ut,c as o,d as t,m,a as s,x as le,h,b as u,G as a,g as r,y as he,L as gt,q as ce,o as me,B as fe,v as pt}from"../../chunks/vendor-hf-doc-builder.js";import{I as Be}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as dt}from"../../chunks/CourseFloatingBanner-hf-doc-builder.js";function wt(He){let p,D,d,y,O,b,ue,R,ge,K,$,Q,P,pe,V,w,x,W,E,de,z,we,X,N,ve,Y,L,ye,Z,f,T,F,xe,_e,be,I,M,$e,Ee,ke,S,j,Pe,Ne,Le,G,B,Te,Ie,Se,A,H,Ge,Ae,ee,C,Ce,te,v,_,U,k,qe,J,Oe,ae,q,Re,ne;return b=new Be({}),$=new dt({props:{chapter:1,classNames:"absolute z-10 right-0 top-0"}}),E=new Be({}),k=new Be({}),{c(){p=n("meta"),D=c(),d=n("h1"),y=n("a"),O=n("span"),re(b.$$.fragment),ue=c(),R=n("span"),ge=l("Natural Language Processing"),K=c(),re($.$$.fragment),Q=c(),P=n("p"),pe=l("Before jumping into Transformer models, let\u2019s do a quick overview of what natural language processing is and why we care about it."),V=c(),w=n("h2"),x=n("a"),W=n("span"),re(E.$$.fragment),de=c(),z=n("span"),we=l("What is NLP?"),X=c(),N=n("p"),ve=l("NLP is a field of linguistics and machine learning focused on understanding everything related to human language. The aim of NLP tasks is not only to understand single words individually, but to be able to understand the context of those words."),Y=c(),L=n("p"),ye=l("The following is a list of common NLP tasks, with some examples of each:"),Z=c(),f=n("ul"),T=n("li"),F=n("strong"),xe=l("Classifying whole sentences"),_e=l(": Getting the sentiment of a review, detecting if an email is spam, determining if a sentence is grammatically correct or whether two sentences are logically related or not"),be=c(),I=n("li"),M=n("strong"),$e=l("Classifying each word in a sentence"),Ee=l(": Identifying the grammatical components of a sentence (noun, verb, adjective), or the named entities (person, location, organization)"),ke=c(),S=n("li"),j=n("strong"),Pe=l("Generating text content"),Ne=l(": Completing a prompt with auto-generated text, filling in the blanks in a text with masked words"),Le=c(),G=n("li"),B=n("strong"),Te=l("Extracting an answer from a text"),Ie=l(": Given a question and a context, extracting the answer to the question based on the information provided in the context"),Se=c(),A=n("li"),H=n("strong"),Ge=l("Generating a new sentence from an input text"),Ae=l(": Translating a text into another language, summarizing a text"),ee=c(),C=n("p"),Ce=l("NLP isn\u2019t limited to written text though. It also tackles complex challenges in speech recognition and computer vision, such as generating a transcript of an audio sample or a description of an image."),te=c(),v=n("h2"),_=n("a"),U=n("span"),re(k.$$.fragment),qe=c(),J=n("span"),Oe=l("Why is it challenging?"),ae=c(),q=n("p"),Re=l("Computers don\u2019t process information in the same way as humans. For example, when we read the sentence \u201CI am hungry,\u201D we can easily understand its meaning. Similarly, given two sentences such as \u201CI am hungry\u201D and \u201CI am sad,\u201D we\u2019re able to easily determine how similar they are. For machine learning (ML) models, such tasks are more difficult. The text needs to be processed in a way that enables the model to learn from it. And because language is complex, we need to think carefully about how this processing must be done. There has been a lot of research done on how to represent text, and we will look at some methods in the next chapter."),this.h()},l(e){const i=ut('[data-svelte="svelte-1phssyn"]',document.head);p=o(i,"META",{name:!0,content:!0}),i.forEach(t),D=m(e),d=o(e,"H1",{class:!0});var oe=s(d);y=o(oe,"A",{id:!0,class:!0,href:!0});var Ue=s(y);O=o(Ue,"SPAN",{});var Je=s(O);le(b.$$.fragment,Je),Je.forEach(t),Ue.forEach(t),ue=m(oe),R=o(oe,"SPAN",{});var De=s(R);ge=h(De,"Natural Language Processing"),De.forEach(t),oe.forEach(t),K=m(e),le($.$$.fragment,e),Q=m(e),P=o(e,"P",{});var Ke=s(P);pe=h(Ke,"Before jumping into Transformer models, let\u2019s do a quick overview of what natural language processing is and why we care about it."),Ke.forEach(t),V=m(e),w=o(e,"H2",{class:!0});var se=s(w);x=o(se,"A",{id:!0,class:!0,href:!0});var Qe=s(x);W=o(Qe,"SPAN",{});var Ve=s(W);le(E.$$.fragment,Ve),Ve.forEach(t),Qe.forEach(t),de=m(se),z=o(se,"SPAN",{});var Xe=s(z);we=h(Xe,"What is NLP?"),Xe.forEach(t),se.forEach(t),X=m(e),N=o(e,"P",{});var Ye=s(N);ve=h(Ye,"NLP is a field of linguistics and machine learning focused on understanding everything related to human language. The aim of NLP tasks is not only to understand single words individually, but to be able to understand the context of those words."),Ye.forEach(t),Y=m(e),L=o(e,"P",{});var Ze=s(L);ye=h(Ze,"The following is a list of common NLP tasks, with some examples of each:"),Ze.forEach(t),Z=m(e),f=o(e,"UL",{});var g=s(f);T=o(g,"LI",{});var We=s(T);F=o(We,"STRONG",{});var et=s(F);xe=h(et,"Classifying whole sentences"),et.forEach(t),_e=h(We,": Getting the sentiment of a review, detecting if an email is spam, determining if a sentence is grammatically correct or whether two sentences are logically related or not"),We.forEach(t),be=m(g),I=o(g,"LI",{});var ze=s(I);M=o(ze,"STRONG",{});var tt=s(M);$e=h(tt,"Classifying each word in a sentence"),tt.forEach(t),Ee=h(ze,": Identifying the grammatical components of a sentence (noun, verb, adjective), or the named entities (person, location, organization)"),ze.forEach(t),ke=m(g),S=o(g,"LI",{});var Fe=s(S);j=o(Fe,"STRONG",{});var at=s(j);Pe=h(at,"Generating text content"),at.forEach(t),Ne=h(Fe,": Completing a prompt with auto-generated text, filling in the blanks in a text with masked words"),Fe.forEach(t),Le=m(g),G=o(g,"LI",{});var Me=s(G);B=o(Me,"STRONG",{});var nt=s(B);Te=h(nt,"Extracting an answer from a text"),nt.forEach(t),Ie=h(Me,": Given a question and a context, extracting the answer to the question based on the information provided in the context"),Me.forEach(t),Se=m(g),A=o(g,"LI",{});var je=s(A);H=o(je,"STRONG",{});var ot=s(H);Ge=h(ot,"Generating a new sentence from an input text"),ot.forEach(t),Ae=h(je,": Translating a text into another language, summarizing a text"),je.forEach(t),g.forEach(t),ee=m(e),C=o(e,"P",{});var st=s(C);Ce=h(st,"NLP isn\u2019t limited to written text though. It also tackles complex challenges in speech recognition and computer vision, such as generating a transcript of an audio sample or a description of an image."),st.forEach(t),te=m(e),v=o(e,"H2",{class:!0});var ie=s(v);_=o(ie,"A",{id:!0,class:!0,href:!0});var it=s(_);U=o(it,"SPAN",{});var rt=s(U);le(k.$$.fragment,rt),rt.forEach(t),it.forEach(t),qe=m(ie),J=o(ie,"SPAN",{});var lt=s(J);Oe=h(lt,"Why is it challenging?"),lt.forEach(t),ie.forEach(t),ae=m(e),q=o(e,"P",{});var ht=s(q);Re=h(ht,"Computers don\u2019t process information in the same way as humans. For example, when we read the sentence \u201CI am hungry,\u201D we can easily understand its meaning. Similarly, given two sentences such as \u201CI am hungry\u201D and \u201CI am sad,\u201D we\u2019re able to easily determine how similar they are. For machine learning (ML) models, such tasks are more difficult. The text needs to be processed in a way that enables the model to learn from it. And because language is complex, we need to think carefully about how this processing must be done. There has been a lot of research done on how to represent text, and we will look at some methods in the next chapter."),ht.forEach(t),this.h()},h(){u(p,"name","hf:doc:metadata"),u(p,"content",JSON.stringify(vt)),u(y,"id","natural-language-processing"),u(y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(y,"href","#natural-language-processing"),u(d,"class","relative group"),u(x,"id","what-is-nlp"),u(x,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(x,"href","#what-is-nlp"),u(w,"class","relative group"),u(_,"id","why-is-it-challenging"),u(_,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(_,"href","#why-is-it-challenging"),u(v,"class","relative group")},m(e,i){a(document.head,p),r(e,D,i),r(e,d,i),a(d,y),a(y,O),he(b,O,null),a(d,ue),a(d,R),a(R,ge),r(e,K,i),he($,e,i),r(e,Q,i),r(e,P,i),a(P,pe),r(e,V,i),r(e,w,i),a(w,x),a(x,W),he(E,W,null),a(w,de),a(w,z),a(z,we),r(e,X,i),r(e,N,i),a(N,ve),r(e,Y,i),r(e,L,i),a(L,ye),r(e,Z,i),r(e,f,i),a(f,T),a(T,F),a(F,xe),a(T,_e),a(f,be),a(f,I),a(I,M),a(M,$e),a(I,Ee),a(f,ke),a(f,S),a(S,j),a(j,Pe),a(S,Ne),a(f,Le),a(f,G),a(G,B),a(B,Te),a(G,Ie),a(f,Se),a(f,A),a(A,H),a(H,Ge),a(A,Ae),r(e,ee,i),r(e,C,i),a(C,Ce),r(e,te,i),r(e,v,i),a(v,_),a(_,U),he(k,U,null),a(v,qe),a(v,J),a(J,Oe),r(e,ae,i),r(e,q,i),a(q,Re),ne=!0},p:gt,i(e){ne||(ce(b.$$.fragment,e),ce($.$$.fragment,e),ce(E.$$.fragment,e),ce(k.$$.fragment,e),ne=!0)},o(e){me(b.$$.fragment,e),me($.$$.fragment,e),me(E.$$.fragment,e),me(k.$$.fragment,e),ne=!1},d(e){t(p),e&&t(D),e&&t(d),fe(b),e&&t(K),fe($,e),e&&t(Q),e&&t(P),e&&t(V),e&&t(w),fe(E),e&&t(X),e&&t(N),e&&t(Y),e&&t(L),e&&t(Z),e&&t(f),e&&t(ee),e&&t(C),e&&t(te),e&&t(v),fe(k),e&&t(ae),e&&t(q)}}}const vt={local:"natural-language-processing",sections:[{local:"what-is-nlp",title:"What is NLP?"},{local:"why-is-it-challenging",title:"Why is it challenging?"}],title:"Natural Language Processing"};function yt(He){return pt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $t extends ct{constructor(p){super();mt(this,p,yt,wt,ft,{})}}export{$t as default,vt as metadata};
