2121from .blank import blank_verb
2222
2323# Version string used by the what(1) and ident(1) commands:
24- ID = "@(#) $Id: conjuguer - conjugaison des verbes Français v0.5.0 (October 3 , 2021) by Hubert Tournier $"
24+ ID = "@(#) $Id: conjuguer - conjugaison des verbes Français v0.5.1 (October 10 , 2021) by Hubert Tournier $"
2525
2626# Default parameters. Can be overcome by environment variables, then command line options
2727parameters = {
@@ -106,7 +106,7 @@ def display_help():
106106 print (_ ("usage: conjuguer [--debug] [--help|-?] [--locale LANG] [--version]" ), file = sys .stderr )
107107 print (
108108 " "
109- + _ ("[-c|--columns NUMBER] [-n|--nocolor] [-D |--DELA ] [-A |--ABU ]" ),
109+ + _ ("[-c|--columns NUMBER] [-n|--nocolor] [-A |--ABU ] [-D |--DELA ]" ),
110110 file = sys .stderr
111111 )
112112 print (" " + _ ("[-d|--dictionary PATH]" ), file = sys .stderr )
@@ -121,8 +121,8 @@ def display_help():
121121 )
122122 print (" " + _ ("-d|--dictionary PATH Select a specific dictionary" ), file = sys .stderr )
123123 print (" " + _ ("-n|--nocolor Disable color output" ), file = sys .stderr )
124- print (" " + _ ("-D|--DELA Enable DELA format output" ), file = sys .stderr )
125124 print (" " + _ ("-A|--ABU Enable ABU format output" ), file = sys .stderr )
125+ print (" " + _ ("-D|--DELA Enable DELA format output" ), file = sys .stderr )
126126 print (" " + _ ("--debug Enable debug mode" ), file = sys .stderr )
127127 print (
128128 " " + _ ("--help|-? Print usage and this help message and exit" ),
@@ -531,6 +531,9 @@ def fill_verb_from_abu_dictionary_data(verb, conjugations, auxiliary):
531531 number = ""
532532 person = ""
533533 gender = ""
534+ if len (part ) == 1 :
535+ number = "s"
536+ gender = "m"
534537 if len (part ) >= 2 :
535538 if part [1 ] == "SG" :
536539 number = "s"
@@ -1008,6 +1011,15 @@ def print_ABU_inflections(verb):
10081011 print ("{} {} Ver{}" .format (key , verb ["Infinitif" ]["Présent" ], inflected_verb [key ]))
10091012
10101013
1014+ ################################################################################
1015+ def escape_DELA_special_characters (verb ):
1016+ """Escape "-", "," and "." characters with a backslash"""
1017+ verb = verb .replace ("-" , "\\ -" )
1018+ verb = verb .replace ("," , "\\ ," )
1019+ verb = verb .replace ("." , "\\ ." )
1020+ return verb
1021+
1022+
10111023################################################################################
10121024def print_DELA_inflections (verb ):
10131025 """Print a verb conjugations in DELA format"""
@@ -1034,9 +1046,20 @@ def print_DELA_inflections(verb):
10341046
10351047 for key in inflected_verb .keys ():
10361048 if key == verb ["Infinitif" ]["Présent" ]:
1037- print ("{},.V{}" .format (key , inflected_verb [key ]))
1049+ print (
1050+ "{},.V{}" .format (
1051+ escape_DELA_special_characters (key ),
1052+ inflected_verb [key ]
1053+ )
1054+ )
10381055 else :
1039- print ("{},{}.V{}" .format (key , verb ["Infinitif" ]["Présent" ], inflected_verb [key ]))
1056+ print (
1057+ "{},{}.V{}" .format (
1058+ escape_DELA_special_characters (key ),
1059+ escape_DELA_special_characters (verb ["Infinitif" ]["Présent" ]),
1060+ inflected_verb [key ]
1061+ )
1062+ )
10401063
10411064
10421065################################################################################
0 commit comments