Skip to content

Commit dc5b83a

Browse files
committed
Rules for stative passive for subjunctive VCs added
1 parent beab123 commit dc5b83a

File tree

1 file changed

+60
-29
lines changed

1 file changed

+60
-29
lines changed

tmv-annotator-tool/TMV-FR.py

Lines changed: 60 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def readInEtreVerbs(etre_verb_file):
1919
return res
2020

2121
def extractVerbalDepDictFR(fin_pos, dep_dict, pos_dict):
22-
verbal_tags = ["VINF", "VPP", "VPR", "ADV"]
22+
verbal_tags = ["VINF", "VPP", "VPR", "ADV", "CLR"]
2323
verbal_rels = []
2424

2525
def checkInf(inf_deps, dep_dict, pos_dict):
@@ -144,7 +144,7 @@ def createDepDict(dep_pos, fin_pos, last_fin_pos, inf_vcs, coord, dep_dict):
144144
inf_vcs.append((curr_id, last_fin_pos))
145145

146146
# Attach participles to the current dep chain
147-
elif curr_pos in ["VPP"]:
147+
elif curr_pos in ["VPP", "CLR"]:
148148
# print "VC compl found", curr_id
149149
if curr_rel == "dep.coord":
150150
# print "Coordinated VC!", "last_fin_pos", last_fin_pos
@@ -241,7 +241,8 @@ def createDepDict(dep_pos, fin_pos, last_fin_pos, inf_vcs, coord, dep_dict):
241241
inf_vcs.append((fp, last_fin_pos))
242242

243243
else:
244-
last_fin_pos = fp
244+
if curr_pos != "CLR":
245+
last_fin_pos = fp
245246
res[str(
246247
fp) + "#" + curr_pos + "#" + curr_rel + "#" + curr_morph + "#" + curr_token + "#" + curr_lemma + "#" + str(
247248
last_fin_pos)] = createDepDict(fp, fin_pos, last_fin_pos, inf_vcs, coord, dep_dict)
@@ -378,6 +379,8 @@ def getVPinfo(v, chain_dict):
378379

379380
def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
380381

382+
#print "pos_seq", pos_seq
383+
381384
finite = "yes"
382385
tense = "err"
383386
mood = "indicative"
@@ -402,8 +405,10 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
402405
futur_ant = "V-indfut V-partpast"
403406
futur_proche = "V-indpst V-inf"
404407
imperatif = "V-imppst"
405-
subjonctif1 = "V-subjpst"
406-
subjonctif2 = "V-subjimpft V-participepasse"
408+
subjonctif_pres = "V-subjpst"
409+
subjonctif_imp = "V-subjimpft"
410+
subjonctif_passe = "V-subjpst V-partpast"
411+
subjonctif_plus_que = "V-subjimpft V-partpast"
407412
conditionnel1 = "V-indcond"
408413
conditionnel2 = "V-indcond V-partpast"
409414
infinitive1 = "V-inf"
@@ -421,8 +426,10 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
421426
PAfutur = futur_ant
422427
PAfutur_ant = "V-indfut V-partpast V-partpast"
423428
PAfutur_proche = "V-indpst V-inf V-partpast"
424-
PAsubjonctif = "V-subjpst V-partpast"
425-
PAsubjontif2 = "V-subjimpft V-partpast"
429+
PAsubjonctif_pres = subjonctif_pres #### regarder lemma
430+
PAsubjonctif_imp = subjonctif_imp #### regarder lemma
431+
PAsubjonctif_passe = "V-subjpst V-partpast V-partpast" # j'aie été aimé
432+
PAsubjonctif_plus_que = "V-subjimpft V-partpast V-partpast" # j'eusse été aimé
426433
PAconditionnel = "V-indcond V-partpast"
427434
PAinfinitive = "V-inf V-partpast"
428435

@@ -436,7 +443,7 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
436443

437444
elif (plus_que_parf in simple_tag) and (u"être" in LemmaList): # il était parti
438445
for x in LemmaList:
439-
if x in etre_verb_list:
446+
if x in etre_verb_list or "CLR" in pos_seq:
440447
tense = "pluperfect"
441448
voice = "active"
442449
break
@@ -486,7 +493,7 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
486493

487494
elif (futur_ant in simple_tag) and (u"être" in LemmaList): # il sera parti
488495
for x in LemmaList:
489-
if x in etre_verb_list:
496+
if x in etre_verb_list or u"CLR" in pos_seq: # active voice
490497
tense = "futureII"
491498
voice = "active"
492499
break
@@ -507,26 +514,50 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
507514
mood = "imperative"
508515
voice = "active"
509516

510-
elif (PAsubjonctif in simple_tag) or (PAsubjontif2 in simple_tag):
511-
if PAsubjonctif in simple_tag:
512-
tense = "pres"
513-
voice = "passive"
514-
mood = "subjunctive"
515-
else:
516-
tense = "imperfect"
517-
voice = "passive"
518-
mood = "subjunctive"
517+
elif subjonctif_pres in simple_tag:
518+
tense = "pres"
519+
voice = "active"
520+
mood = "subjunctive"
519521

520-
elif subjonctif2 in simple_tag:
521-
tense = "past"
522+
elif subjonctif_imp in simple_tag:
523+
tense = "imperfect"
522524
voice = "active"
523525
mood = "subjunctive"
524526

525-
elif subjonctif1 in simple_tag:
526-
tense = "pres"
527+
elif subjonctif_passe in simple_tag:
528+
tense = "perfect"
529+
voice = "active"
530+
mood = "subjunctive"
531+
532+
elif subjonctif_plus_que in simple_tag:
533+
tense = "pluperfect"
527534
voice = "active"
528535
mood = "subjunctive"
529536

537+
elif (PAsubjonctif_passe in simple_tag) and (u"être" in LemmaList): #
538+
for x in LemmaList:
539+
if x in etre_verb_file or "CLR" in pos_seq:
540+
tense = "perfect"
541+
voice = "active"
542+
mood = "subjunctive"
543+
break
544+
else:
545+
tense = "present"
546+
voice = "passive"
547+
mood = "subjunctive"
548+
549+
elif (PAsubjonctif_plus_que in simple_tag) and (u"être" in LemmaList): #
550+
for x in LemmaList:
551+
if x in etre_verb_file or "CLR" in pos_seq:
552+
tense = "pluperf"
553+
voice = "active"
554+
mood = "subjunctive"
555+
break
556+
else:
557+
tense = "imperfect"
558+
voice = "passive"
559+
mood = "subjunctive"
560+
530561
elif PAconditionnel in simple_tag:
531562
tense = "condII"
532563
voice = "passive"
@@ -559,7 +590,7 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
559590

560591
elif (passe_comp in simple_tag) and (u"être" in LemmaList): # il est passé
561592
for x in LemmaList:
562-
if x in etre_verb_list:
593+
if x in etre_verb_list or u"CLR" in pos_seq:
563594
tense = "perfect"
564595
voice = "active"
565596
break
@@ -586,7 +617,7 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
586617

587618
#### MAIN of deriveFRTM ####
588619
(vp_morph, finV, lemmas) = getVPtag(fin, chain_dict)
589-
# print "vp_morph", vp_morph, "finV", finV, vp_morph, "lemmas", lemmas
620+
#print "vp_morph", vp_morph, "; finV", finV, vp_morph, "; lemmas", lemmas
590621
finite, tense, mood, voice, negation = getTenseFromVPtag(pos_seq, finV, vp_morph, lemmas)
591622
return (finite, tense, mood, voice, negation)
592623
#####################
@@ -622,8 +653,8 @@ def searchVV(dep_dict):
622653
v_child_token = v_child.split("#")[4]
623654
v_child_rel = v_child.split("#")[2]
624655
# print curr_pos, curr_verb, v_child_pos, v_child_token, v_child_rel
625-
if curr_pos != "ADV":
626-
if v_child_pos == "ADV": # Negation
656+
if curr_pos not in ["ADV", "CLR"]:
657+
if v_child_pos in ["ADV", "CLR"]: # Negation, reflexive
627658
if not verbSubCat(dep_dict[v]): # Append as mainV if no further main verbs
628659
res.append(curr_verb)
629660
elif v_child_pos in ["CC"]: # Coordination
@@ -632,7 +663,7 @@ def searchVV(dep_dict):
632663
if v_child_token in [u"être"] and v_child_rel == "aux.pass":
633664
res.append(curr_verb)
634665
else:
635-
if curr_pos not in ["CC", "ADV"]:
666+
if curr_pos not in ["CC", "ADV", "CLR"]:
636667
if curr_rel != "aux.pass":
637668
res.append(curr_verb)
638669

@@ -754,7 +785,7 @@ def extractVerbDeps(parsed_file):
754785

755786

756787
except Exception as inst:
757-
print ("Error reading the parsed line:" + parsed_line)
788+
print "Error reading the parsed line:", inst#parsed_line
758789

759790
parsed_line = parsed_file.readline()
760791

@@ -788,6 +819,6 @@ def extractVerbDeps(parsed_file):
788819
############# MAIN ###############
789820

790821
verb_dep_dict = extractVerbDeps(parsed)
791-
822+
sys.stdout.write("\n")
792823
parsed.close()
793824
out_file.close()

0 commit comments

Comments
 (0)