Nltk

nltk

#nltk

1

1: nltk

2

2

2

2

NLTK

2

Examples

2

NLTK

2

2

NLTK

3

CondaNLTK

4

4

4

4

5

2: POS

6

6

6

6

Examples

6

6

3:

7

7

Examples

7

7

4:

8

8

Examples

8

8

5:

9

9

Examples

9

9

6:

11

11

Examples

11

11

12

You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: nltk

It is an unofficial and free nltk ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official nltk.

The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners.

Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to info@



1

1: nltk

NLTKPython50 WordNetNLP

PythonNLTKPythonPython 3NLTK 3Python 2

NLTK

3.2.4 2017521 3.2 201633 3.1

Examples

NLTK

NLTKnltk.tokenize

import nltk text = "This is a test. Let's try this sentence boundary detector." text_output = nltk.tokenize.sent_tokenize(text) print('text_output: {0}'.format(text_output))

text_output: ['This is a test.', "Let's try this sentence boundary detector."]

NLTKPython2.73.4+ python - 3.5

? Mac / Unix 1. NLTKsudo pip install -U nltk 2. Numpysudo pip install -U numpy 3. pythonimport nltk

Pythonsetuptools easy_install pip

? Windows



2

Python 32

1. Python 3.5 http //downloads/ 64 2. Numpy http //projects/numpy/files/NumPy/ pythnon3.5 3. NLTK http //pypi.pypi/nltk 4. Start>Python35 import nltk

? https //nltk/nltk/wiki/Installing-Third-Party-Software

http //install.html

NLTK

pipNLTK pip install nltk NLTK Python shellntlk.download()UIpython -m nltk.downloader [package_name]

?

nltk.download('all')

?

nltk.download('package-name')

?

import nltk

dwlr = nltk.downloader.Downloader()

# chunkers, corpora, grammars, help, misc, # models, sentiment, stemmers, taggers, tokenizers for pkg in dwlr.packages():

if pkg.subdir== 'taggers': dwlr.download(pkg.id)

? Corpora

import nltk dwlr = nltk.downloader.Downloader() for pkg in dwlr.corpora():



3

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download