• Non ci sono risultati.

Introduction to Introduction to NLTKNLTK

N/A
N/A
Protected

Academic year: 2021

Condividi "Introduction to Introduction to NLTKNLTK"

Copied!
11
0
0

Testo completo

(1)

Introduction to Introduction to NLTK NLTK

Text Analytics Text Analytics Giuseppe Attardi Giuseppe Attardi Università di Pisa Università di Pisa

(2)

Installing NLTK Installing NLTK

Download and InstallDownload and Install

 http://nltk.org/install.html

Download NLTK data Download NLTK data

>>> import nltk

>>> nltk.download()

(3)

Jupyter Notebook Jupyter Notebook

Register with your UniPi credentials to activate Register with your UniPi credentials to activate your free account for a G Suite at:

your free account for a G Suite at:

this page.

Astart your Jupyter Notebook here:Astart your Jupyter Notebook here:

https://attardi-4.di.unipiit:8000/

(4)

NLTK NLTK

(5)

NLTK NLTK

Suite of classes for several NLP tasksSuite of classes for several NLP tasks

Parsing, POS tagging, classifiers…Parsing, POS tagging, classifiers…

Several text processing utilities, corporaSeveral text processing utilities, corpora

 Brown, Penn Treebank corpus…

 Your data was divided into sentences using ‘punkt’

(6)

NLTK NLTK

Text materialText material

 Raw text

 Annotated Text

ToolsTools

 Part of speech taggers

 Semantic analysis

ResourcesResources

 WordNet, Treebanks

(7)

Linguistic Tasks Linguistic Tasks

Part of Speech TaggingPart of Speech Tagging

ParsingParsing

Word NetWord Net

Named Entity Named Entity Recognition Recognition

Information RetrievalInformation Retrieval

Sentiment AnalysisSentiment Analysis

Document ClusteringDocument Clustering

Topic SegmentationTopic Segmentation

ClassificationClassification

AuthoringAuthoring

Machine TranslationMachine Translation

SummarizationSummarization

Information ExtractionInformation Extraction

Spoken Dialog SystemsSpoken Dialog Systems

Natural Language Natural Language Generation

Generation

Word Sense Word Sense

Disambiguation Disambiguation

(8)

‘ ‘ import nltk’ import nltk’

You will need to import the necessary modules to You will need to import the necessary modules to create objects and call member functions

create objects and call member functions

 import ~ include objects from pre-built packages

FreqDist, ConditionalFreqDist are in FreqDist, ConditionalFreqDist are in nltk.probability

nltk.probability

PlaintextCorpusReader is in nltk.corpusPlaintextCorpusReader is in nltk.corpus

(9)

Basic NLTK usage Basic NLTK usage

Load the notebook ‘Intro to NLTK’ using:Load the notebook ‘Intro to NLTK’ using:

 File > Open > Text Anaytics > Intro to NLTK

Explore the examples by advancing through them Explore the examples by advancing through them with the button ►

with the button ►

(10)

Exercise 1.

Exercise 1.

Run examples from Chapter 1 of NLTK book:Run examples from Chapter 1 of NLTK book:

 http://nltk.googlecode.com/svn/trunk/doc/book/ch01.

html

(11)

Exercise 2.

Exercise 2.

Run examples from Chapter 3 of NLTK bookRun examples from Chapter 3 of NLTK book

 http://nltk.googlecode.com/svn/trunk/doc/book/ch03.

html

Riferimenti

Documenti correlati

2^ coppia TELEFONARE : TO PHONE(fòun) e TO CALL(kò:l) entrambi senza il TO 3^ coppia RISPONDERE : TO REPLY(riplài) – vuole il TO del complemento di ternine TO

However, you must provide a certificate proving your English proficiency (unless your degree courses were delivered in English). Sometimes IELTS or other equivalent

These games have certain patterns that must be understood, memorized, and applied repeatedly until they become second nature... To become a software

These games have certain patterns that must be understood, memorized, and applied repeatedly until they become second nature... To become a software

A new generation of intelligent machines had emerged, powered by a small set of statistical learning algorithms and large amounts of data.».. Nello Cristianini The road to

This includes central administration, the medical school dean, the university hospital, clinical departments, the research institute, the Veterans Administration hospital, and

17 Sarah Hockenberry & Charles Puzzanchera, Juvenile Court Statistics 2013, National Center for Juvenile Justice (July 2015),

We examined the association between the need to belong and state forgiveness for specific offenses in Study 3 and not only replicated the results of Study 1 with a state