Commit 852f1c8a authored by auraes's avatar auraes 💬
Browse files

Suppression de Tokenise() et correction du test de la préposition pour le dé à jouer

parent c79307f5
......@@ -7,51 +7,9 @@
! Source encoding UTF-8 No Mark
System_file;
!FRENCH
! TODO optimiser tout cela
[ DictWord at len w i j len_dic;
len_dic = (dict_end-dict_start)/dict_entry_size; !TODO Global
if (len>6) len = 6;
!FIXME patch provisoire si accents
! for (i=0 : i<len : i++) {
! if (buffer->(i+at) > 127) ++j;
! }
! len = len -j;
for (i=0 : i<len_dic : i++) {
w = HDR_DICTIONARY-->0+7+7*i; ! 7/9
@output_stream 3 StorageForShortName;
print (address) w;
@output_stream -3;
if (len ~= StorageForShortName-->0) continue;
for (j=0 : j<len : j++)
if (buffer->(j+at) ~= StorageForShortName->(j+WORDSIZE)) break;
if (j == len) return w;
}
return 0;
];
[ Tokenise__ b p i n r c;
!n=0; c=0;
for (i=1 : i<=b->0 : i++) {
if (b->i == ' ' or 0) {
if (n) {
r = DictWord(i-n, n);
++c;
p-->(c*2-1) = r;
p->(c*4) = n;
p->(c*4+1) = i-n;
if (c == parse->0) break;
n = 0;
}
if (b->i == 0) break;
}
else n++;
}
b->i = 0;
p->1 = c;
];
[ PosMot motn; return parse->(motn*4+1); ]; ! WordAddress-buffer
[ DicMot motn; return parse-->(motn*2-1); ]; ! WordValue
[ LanguagePronom w;
switch (w) {
......@@ -65,9 +23,6 @@ System_file;
}
];
[ PosMot motn; return parse->(motn*4+1); ]; ! WordAddress-buffer
[ DicMot motn; return parse-->(motn*2-1); ]; ! WordValue
[ NbMotPhrase motn i w;
i = parse->1;
for (motn = 1 : motn <= i : motn++) {
......@@ -78,31 +33,73 @@ System_file;
return (motn - 1);
];
[ DecolleApostrophe motn at lgm; !TODO ssi l' ou d' ?
at = PosMot(motn) + 1;
[ DictWord at lgm w i j len_dic;
len_dic = (dict_end-dict_start)/dict_entry_size; !TODO Global
if (lgm>6) lgm = 6;
for (i=0 : i<len_dic : i++) { !WARNING si accents
w = HDR_DICTIONARY-->0+7+7*i; ! 7/9
@output_stream 3 StorageForShortName;
print (address) w;
@output_stream -3;
if (lgm ~= StorageForShortName-->0) continue;
for (j=0 : j<lgm : j++)
if (buffer->(j+at) ~= StorageForShortName->(j+WORDSIZE)) break;
if (j == lgm) return w;
}
return 0;
];
[ InsertWordParse i w p;
p = parse->0;
if (p == parse->1) --p;
p = parse->1 * 2 + 2;
i = i * 2;
while (p > i) {
parse-->p = parse-->(p-2);
--p;
}
--p;
parse-->p = w;
if (parse->1 < parse->0) (parse->1)++;
];
[ DecolleApostrophe motn at lgm w1 w2 v;
at = PosMot(motn);
lgm = WordLength(motn);
if (lgm > 1 && buffer->at == ''')
LTI_Insert(++at, ' ');
else rfalse;
if (buffer->(at+1) ~= ''') return 0;
if (buffer->at == 'l') w1 = 'l^';
else if (buffer->at == 'd') w1 = 'de';
else if (buffer->at == 's') w1 = 'se';
else return 0;
w2 = DictWord(at+2, lgm-2);
if (w2) {
InsertWordParse(motn+1, w2);
parse-->(motn*2-1) = w1;
v = parse->(motn*4);
parse->((motn+1)*4) = v - 2;
v = parse->(motn*4+1);
parse->((motn+1)*4+1) = v + 2;
parse->(motn*4) = 2;
}
else return 0;
];
[ Translation n i w w1 r;
[ Translation n i w1 w2 r;
!r = 0;
n = NbMotPhrase();
for (i=1: i<=n: i++) {
w = DicMot(i);
switch(w) {
w1 = DicMot(i);
switch(w1) {
0:
r = DecolleApostrophe(i);
if (r) {
n++;
Tokenise__(buffer, parse);
}
if (r) n++;
'au', 'aux':
parse-->(i*2-1) = 'a//';
parse->(i*4) = 1;
'du', 'd^': !FIXME d^
'du':
parse-->(i*2-1) = 'de';
#IfDef DE_A_JOUER;
......@@ -113,8 +110,8 @@ System_file;
buffer->r = 'j';
}
else {
w = DicMot(i+1);
if ((w->#dict_par1) & 8) {
w1 = DicMot(i+1);
if (w1 && (w1->#dict_par1) & 8) {
parse-->(i*2-1) = 'dj';
buffer->r = 'j';
}
......@@ -124,50 +121,55 @@ System_file;
}
if (n == 1) return;
!Pronoms avant le verbe TODO optimiser
!Pronoms avant le verbe !TODO optimiser
w = parse-->1;
w1 = parse-->3;
w1 = parse-->1;
w2 = parse-->3;
r = 2;
switch (w) { !y en
'se', 's^': w = 'se'; r = 1; !s'y asseoir/balancer/suspendre
'l^': w = '-l^'; r = 1;
switch (w1) { !y en
'se': r = 1;
'l^': w1 = '-l^'; r = 1;
'le':
w = '-le';
switch (w1) {
'lui': w1 = '-lui';
'leur': w1 = 'eux';
w1 = '-le';
switch (w2) {
'lui': w2 = '-lui';
'leur': w2 = 'eux';
default: r = 1;
}
'la':
w = '-la';
switch (w1) {
'lui': w1 = '-lui';
'leur': w1 = 'eux';
w1 = '-la';
switch (w2) {
'lui': w2 = '-lui';
'leur': w2 = 'eux';
default: r = 1;
}
'les':
w = '-les';
switch (w1) {
'lui': w1 = '-lui';
'leur': w1 = 'eux';
w1 = '-les';
switch (w2) {
'lui': w2 = '-lui';
'leur': w2 = 'eux';
default: r = 1;
}
'lui': w = '-lui'; r = 1;
'leur': w = 'eux'; r = 1;
'lui': w1 = '-lui'; r = 1;
'leur': w1 = 'eux'; r = 1;
default: r = 0;
}
if (r) {
if (r == 1) {
parse-->1 = parse-->3;
!parse-->2 = parse-->4;
parse-->3 = w;
r = parse-->2;
parse-->2 = parse-->4;
parse-->4 = r;
parse-->3 = w1;
}
else {
parse-->1 = parse-->5;
!parse-->2 = parse-->6;
parse-->3 = w1;
parse-->5 = w;
r = parse-->2;
parse-->2 = parse-->6;
parse-->5 = w1;
parse-->6 = r;
parse-->3 = w2;
}
}
];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment