@@ -19,7 +19,7 @@ def readInEtreVerbs(etre_verb_file):
19
19
return res
20
20
21
21
def extractVerbalDepDictFR (fin_pos , dep_dict , pos_dict ):
22
- verbal_tags = ["VINF" , "VPP" , "VPR" , "ADV" ]
22
+ verbal_tags = ["VINF" , "VPP" , "VPR" , "ADV" , "CLR" ]
23
23
verbal_rels = []
24
24
25
25
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):
144
144
inf_vcs .append ((curr_id , last_fin_pos ))
145
145
146
146
# Attach participles to the current dep chain
147
- elif curr_pos in ["VPP" ]:
147
+ elif curr_pos in ["VPP" , "CLR" ]:
148
148
# print "VC compl found", curr_id
149
149
if curr_rel == "dep.coord" :
150
150
# 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):
241
241
inf_vcs .append ((fp , last_fin_pos ))
242
242
243
243
else :
244
- last_fin_pos = fp
244
+ if curr_pos != "CLR" :
245
+ last_fin_pos = fp
245
246
res [str (
246
247
fp ) + "#" + curr_pos + "#" + curr_rel + "#" + curr_morph + "#" + curr_token + "#" + curr_lemma + "#" + str (
247
248
last_fin_pos )] = createDepDict (fp , fin_pos , last_fin_pos , inf_vcs , coord , dep_dict )
@@ -378,6 +379,8 @@ def getVPinfo(v, chain_dict):
378
379
379
380
def getTenseFromVPtag (pos_seq , fr , simple_tag , LemmaList ):
380
381
382
+ #print "pos_seq", pos_seq
383
+
381
384
finite = "yes"
382
385
tense = "err"
383
386
mood = "indicative"
@@ -402,8 +405,10 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
402
405
futur_ant = "V-indfut V-partpast"
403
406
futur_proche = "V-indpst V-inf"
404
407
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"
407
412
conditionnel1 = "V-indcond"
408
413
conditionnel2 = "V-indcond V-partpast"
409
414
infinitive1 = "V-inf"
@@ -421,8 +426,10 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
421
426
PAfutur = futur_ant
422
427
PAfutur_ant = "V-indfut V-partpast V-partpast"
423
428
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é
426
433
PAconditionnel = "V-indcond V-partpast"
427
434
PAinfinitive = "V-inf V-partpast"
428
435
@@ -436,7 +443,7 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
436
443
437
444
elif (plus_que_parf in simple_tag ) and (u"être" in LemmaList ): # il était parti
438
445
for x in LemmaList :
439
- if x in etre_verb_list :
446
+ if x in etre_verb_list or "CLR" in pos_seq :
440
447
tense = "pluperfect"
441
448
voice = "active"
442
449
break
@@ -486,7 +493,7 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
486
493
487
494
elif (futur_ant in simple_tag ) and (u"être" in LemmaList ): # il sera parti
488
495
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
490
497
tense = "futureII"
491
498
voice = "active"
492
499
break
@@ -507,26 +514,50 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
507
514
mood = "imperative"
508
515
voice = "active"
509
516
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"
519
521
520
- elif subjonctif2 in simple_tag :
521
- tense = "past "
522
+ elif subjonctif_imp in simple_tag :
523
+ tense = "imperfect "
522
524
voice = "active"
523
525
mood = "subjunctive"
524
526
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"
527
534
voice = "active"
528
535
mood = "subjunctive"
529
536
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
+
530
561
elif PAconditionnel in simple_tag :
531
562
tense = "condII"
532
563
voice = "passive"
@@ -559,7 +590,7 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
559
590
560
591
elif (passe_comp in simple_tag ) and (u"être" in LemmaList ): # il est passé
561
592
for x in LemmaList :
562
- if x in etre_verb_list :
593
+ if x in etre_verb_list or u"CLR" in pos_seq :
563
594
tense = "perfect"
564
595
voice = "active"
565
596
break
@@ -586,7 +617,7 @@ def getTenseFromVPtag(pos_seq, fr, simple_tag, LemmaList):
586
617
587
618
#### MAIN of deriveFRTM ####
588
619
(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
590
621
finite , tense , mood , voice , negation = getTenseFromVPtag (pos_seq , finV , vp_morph , lemmas )
591
622
return (finite , tense , mood , voice , negation )
592
623
#####################
@@ -622,8 +653,8 @@ def searchVV(dep_dict):
622
653
v_child_token = v_child .split ("#" )[4 ]
623
654
v_child_rel = v_child .split ("#" )[2 ]
624
655
# 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
627
658
if not verbSubCat (dep_dict [v ]): # Append as mainV if no further main verbs
628
659
res .append (curr_verb )
629
660
elif v_child_pos in ["CC" ]: # Coordination
@@ -632,7 +663,7 @@ def searchVV(dep_dict):
632
663
if v_child_token in [u"être" ] and v_child_rel == "aux.pass" :
633
664
res .append (curr_verb )
634
665
else :
635
- if curr_pos not in ["CC" , "ADV" ]:
666
+ if curr_pos not in ["CC" , "ADV" , "CLR" ]:
636
667
if curr_rel != "aux.pass" :
637
668
res .append (curr_verb )
638
669
@@ -754,7 +785,7 @@ def extractVerbDeps(parsed_file):
754
785
755
786
756
787
except Exception as inst :
757
- print ( "Error reading the parsed line:" + parsed_line )
788
+ print "Error reading the parsed line:" , inst # parsed_line
758
789
759
790
parsed_line = parsed_file .readline ()
760
791
@@ -788,6 +819,6 @@ def extractVerbDeps(parsed_file):
788
819
############# MAIN ###############
789
820
790
821
verb_dep_dict = extractVerbDeps (parsed )
791
-
822
+ sys . stdout . write ( " \n " )
792
823
parsed .close ()
793
824
out_file .close ()
0 commit comments