How to use addRel method in fMBT

Best Python code snippet using fMBT_python

grsio.py

Source:grsio.py Github

copy

Full Screen

2import getopt3import re4g_reDep = re.compile('\((\S+) (\S+) (\S+)(?: (\S+))?\)') # (ncmod _ managed_32 But_0)5g_reTok = re.compile('(\S+)\_(\d+)')6def addRel(rel, match, headidx, modidx):7 tok_match = g_reTok.match(match.group(headidx))8 head = tok_match.group(2)9 tok_match = g_reTok.match(match.group(modidx))10 mod = tok_match.group(2)11 return [rel, int(head), int(mod)]12def getRel(match):13 rel = match.group(1)14 if rel == 'conj':15 yield addRel(rel, match, 3, 2)16 return17 elif rel == 'aux':18 yield addRel(rel, match, 2, 3)19 return20 elif rel == 'det':21 yield addRel(rel, match, 2, 3)22 return23 elif rel == 'ncmod':24 rel_subtype = match.group(2)25 if rel_subtype == '_':26 pass27 else:28 rel = rel + '_' + rel_subtype29 yield addRel(rel, match, 3, 4)30 return31 elif rel == 'xmod':32 rel_subtype = match.group(2)33 if rel_subtype == '_':34 pass35 else:36 rel = rel + '_' + rel_subtype37 yield addRel(rel, match, 3, 4)38 return39 elif rel == 'cmod':40 rel_subtype = match.group(2)41 if rel_subtype == '_':42 pass43 else:44 yield addRel(rel+'_subtype', match, 3, 2)45 yield addRel(rel, match, 3, 4)46 return47 if rel == 'pmod':48 yield addRel(rel, match, 2, 3)49 return50 elif rel == 'ncsubj':51 rel_subtype = match.group(4)52 if rel_subtype == '_':53 pass54 else:55 rel = rel + '_' + rel_subtype56 yield addRel(rel, match, 2, 3)57 return58 elif rel == 'xsubj':59 rel_subtype = match.group(4)60 if rel_subtype == '_':61 pass62 else:63 rel = rel + '_' + rel_subtype64 yield addRel(rel, match, 2, 3)65 return66 elif rel == 'csubj':67 rel_subtype = match.group(4)68 assert not rel_subtype == '_'69 rel = rel + '_' + rel_subtype70 yield addRel(rel, match, 2, 3)71 return72 elif rel == 'dobj':73 yield addRel(rel, match, 2, 3)74 return75 elif rel == 'obj2':76 yield addRel(rel, match, 2, 3)77 return78 elif rel == 'iobj':79 yield addRel(rel, match, 2, 3)80 return81 elif rel == 'pcomp':82 yield addRel(rel, match, 2, 3)83 return84 elif rel == 'xcomp':85 rel_subtype = match.group(2)86 if rel_subtype == '_':87 pass88 else:89 yield addRel(rel+'_subtype', match, 3, 2)90 yield addRel(rel, match, 3, 4)91 return92 elif rel == 'ccomp':93 rel_subtype = match.group(2)94 if rel_subtype == '_':95 pass96 else:97 yield addRel(rel+'_subtype', match, 3, 2)98 yield addRel(rel, match, 3, 4)99 return100 elif rel == 'ta':101 rel_subtype = match.group(2)102 assert not rel_subtype == '_'103 rel = rel + '_' + rel_subtype104 yield addRel(rel, match, 3, 4)105 return106 else:107 print >>sys.stderr, "type %s unknown" % rel108 raise "exception"109def readSent(path):110 file = open(path)111 bStart = True112 words = []113 links = []114 for line in file:115 # skip the starting comments / empty line116 line = line[:-1]117 if bStart and ( not line or line.startswith('#') ):118 continue...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful