A Supervised Sequence 2 Sequence Problem
Janos Borst July 26, 2019
University of Leipzig - NLP Group
A Supervised Sequence 2 Sequence Problem Janos Borst July 26, 2019 - - PowerPoint PPT Presentation
A Supervised Sequence 2 Sequence Problem Janos Borst July 26, 2019 University of Leipzig - NLP Group Sequence to Sequence l 2 PUNCT NOUN PRON PREP NOUN ART l 6 l 5 l 4 l 3 words l 1 many of sentence A 1 ( ) . ( ) ( )
University of Leipzig - NLP Group
1
2
3
3
4
5
5
6
sentence_id token_id token pos chunks ner 1 EU NNP I-NP S-ORG 1 1 rejects VBZ I-VP O 1 2 German JJ I-NP S-LOC 1 3 call NN I-NP O 1 4 to TO I-VP O 1 5 boycott VB I-VP O 1 6 British JJ I-NP S-MISC 1 7 lamb NN I-NP O 1 8 . . O O 2 Peter NNP I-NP B-PER 2 1 Blackburn NNP I-NP E-PER 3 BRUSSELS NNP I-NP S-LOC 3 1 1996-08-22 CD I-NP O 4 The DT I-NP O 4 1 European NNP I-NP B-ORG 4 2 Commission NNP I-NP E-ORG 4 3 said VBD I-VP O 4 4
IN I-PP O 4 5 Thursday NNP I-NP O .... 7
8
8
a sentence
words
a sentence
many words
9
a sentence
words
a sentence
many words
9
a sentence
many words
a sentence
many words
9
a sentence
words
a sentence
many words
9
a sentence
words
a sentence
many words
9
a sentence
many words a sentence
many words
10
a sentence
many words a sentence
many words
11
a sentence
many words a sentence
many words a sentence a sentence
many words a sentence
many words many words
12
a sentence
many words a sentence
many words a sentence a sentence
many words a sentence
many words many words
12
a sentence
many words a sentence
many words a sentence a sentence
many words a sentence
many words many words
12
a sentence
many words a sentence
many words a sentence a sentence
many words a sentence
many words many words
12
a sentence
many words a sentence
many words a sentence a sentence
many words a sentence
many words many words
12
13
14
15
15
15
15
16
import keras import keras_contrib as kc i = keras . layers . Input ( ( 1 4 0 , ) ) . . . lstm = . . . c r f = kc.layers.CRF( num_of_labels ) ( lstm ) model = keras . models . Model ( inputs = [ i ] ,
=[ c r f ] ) model . compile (
loss = kc.losses.crf_loss , metrics = [kc.metrics.crf_viterbi_accuracy] ) 17
18
19
20
word- sequence
CRF-Loss label- sequences
21
22
23
24