Rev 4158 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !if $wims_read_parm!=slib_header |
2 | !goto proc |
||
3 | !endif |
||
4 | slib_title=Apostrophe reduction of a French text |
||
5 | slib_parms=1\ |
||
6 | ,the raw text |
||
7 | slib_author=Gang Xiao |
||
8 | slib_out=the transformed text |
||
9 | slib_comment=This script translates "le avion" to "l'avion", etc. \ |
||
10 | It also translates "de le" into "du". |
||
11 | slib_example= le avion\ |
||
12 | le port\ |
||
13 | de le pain |
||
14 | !exit |
||
15 | |||
16 | :proc |
||
17 | slib_inp=!singlespace $wims_read_parm |
||
18 | slib_out= |
||
19 | !if $slib_inp=$empty |
||
20 | !exit |
||
21 | !endif |
||
22 | |||
23 | slib_n=!wordcnt $slib_inp |
||
24 | !for slib_i=1 to $slib_n-1 |
||
25 | slib_W=!word $slib_i of $slib_inp |
||
26 | slib_w=!lower $slib_W |
||
27 | slib_c=!char -1 of $slib_W |
||
28 | !if $slib_c notin ea or $slib_w notwordof \ |
||
29 | ce de je la le ma me ne sa se ta te que puisque lorsque |
||
30 | !goto normal |
||
31 | !endif |
||
32 | slib_n=!word $slib_i+1 of $slib_inp |
||
33 | slib_cn=!char 1 of $slib_n |
||
34 | slib_cn=!lower $slib_cn |
||
35 | slib_cn=!deaccent $slib_cn |
||
36 | !if $slib_cn notin aeiouh |
||
37 | !goto normal |
||
38 | !endif |
||
39 | !if $slib_w=ce |
||
40 | slib_out=$(slib_out)cet $ |
||
41 | !goto next |
||
42 | !endif |
||
43 | !if $slib_c=e or $slib_w=la |
||
44 | slib_W1=!char 1 to -2 of $slib_W |
||
45 | slib_out=$slib_out$slib_W1' |
||
46 | !else |
||
47 | slib_c1=!char 1 of $slib_W |
||
48 | slib_out=$slib_out$(slib_c1)on $ |
||
49 | !endif |
||
50 | !goto next |
||
51 | :normal |
||
52 | slib_out=$slib_out$slib_W $ |
||
53 | :next |
||
54 | !next slib_i |
||
55 | slib_w=!word -1 of $slib_inp |
||
56 | slib_out=!trim $slib_out$slib_w |
||
57 | slib_out=!replace word de le by du in $slib_out |
||
58 | slib_out=!replace word à le by au in $slib_out |
||
59 | slib_out=!replace word de les by des in $slib_out |
||
60 | slib_out=!replace word à les by aux in $slib_out |
||
61 |