@@ -157,7 +157,8 @@ For BiLSTM-based semantic dependency parsing models, lemmas and POS tags are nee
157
157
``` py
158
158
>> > import os
159
159
>> > import tempfile
160
- >> > Parser.load(' biaffine-dep-en' ).predict([' I' ,' saw' ,' Sarah' ,' with' ,' a' ,' telescope' ,' .' ], verbose = False )[0 ]
160
+ >> > dep = Parser.load(' biaffine-dep-en' )
161
+ >> > dep.predict([' I' , ' saw' , ' Sarah' , ' with' , ' a' , ' telescope' , ' .' ], verbose = False )[0 ]
161
162
1 I _ _ _ _ 2 nsubj _ _
162
163
2 saw _ _ _ _ 0 root _ _
163
164
3 Sarah _ _ _ _ 2 dobj _ _
@@ -185,7 +186,7 @@ For BiLSTM-based semantic dependency parsing models, lemmas and POS tags are nee
185
186
186
187
''' )
187
188
...
188
- >> > Parser.load( ' biaffine- dep-en ' ) .predict(path, pred = ' pred.conllx' , verbose = False )[0 ]
189
+ >> > dep.predict(path, pred = ' pred.conllx' , verbose = False )[0 ]
189
190
# text = But I found the location wonderful and the neighbors very kind.
190
191
1 But _ _ _ _ 3 cc _ _
191
192
2 I _ _ _ _ 3 nsubj _ _
@@ -201,13 +202,26 @@ For BiLSTM-based semantic dependency parsing models, lemmas and POS tags are nee
201
202
11 kind _ _ _ _ 6 conj _ _
202
203
12 . _ _ _ _ 3 punct _ _
203
204
204
- >> > Parser.load(' crf-con-en' ).predict([' I' ,' saw' ,' Sarah' ,' with' ,' a' ,' telescope' ,' .' ], verbose = False )[0 ]
205
- (TOP (S (NP (_ I)) (VP (_ saw) (NP (_ Sarah)) (PP (_ with ) (NP (_ a) (_ telescope)))) (_ .)))
206
- >> > Parser.load(' biaffine-sdp-en' ).predict([[(' I' ,' I' ,' PRP' ), (' saw' ,' see' ,' VBD' ),
207
- (' Sarah' ,' Sarah' ,' NNP' ), (' with' ,' with' ,' IN' ),
208
- (' a' ,' a' ,' DT' ), (' telescope' ,' telescope' ,' NN' ),
209
- (' .' ,' _' ,' .' )]],
210
- verbose = False )[0 ]
205
+ >> > con = Parser.load(' crf-con-en' )
206
+ >> > con.predict([' I' , ' saw' , ' Sarah' , ' with' , ' a' , ' telescope' , ' .' ], verbose = False )[0 ].pretty_print()
207
+ TOP
208
+ |
209
+ S
210
+ _____________| ______________________
211
+ | VP |
212
+ | _________| ____ |
213
+ | | | PP |
214
+ | | | ____ | ___ |
215
+ NP | NP | NP |
216
+ | | | | ___| ______ |
217
+ _ _ _ _ _ _ _
218
+ | | | | | | |
219
+ I saw Sarah with a telescope .
220
+
221
+ >> > sdp = Parser.load(' biaffine-sdp-en' )
222
+ >> > sdp.predict([[(' I' ,' I' ,' PRP' ), (' saw' ,' see' ,' VBD' ), (' Sarah' ,' Sarah' ,' NNP' ), (' with' ,' with' ,' IN' ),
223
+ (' a' ,' a' ,' DT' ), (' telescope' ,' telescope' ,' NN' ), (' .' ,' _' ,' .' )]],
224
+ verbose = False )[0 ]
211
225
1 I I PRP _ _ _ _ 2 :ARG1 _
212
226
2 saw see VBD _ _ _ _ 0 :root| 4 :ARG1 _
213
227
3 Sarah Sarah NNP _ _ _ _ 2 :ARG2 _
0 commit comments