Complete Natural Language Processing (NLP) Tutorial in Python! (with examples)

Поділитися
Вставка
  • Опубліковано 31 тра 2024
  • In this video we go through the major concepts in natural language processing using Python libraries! We use examples to help drill down the concepts. There is content in this video for all skill levels (beginners to experts). I originally recorded this video for the PyCon Conference.
    GitHub repo: github.com/KeithGalli/pycon2020
    Patreon: / keithgalli
    YT Membership: / kgmit
    Some of the topics we cover:
    - Bag-of-words
    - Word vectors
    - Stemming/Lemmatization
    - Spell correction
    - Transformer Architecture (Attention is all you need)
    - State of the art models (OpenAI GPT, BERT)
    Some of the libraries used:
    - sklearn
    - spaCy
    - NLTK
    - TextBlob
    Hope you enjoy & let me know if you have any questions! Make sure to subscribe if you haven't already :).
    -------------------------
    Follow me on social media!
    Instagram | / keithgalli
    Twitter | / keithgalli
    If you are curious to learn how I make my tutorials, check out this video: • How to Make a High Qua...
    Practice your Python Pandas data science skills with problems on StrataScratch!
    stratascratch.com/?via=keith
    Join the Python Army to get access to perks!
    UA-cam - / @keithgalli
    Patreon - / keithgalli
    *I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.
    -------------------------
    Song at the end
    good morning by Amine Maxwell / aminemaxwell
    Creative Commons - Attribution 3.0 Unported - CC BY 3.0
    Free Download / Stream: bit.ly/2vpruoY
    Music promoted by Audio Library • Good morning - Amine M...
    -------------------------
    Video Timeline!
    ~~ NLP Fundamentals ~~
    0:00 - Announcements!
    1:12 - Video overview & timeline
    3:06 - Bag of words (BOW) overview
    4:42 - Bag of words example code! (sklearn | CountVectorizer, fit_transform)
    11:20 - Building a text classification model using bag-of-words (SVM)
    14:07 - Predicting new utterances classes using our model (transform)
    16:02 - Unigram, bigram, ngrams (using consecutive words in your model)
    19:28 - Word vectors overview
    23:27 - Word vectors example code! (Using spaCy library)
    28:10 - Building a text classification model using word vectors
    34:04 - Predicting new utterances using our model
    ~~ Miscellaneous NLP Techniques ~~
    40:42 - Regexes (pattern matching) in Python.
    52:30 - Stemming/Lemmatization in Python (text normalization w/ NLTK library)
    1:01:17 - Stopwords Removal (removing most common words from sentences)
    1:05:56 - Various other techniques (spell correction, sentiment analysis, part-of-speech tagging).
    ~~ State-of-the-art Models ~~
    1:12:45 - Recurrent Neural Networks (RNNs) for text classification
    1:17:00 - Transformer architectures (attention is all you need)
    1:21:00 - Writing Python code to leverage transformers (BERT | spacy-transformers)
    1:25:00 - Writing a classification model using transformers/BERT
    1:29:37 - Fine-tuning transformer models
    1:31:16 - Bring it all together and build a high performance model to classify the categories of Amazon reviews!

КОМЕНТАРІ • 100

  • @KeithGalli
    @KeithGalli  Рік тому +7

    I created a second channel where I post more Python content, check it out! 😊
    ua-cam.com/users/techtrekbykeithgalli

    • @reubenseyram7918
      @reubenseyram7918 Рік тому

      can you teach knowledge graphs for beginners asap lol!

  • @lakshyashrungarpure
    @lakshyashrungarpure 2 роки тому +100

    I got a job because of your tutorials!! Thanks Keith🤩

    • @KeithGalli
      @KeithGalli  2 роки тому +17

      Love to hear that!! You're very welcome :)

    • @kamilcopur6513
      @kamilcopur6513 2 роки тому +3

      Could you explain some more detail please?

    • @jenna9653
      @jenna9653 Рік тому +3

      What kind of job did you get? What schooling did you have in advance? I'm considering creating projects like this for a portfolio

    • @prateekyadav9811
      @prateekyadav9811 Рік тому +1

      +1 what Jenna asked. Please share Lakshya

  • @alan6506305
    @alan6506305 2 роки тому +16

    Bookmarking this and will watch it in the morning.

    • @KeithGalli
      @KeithGalli  2 роки тому +6

      It will be here in the morning waiting for you!

    • @kentii4608
      @kentii4608 2 роки тому

      Same

    • @alan6506305
      @alan6506305 2 роки тому +1

      @@user-ut8xk4ky9q haha, literally watched it that morning.

  • @pawan-de7ow
    @pawan-de7ow 2 роки тому +5

    Glad to have you back and making awesome tutorials. Have learnt alot from you.

  • @Amulya7
    @Amulya7 Рік тому +5

    This is a great introductory tutorial on NLP. Perfect for a newbie

  • @v1hana350
    @v1hana350 2 роки тому +1

    Finally, you came back. I liked your explanation.

  • @francis191
    @francis191 2 роки тому +1

    Great to see you back Keith. Wishing you all the best in your recovery.

  • @shivamsahu9998
    @shivamsahu9998 9 місяців тому

    Thank you, Keith. Your session helped me a lot.

  • @DJdopeMike
    @DJdopeMike 16 днів тому

    Thank you for the great overview of NLP!

  • @Rapperabstar
    @Rapperabstar 13 днів тому

    I don’t usually comment on the video but when I do it, means that I really loved the content❤ thanks for helping me to learn some new stuffs

  • @muhammadzakiahmad8069
    @muhammadzakiahmad8069 Рік тому

    Amazing tutorial Mr.Keith, I just wanted to have a know how of NLP and this tutorial was perfect for it.

  • @edsonwinnerify
    @edsonwinnerify 2 роки тому

    Glad you are back Keith!!!!

  • @eldarhasanov
    @eldarhasanov 3 дні тому

    Thank you for this guide!

  • @christianondo9637
    @christianondo9637 Місяць тому

    great tutorial, thanks so much for putting this out there. It's pretty crazy how easy it is to learn stuff if you're willing to search youtube

  • @adeshmishra1671
    @adeshmishra1671 2 роки тому

    Good to see you back with bang!!

  • @bosszz1282
    @bosszz1282 2 роки тому

    I've been following your tutorials, but I've been busy with object detection lately, so I'll be watching this nlp video of yours later

  • @richarddankwah3088
    @richarddankwah3088 2 роки тому +1

    Glad to See this Mr. Keith. Always impressive and fun. Thank you very much. But am your big fun as well

  • @avixek
    @avixek 2 роки тому +1

    You are probably one of the smartest guy on youtube. Keep making your videos. You are doing God's work!!!

  • @nazrulhudashanto6357
    @nazrulhudashanto6357 Рік тому

    great tutorial brother. Highly appreciated

  • @srijitbhattacharya6770
    @srijitbhattacharya6770 2 роки тому

    Good to see you. Bookmarking this

  • @amansorout.6779
    @amansorout.6779 2 роки тому +3

    Damn, I am very happy you are back bro. 😀

  • @markgolob4677
    @markgolob4677 2 роки тому +1

    Awesome video, thanks!

  • @codewithkarthik7136
    @codewithkarthik7136 2 роки тому +1

    It would be super nice if you would make a text generation video. As always loved the vid keith

  • @wahaha108
    @wahaha108 2 роки тому

    hi Keith, great video. You provide an one-stop service, hhh. Great!

  • @zulekhaimtiaz6620
    @zulekhaimtiaz6620 Рік тому +7

    Heyy Keith!! I just want to thank you sooo much. I applied for an internship which required for me to submit an assignment on data classification and your SKLearn video helped me soo much with the task! I really am so grateful to you! Your tutorials are the best!

    • @KeithGalli
      @KeithGalli  Рік тому +5

      Glad you like the videos and happy that specific one helped you with the task! Hope you land the internship!

  • @RichardHarrowz
    @RichardHarrowz 2 роки тому +1

    LOVE TO SEE YOU AGAIN MAN! LOVE THE CONTENT AND HOW U EXPLAIN!!!!

    • @KeithGalli
      @KeithGalli  2 роки тому

      THANK YOU

    • @Rapperabstar
      @Rapperabstar 15 днів тому

      😂 it is too late to comment but seems like someone is playing with the uppercase letters 😂

  • @rahulk92
    @rahulk92 2 роки тому +3

    Keep this coming.
    I would like to see more such video - this is great.
    Multi language models and different pytorch eco system transformers

  • @letsjoinhands
    @letsjoinhands 2 роки тому

    I got to know about, use and love pandas from your tutorials.

  • @AleDP
    @AleDP 6 місяців тому

    love the video, thanks

  • @jorgeromero141
    @jorgeromero141 2 роки тому

    You are the best my bro

  • @shefalisingh4675
    @shefalisingh4675 Рік тому

    Hey Keith!!! I really like your approach to teaching, make things simpler and approachable. I need to create a chat GPT kind of functionality for my project, need your input on that and how to approach it as it's very new to me. Looking forward to hearing from you!!!

  • @m.hassan8142
    @m.hassan8142 2 роки тому

    learning alottt :) must watch
    SOTA learning

  • @codewithkarthik7136
    @codewithkarthik7136 2 роки тому +1

    keith could you make a in-detail time series forecasting vid. It would be amazing

  • @ghzich017
    @ghzich017 2 роки тому +2

    Hey bro, I really likes your tutorial. I wonder just by following your videos tutorial (like 95% of your tutorials videos) will ever get me a job in data science field without degree?

  • @Sece1
    @Sece1 2 роки тому +2

    I am new to ML and want to move forward wiith NLP. Really appreciate this. Can you also combine this with big data as in my project i was not able to use ngrams due to excessive column numbers. I used Yelp data. I also want to know about transformers and NLP with DL. Oh man there is a lot to cover!

  • @andyh964
    @andyh964 7 місяців тому

    Legit learned more from this video than my masters programme

  • @bengeorge9063
    @bengeorge9063 2 роки тому +2

    Thank you!

    • @KeithGalli
      @KeithGalli  2 роки тому +1

      My pleasure! Hope it's helpful

  • @dheerajsharma1787
    @dheerajsharma1787 3 місяці тому +1

    At 10:02 The get_feature_names() is now get_feature_names_out()

  • @SanataniAryavrat
    @SanataniAryavrat 2 роки тому

    Glad you are back, Keith bro... all the best and love from India

  • @christodoulosasiminidis8658
    @christodoulosasiminidis8658 Рік тому +1

    Recurrent Neural Networks are awesome especially for sequential patterns such as word embeddings and words sequence.

  • @TimGrob
    @TimGrob Рік тому +1

    Please use List Comprehensions in Python in the future.

  • @orlandmorentevlogs8360
    @orlandmorentevlogs8360 2 роки тому

    Watching from Romblon Philippines.

  • @kamilcopur6513
    @kamilcopur6513 2 роки тому +6

    I've just decided to change my carreer path at my age 35. I have some basic knowledges about coding languages(C, Python, HTML,CSS, JS). But I still couldn't decide which area to choose. Normally I enjoy dealing with algorithms using python, but I am curious about job opportunities (especially for a starter after age 35).

    • @baozixiao6733
      @baozixiao6733 2 роки тому

      exact same here. Struggled along the way but we only live once, so, do what we want to do!

  • @TimGrob
    @TimGrob Рік тому

    What exactly does the Bert Model do? Because you still feed the Bert Model output into an SVM to classify your text. Thanks for your explanation?

  • @technicalboy1816
    @technicalboy1816 2 роки тому

    Thank you for this. Please make text bigger.

  • @aunterong6813
    @aunterong6813 2 роки тому +6

    Hey Keith would you be doing a tutorial on regular expressions?

    • @KeithGalli
      @KeithGalli  2 роки тому +1

      Not sure if you saw, but there is a small section on regular expressions in this video (look at the video timeline to find it).
      I definitely would like to make a more comprehensive video on regular expressions at some point. I find them super fun! haha

  • @sabbirahmed8012
    @sabbirahmed8012 2 роки тому

    Hey Keith, Can you please mention some resources to learn nlp? TIA.

  • @arshad1781
    @arshad1781 2 роки тому +1

    Thanks

  • @vanhoumin
    @vanhoumin 2 роки тому +3

    Damn I'm thinking of doing something NLP related for my thesis I guess this is the sign that I should do it 😅

  • @abhaytyagi762
    @abhaytyagi762 2 місяці тому +1

    Hi Keith. Thanks for your tutorial, having a blast following along and learning! I've run into an issue, though. At time of writing (March 2024) spaCy seems to be on V3, and as a consequence to import BERT in we use spacy.load("en_core_web_trf") and NOT "en_trf_bertbaseuncased_lg", which does not work anymore. However, after doing so, it seems I'm running into an error regarding array sizes when fitting the SVC with my training vectors and train_y? Upon printing out train_x_vectors it displays empty arrays! That's probably why the fit isn't working. I'm not sure what's happening there (why are they empty??), could you help me out? Love from India.

    • @daiki1697
      @daiki1697 2 місяці тому

      Up to this, I am encountering the same error.

  • @ramanjitsingh3683
    @ramanjitsingh3683 3 місяці тому

    hi, @keithGalli, i need some help, can you please help me.. please answer my ques: i have 5 pdf's invoice with different format's i need to extract data from it but the position of data is all different from each other, i need to extract data from them i need to write python script so Machine learning authomatically extract data from it put into json format. do it possible with spacy? how i can do thta what technologies i will use to do it?

  • @roibuda9448
    @roibuda9448 2 роки тому +1

    my man

  • @mehdismaeili3743
    @mehdismaeili3743 2 роки тому

    hi keith /thanks.

  • @berrodriquez26
    @berrodriquez26 2 роки тому

    This guy deserves to be next to God !

  • @shirumi2331
    @shirumi2331 2 роки тому

    15:01 If anyone else is getting "CLOTHING" here, try creating your vectorizer like this:
    vectorizer = CountVectorizer(stop_words=["the"])

  • @senthilkumarradhakrishnan744
    @senthilkumarradhakrishnan744 Місяць тому

    Are check and cheque meant to be similar?

  • @thejaskp304
    @thejaskp304 10 місяців тому

    When using trasformer architecture it gives me value error for using clf_svm.fit(train_x_vectors, train_y)
    and I dont know is this is because of 'en_core_web_trf' instead of 'en_trf_bertbaseuncased_lg' because of it was outdated in version3. can you clarify that why this give me value error?

    • @003kazimehrabrashid4
      @003kazimehrabrashid4 3 місяці тому

      same case happened to me, were you able to solve this issue? if yes, can you please guide me?

  • @develxper7931
    @develxper7931 2 роки тому +1

    11:57 keith enum 😂👌

  • @Tommykennedy101
    @Tommykennedy101 2 роки тому

    What happened to "Neuro Linguistic Programming"?
    Also did he put two finger's up to everyone at the start?

  • @saumojitbhattacharjee7292
    @saumojitbhattacharjee7292 2 роки тому

    What Software You Use For Screen Recording?

    • @KeithGalli
      @KeithGalli  2 роки тому +1

      When I recorded this I was using a program called Snagit. I more recently started using Bandicam.
      Note I record my screen and face separately and edit the two together after I'm done recording

    • @saumojitbhattacharjee7292
      @saumojitbhattacharjee7292 2 роки тому

      @@KeithGalli Thanks 😊

  • @mohdfaazkhan8847
    @mohdfaazkhan8847 2 роки тому

    Please create project "terms and conditions techniques" in NLP.

    • @KeithGalli
      @KeithGalli  2 роки тому +1

      Hmm I don't know what you mean by this, can you please clarify

  • @moviecamp11
    @moviecamp11 2 роки тому

    Wait but what is language if not natural?? I’m pretty sure my dog can understand me, but he’s also an idiot. So what does that say about language?? Plz help
    Also I’m getting an error when I try to import beautifulsoup. It’s really harshing my mellow

    • @KeithGalli
      @KeithGalli  2 роки тому +6

      That's an easy question, Mr. Sherwood. To find unnatural language all you have to do is watch me try to talk to girls at the bar. Hope this helps. Xoxo.

  • @timetostudy6443
    @timetostudy6443 2 роки тому

    after trying out and nothing happened the way I want it to work. I quitted

  • @mr_m0u5e41
    @mr_m0u5e41 2 роки тому +1

    I can always go to bed early tomorrow right? 👀

    • @KeithGalli
      @KeithGalli  2 роки тому +1

      Haha I give you permission to get your sleep, the video will be here in the morning :)

  • @milomalaysia7034
    @milomalaysia7034 2 місяці тому

    18:25

  • @jorgeromero141
    @jorgeromero141 Рік тому

    I love this guy in a non- homosexual way

  • @ToughdataTiktok
    @ToughdataTiktok Рік тому

    Honored to learn nlp from elon musk himself

  • @BiranchiNarayanNayak
    @BiranchiNarayanNayak 2 роки тому +1

    I find the words "Cheque" and "Check" are incorrectly used in the NLP examples.
    39:52
    "I went to the bank and wrote a check" is an incorrect English sentence.
    It should have been "I went to the bank and wrote a cheque"
    1:54:41
    "Write me a check" is an incorrect English sentence.
    It should have been "Write me a cheque".

    • @KeithGalli
      @KeithGalli  2 роки тому +2

      In USA, we use "check" in this context. This may be untrue in other English speaking countries though.

  • @fustigate8933
    @fustigate8933 2 роки тому +1

    hi

  • @zachfornero9371
    @zachfornero9371 11 місяців тому

    You sound like mordecai

  • @lbb2rfarangkiinok
    @lbb2rfarangkiinok Рік тому

    NooMAREickle, not NOOmerical >)

  • @bobbykbose4399
    @bobbykbose4399 Рік тому

    Waste of time