2014年10月17日 星期五

blog3 something about nltk

nltk stands for Natural Language Toolkit, from it's name we can know it will be of great help for natural language processing, so I am gonna write something about how to use it.

Firstly, make sure you have python installed on your computer, then you need to install some libraries under your python module to use nltk.

Step1:
install Numpy, go to numpy and download the package corresponds to your python version and operating system, then just click next, you don't need to set any variables, numpy will find python itself.

Step2:
install NLTK, go to nltk, download the right package and install it.

Step3:
install PyYAML, go to PyYAML, download the right package and install it.

Step4:
download all the data libraries of nltk, in the IDLE interface, input command like this:

then you will see a window like this:
select all and click download, it will take some time to complete the downloading process, just be patient, after downloading, window will be like this:
now you can use nltk,just refer to the documentation and type some commands and try it out, an example will be like this:
see? you can break a string easily and you can get the Bi-grams of a string easily, it's pretty efficient, so just use nltk, it will save you a lot of trouble, you don't need to think about the algorithms yourself!











9 則留言:

  1. I also tried to use nltk for content analysis. This is a useful library to do some analysis in social media. Through your blog, I know more information about nltk, such as numpy, PyYAML and so on. This is very useful for me to do more using Python. Thanks for your sharing.

    回覆刪除
  2. Thank you for your comment, NLTK is really useful, it's a great tool.

    回覆刪除
  3. Thanks for a hands-on guide introducing the steps of installing Natural Language Toolkit. I got confused and wasted a lot of time trying to install it until you reminded me to have a look at your blog. It’s really kind of you. It also reminds me that maybe I could write another blog to share some opinions for installing nltk for mac version. Thanks for your help again.

    回覆刪除
    回覆
    1. Thank for your comment, yes, I think you can write a blog to share your opinions for installing nltk for mac, because I think it's a little bit tricky, harder than installing on windows, I tried installing it for my friend on his mac, took me a long time.

      刪除
  4. Thank you for your guide about NLTK. I ever met some trouble in installing the data libraries of NLTK because the 'Server Index' is not updated which is still the old one. After modify it to the new one which is 'http://nltk.github.com/nltk_data/', it worked. So if there someone else have some trouble in installing the data libraries, he/she may can refer the method. (PS. my operation system is Ubuntu 14.04 in virtual machine)

    回覆刪除
  5. This is the most specialized blog I have ever seen,I have learned how to install a nltk and how to extract information from a sentence since we can split a sentence into apart now.Also,Bi-gram strings can also be constructed now.Still,I felt a little bit sad since I it is too late for me to read this blog and it would be more helpful before the submission of the first python programme.

    回覆刪除
  6. Thanks for your teaching! I have read your blog during doing my assignment. I found it was always error when running the programme. After reading you blog, you have told us to install the nltk library first. The programme can be run after installed the library! Yeah!

    回覆刪除
  7. I read some blog about nltk. They all mentioned that NLTK has some problem when processing Chinese. So I want to try some Chinese article analysis. Do you want to do that together?

    回覆刪除
  8. NITK is really useful when analyzing the content particularly on social network.

    回覆刪除