alanakbik commited on
Commit
0548f91
β€’
1 Parent(s): b610528

initial model commit

Browse files
Files changed (1) hide show
  1. README.md +9 -13
README.md CHANGED
@@ -28,10 +28,10 @@ from flair.data import Sentence
28
  from flair.models import SequenceTagger
29
 
30
  # load tagger
31
- tagger = SequenceTagger.load("flair/pos-english")
32
 
33
  # make example sentence
34
- sentence = Sentence("I love Berlin.")
35
 
36
  # predict NER tags
37
  tagger.predict(sentence)
@@ -40,23 +40,20 @@ tagger.predict(sentence)
40
  print(sentence)
41
 
42
  # print predicted NER spans
43
- print('The following NER tags are found:')
44
  # iterate over entities and print
45
- for entity in sentence.get_spans('pos'):
46
  print(entity)
47
 
48
  ```
49
 
50
  This yields the following output:
51
  ```
52
- Span [1]: "I" [βˆ’ Labels: PRP (1.0)]
53
- Span [2]: "love" [βˆ’ Labels: VBP (1.0)]
54
- Span [3]: "Berlin" [βˆ’ Labels: NNP (0.9999)]
55
- Span [4]: "." [βˆ’ Labels: . (1.0)]
56
-
57
  ```
58
 
59
- So, the word "*I*" is labeled as a **pronoun** (PRP), "*love*" is labeled as a **verb** (VBP) and "*Berlin*" is labeled as a **proper noun** (NNP) in the sentence "*TheI love Berlin*".
60
 
61
 
62
  ---
@@ -75,7 +72,6 @@ corpus = ColumnCorpus(
75
  "resources/tasks/srl", column_format={1: "text", 11: "frame"}
76
  )
77
 
78
-
79
  # 2. what tag do we want to predict?
80
  tag_type = 'frame'
81
 
@@ -87,9 +83,9 @@ embedding_types = [
87
 
88
  BytePairEmbeddings("en"),
89
 
90
- FlairEmbeddings("news-forward-fast"),
91
 
92
- FlairEmbeddings("news-backward-fast"),
93
  ]
94
 
95
  # embedding stack consists of Flair and GloVe embeddings
 
28
  from flair.models import SequenceTagger
29
 
30
  # load tagger
31
+ tagger = SequenceTagger.load("flair/frame-english")
32
 
33
  # make example sentence
34
+ sentence = Sentence("George returned to Berlin to return his hat.")
35
 
36
  # predict NER tags
37
  tagger.predict(sentence)
 
40
  print(sentence)
41
 
42
  # print predicted NER spans
43
+ print('The following frame tags are found:')
44
  # iterate over entities and print
45
+ for entity in sentence.get_spans('frame'):
46
  print(entity)
47
 
48
  ```
49
 
50
  This yields the following output:
51
  ```
52
+ Span [2]: "returned" [βˆ’ Labels: return.01 (0.9951)]
53
+ Span [6]: "return" [βˆ’ Labels: return.02 (0.6361)]
 
 
 
54
  ```
55
 
56
+ So, the word "*returned*" is labeled as **return.01** (as in *go back somewhere*) while "*return*" is labeled as **return.02** (as in *give back something*) in the sentence "*George returned to Berlin to return his hat*".
57
 
58
 
59
  ---
 
72
  "resources/tasks/srl", column_format={1: "text", 11: "frame"}
73
  )
74
 
 
75
  # 2. what tag do we want to predict?
76
  tag_type = 'frame'
77
 
 
83
 
84
  BytePairEmbeddings("en"),
85
 
86
+ FlairEmbeddings("news-forward"),
87
 
88
+ FlairEmbeddings("news-backward"),
89
  ]
90
 
91
  # embedding stack consists of Flair and GloVe embeddings