La presentazione è in caricamento. Aspetta per favore

La presentazione è in caricamento. Aspetta per favore

TEORIE E TECNICHE DEL RICONOSCIMENTO

Presentazioni simili


Presentazione sul tema: "TEORIE E TECNICHE DEL RICONOSCIMENTO"— Transcript della presentazione:

1 TEORIE E TECNICHE DEL RICONOSCIMENTO
Linguistica computazionale in Python: Dalle parole singole alle frasi Estrazione di informazioni

2 ALTRE APPLICAZIONI DELLA LINGUISTICA COMPUTAZIONALE
Finora abbiamo discusso applicazioni della linguistica computazionale che richiedono la classificazione di interi documenti (spam, authorship identification, sentiment) o di singole parole Nelle prossime lezioni discuteremo applicazioni che richiedono classificazione di

3 ESTRAZIONE DI INFORMAZIONI DA TESTI: ENTITA’
SITE CULTURE LOC

4 an eventual 30% stake in the British company
RELAZIONI (PROPBANK) a GM-Jaguar pact that would give the U.S. car maker an eventual 30% stake in the British company. a GM-Jaguar pact Arg0 that would give Arg1 Here the same annotation is still in the gray box, with the argument labels added. The tree represents the dependency structure, which gives rise to the predicates in the light blue box. Notice that the trace links back to the GM-Jaguar Pact. Notice also that it could just as easily have said, “a GM-Jaguar pact that would give an eventual…stake to the US car maker.” where it would be “ ARG0: a GM-Jaguar pact that would give an ARG1: eventual…stake to ARG2: the US car maker.” This works in exactly the same way for Chinese and Korean as it works for English (and presumably will for Arabic as well.) *T*-1 an eventual 30% stake in the British company Arg2 the US car maker give(GM-J pact, US car maker, 30% stake)

5 ESTRAZIONE DI INFORMAZIONI

6 OLTRE LA PAROLA Tanto le entita’ quanto le relazioni sono espresse tramite FRASI : Epigravettiano finale Valle del Serchia

7 ANALISI SINTATTICA E CHUNKING
L’estrazione di frasi, in particolare di frasi nominali, e’ generalmente detta CHUNKING Il chunking e’ una parte della cosidetta ANALISI SINTATTICA di un enunciato, o PARSING In questa lezione parliamo di chunking in Python, nella prossima di parsing

8 CHUNKS E PAROLE

9 NP CHUNKING [ The/DT market/NN ] for/IN [ system-management/NN software/NN ] for/IN [ Digital/NNP ] [ 's/POS hardware/NN ] is/VBZ fragmented/JJ enough/RB that/IN [ a/DT giant/NN ] such/JJ as/IN [ Computer/NNP Associates/NNPS ] should/MD do/VB well/RB there/RB ./.

10 CHUNKING CON LE ESPRESSIONI REGOLARI
Le espressioni regolari discusse in precedenza possono essere usate per trovare chunks usando informazioni su POS tags: \w+/DT\s+\w+/NN Una serie di espressioni regolari del genere costituisce una GRAMMATICA NLTK fornisce strumenti per facilitare lo sviluppo di tali grammatiche NLTK, ch. 7.2, p. 265 Chunk grammar Tag patterns

11 CHUNK GRAMMARS IN NLTK >>> sentence = [("the", "DT"), ("little", "JJ"), ("yellow", "JJ"), ("dog", "NN"), ("barked", "VBD"), ("at", "IN"), ("the", "DT"), ("cat", "NN")] >>> grammar = "NP: {<DT>?<JJ>*<NN>}” >>> cp = nltk.RegexpParser(grammar) >>> result = cp.parse(sentence) >>> print result (S (NP the/DT little/JJ yellow/JJ dog/NN) barked/VBD at/IN (NP the/DT cat/NN))

12 CHUNK GRAMMARS IN NLTK >>> result.draw()

13 GRAMMATICHE PIU’ COMPLESSE
another/DT sharp/JJ dive/NN trade/NN figures/NNS any/DT new/JJ policy/NN measures/NNS earlier/JJR stages/NNS Panamanian/JJ dictator/NN Manuel/NNP Noriega/NNP his/PRP$ Mansion/NNP House/NNP speech/NN the/DT price/NN cutting/VBG 3/CD %/NN to/TO 4/CD %/NN more/JJR than/IN 10/CD %/NN the/DT fastest/JJS developing/VBG trends/NNS 's/POS skill/NN

14 USO DI CHUNKERS PER CORPUS ANALYSIS
>>> cp = nltk.RegexpParser('CHUNK: {<V.*> <TO> <V.*>}') >>> brown = nltk.corpus.brown >>> for sent in brown.tagged_sents(): tree = cp.parse(sent) for subtree in tree.subtrees(): if subtree.node == 'CHUNK': print subtree ... (CHUNK combined/VBN to/TO achieve/VB) (CHUNK continue/VB to/TO place/VB) (CHUNK serve/VB to/TO protect/VB) (CHUNK wanted/VBD to/TO wait/VB) (CHUNK allowed/VBN to/TO place/VB) (CHUNK expected/VBN to/TO become/VB) (CHUNK seems/VBZ to/TO overtake/VB) (CHUNK want/VB to/TO buy/VB)

15 FORMATO IOB DI CONLL NLTK, 7.3

16 ANNOTAZIONE DI CHUNKS: IOB

17 SVILUPPO E VALUTAZIONE DI CHUNKERS
NLTK, 7.3

18 USO DI CLASSIFICATORI PER CHUNKING
NLTK, p.274

19 STRUTTURA ANNIDATA NLTK, 7.4

20 NAMED ENTITY RECOGNITION
NLTK, 7.5


Scaricare ppt "TEORIE E TECNICHE DEL RICONOSCIMENTO"

Presentazioni simili


Annunci Google