alan-if / alan-i18n

ALAN Internationalization Project
Other
0 stars 1 forks source link

Spanish BUG: Syntaxes with "de" Not Working! #43

Open tajmone opened 2 years ago

tajmone commented 2 years ago

@thoni56 and @Rich15, I've come across a problem with compound prepositions in Spanish verbs. E.g. the SYNTAX for "put (obj1) on (obj2)" has two variations:

SYNTAX
  poner_sobre = poner (obj1) sobre (obj2).
  poner_sobre = poner (obj1) sobre de (obj2).

one with and another without "de". The same applies for many other prepositions of the type "on top of", "behind", "under", "near", etc.

The problem is that when the player tries to use the variation with "de" the parser fails to recognize the command replying that "there is no de obj2". E.g.

> poner el cuchillo sobre de fregadero
No hay de fregadero aquí.

whereas using the version without "de" works fine:

> poner el cuchillo sobre fregadero
¡Naaah!. Prefiero poner el cuchillo en el suelo.

I've tried swapping place between the two syntaxes (so the longer one would become the default), or enclosing within quotes 'sobre de', or individually 'sobre' 'de', but to no avail.

The problem seems that ALAN doesn't expect more than one word (token) between parameters, and if it finds one it considers it to be part of the parameter name (i.e. as if it was an adjective + name).

So far, the only solution that comes to my mind would be to add a name variant containing "de" for each object that is a candidate for such verbs, e.g.

The fregadero IsA object at xxxx
  Name fregadero.
  Name de fregadero.

I haven't tried that yet (will do), but it seems a rather ugly workaround and a desperate attempt to save the situation, rather than a real solution. Even if it worked, it should be done on every object instance (or even actors) since the player might attempt such VERBs that contain a "de" on any object really, not just does that we want to be usable with such verbs!

@thoni56, any thoughts on this? why it's happening, and if there are possible solutions?

@Rich15, how bad is it in the Spanish language to omit the "de" in such commands? Is it something that players can cope with, or does it feel totally unnatural?

I noticed that all these type of verbs contain the SYNTAX variant without "de" (as the default), but now I'm not sure whether this was done because of the above problem, or because both forms are acceptable (at least in terms of IF playing, where less typing is more).

If there's no way to make the SYNTAX variants with "de" working, we should just delete them.

References

tajmone commented 2 years ago

Possible Workaround via Noise Words

I was thinking that this problem could be solved by declaring "de" (and its variations, if any) as a NOISE WORD, so its stripped by the parser. So this would be useful, regardless of the use of "de" in such commands is optional or mandatory, for either input would match the same syntax (i.e. without "de": poner (obj1) sobre (obj2), etc.).

But this is only doable if "de" is never used on its own in syntaxes where it might play an important role — but this is something that only @Rich15 can confirm, since I have no idea if "de" can be used as a preposition on its own, or whether the term has other roles in the Spanish grammar.

Rich15 commented 2 years ago

@tajmone, @thoni56, I think the best solution would be to omit "de". In fact, "poner x sobre de x" sounds a little odd. poner (obj1) sobre (obj2) is perfectly fine, and we don't risk ruining another command by putting "de" as a NOISE WORD.

tajmone commented 2 years ago

I think the best solution would be to omit "de".

That's good news. We can just delete those alternative syntaxes.

and we don't risk ruining another command by putting "de" as a NOISE WORD.

Does this mean that there are also other uses of "de/del" where it actually is needed?

tajmone commented 2 years ago

Just to make sure we can safely delete all the syntax variants with the extra 'DE', I'm listing all of them here. I think I understand the problem, i.e. that some people might use the extra 'de' in everyday parlance, although it's not required grammatically — in Italian we have many similar examples.

It's always a tuff decision in IF: should we cover everyday language usage, or just stick to proper grammar? Usually the latter prevails, except for well established norms of speech that are so widely accepted that most players will naturally attempt their use in IF commands.

As long as dropping the 'de' from the SYNTAX doesn't result in an incorrect form, I think it's best to just drop it, since it's not readily supported in ALAN, after all players tend to quickly adapt to IF and use the shortest commands possible (to type faster) and are generally resilient when it comes to learning how the game commands work.

(but I sill think that it's worth investigation the original problem of why these double prepositions don't work in ALAN, or at least to document it in The ALAN Manual, if this is how SYNTAXes are supposed to work).

Occurrences of 'DE' in Library SYNTAXes

There are 8 alternative SYNTAXes, across 3 library modules, for a verb variant with "de":

  1. examinar.i:

    134:   mirar_en = mirar dentro de (obj).
    ...
    155:   buscar = buscar dentro de (obj).
  2. hablar.i:

    121:   hablar_con = hablar con (act) sobre de (tema)!.
  3. poner.i:

    65:   poner_cerca = poner (obj1) cerca de (obj2).
    ...
    72:   poner_detras = poner (obj1) detras de (obj2).
    74:   poner_detras = poner (obj1) tras de (obj2).
    ...
    81:   poner_sobre = poner (obj1) sobre de (obj2).
    ...
    88:   poner_bajo = poner (obj1) debajo de (obj2).

@Rich15, I just wanted to make sure that NONE of the above is a correct syntax (as opposed to its variant without 'DE') before deleting them from the library for good.

thoni56 commented 2 years ago

@thoni56 and @Rich15, I've come across a problem with compound prepositions in Spanish verbs. E.g. the SYNTAX for "put (obj1) on (obj2)" has two variations:

SYNTAX
  poner_sobre = poner (obj1) sobre (obj2).
  poner_sobre = poner (obj1) sobre de (obj2).

one with and another without "de". The same applies for many other prepositions of the type "on top of", "behind", "under", "near", etc.

The problem is that when the player tries to use the variation with "de" the parser fails to recognize the command replying that "there is no de obj2". E.g.

> poner el cuchillo sobre de fregadero
No hay de fregadero aquí.

whereas using the version without "de" works fine:

> poner el cuchillo sobre fregadero
¡Naaah!. Prefiero poner el cuchillo en el suelo.

I've tried swapping place between the two syntaxes (so the longer one would become the default), or enclosing within quotes 'sobre de', or individually 'sobre' 'de', but to no avail.

The problem seems that ALAN doesn't expect more than one word (token) between parameters, and if it finds one it considers it to be part of the parameter name (i.e. as if it was an adjective + name). ... @thoni56, any thoughts on this? why it's happening, and if there are possible solutions?

Sorry for not keeping up with the lightning speed you guys keep on the Spanish library ;-) But I'm really happy that is happening.

There is no principal problem with defining those two syntaxes and getting them to work, and your guesses about multiple words in between parameters are incorrect. A simple and clean test with only those syntaxes shows that.

So what I guess is happening here is that "de" is used both as a preposition (a "between parameters" word) and something else, like a synonym or an adjective. An adjective would be my guess since you say "considers it to be part of the parameter name". Some of the combinations of word usages are allowed, some others are prohibited by the compiler.

Since the command interpreter has no backtracking, once it selects one of the usages for a word, it has no way of reverting that.

There is already a request for allowing, and being able to handle, more of these "dual word usages" including some discussion in one of the repositories (failed to find it right now, it should be in the alan-repo...).

tajmone commented 2 years ago

Thanks @thoni56!

There is no principal problem with defining those two syntaxes and getting them to work, and your guesses about multiple words in between parameters are incorrect. A simple and clean test with only those syntaxes shows that.

Then I'll try to find out what's interfering with this. As far as I can remember, there's only 'DES' as SYNONYM of 'DE', and I remember having searched the whole library for occurrences of 'DE' and didn't find anything else. Maybe the problem is in the Vampiro adventure then, which is what I used for testing.

I'll update you on this once I've found out more.

Rich15 commented 2 years ago

SYNTAXes with "de"

There are 8 alternative SYNTAXes, across 3 library modules, for a verb variant with "de":

  1. examinar.i:
    134:   mirar_en = mirar dentro de (obj).
    ...
    155:   buscar = buscar dentro de (obj).
  2. hablar.i:
    121:   hablar_con = hablar con (act) sobre de (tema)!.
  3. poner.i:
    65:   poner_cerca = poner (obj1) cerca de (obj2).
    ...
    72:   poner_detras = poner (obj1) detras de (obj2).
    74:   poner_detras = poner (obj1) tras de (obj2).
    ...
    81:   poner_sobre = poner (obj1) sobre de (obj2).
    ...
    88:   poner_bajo = poner (obj1) debajo de (obj2).

There are two sentences where using "de" is incorrect:

tajmone commented 2 years ago

There are two sentences where using "de" is incorrect:

DONE! I've deleted them in dev_alan-es branch.

The rest are correct, and they wouldn't make sense if "de" was omitted.

So you think that the syntax variations without 'DE' maybe were added in pALANte because the full syntax wasn't working?

I've marked the remaining 'de' syntaxes as requiring to be tested if they work; but if there are verbs where the 'DE' in mandatory, we should also annotate this so that if we manage to solve the problem we can drop the alternative syntaxes without 'DE' — i.e. if these are really bad Spanish, and unless it's an IF custom to support them for the sake of brevity.

E.g. I noticed that for the hablar_con VERB, the main syntax is:

hablar con (act) sobre (tema)!

but that there are also briefer variations:

hablar_con = hablar con (act) (tema)!.
hablar_con = hablar (act) (tema)!.
hablar_con = hablar (act) sobre (tema)!.

I wonder if these are there because they are all acceptable from a linguistic point of view, or whether it's just about supporting shorter versions of the verb for practical reasons, i.e. to allow players less typing during game (which is probably a good thing).

Rich15 commented 2 years ago

So you think that the syntax variations without 'DE' maybe were added in pALANte because the full syntax wasn't working?

I think they are there because they're shorter and allow less typing from the players, even when they wouldn't make sense in a real conversation.

And I want to clarify that I did mark the two SYNTAXes in poner.i and hablar.i (the ones with the extra "de") as incorrect because nobody says those sentences like that, and even if they do (which would not only be wrong, but very weird), they probably would opt for a shorter command (I.e. without "de").

E.g. I noticed that for the hablar_con VERB, the main syntax is:

hablar con (act) sobre (tema)!

but that there are also briefer variations:

hablar_con = hablar con (act) (tema)!.
hablar_con = hablar (act) (tema)!.
hablar_con = hablar (act) sobre (tema)!.

I wonder if these are there because they are all acceptable from a linguistic point of view, or whether it's just about supporting shorter versions of the verb for practical reasons, i.e. to allow players less typing during game (which is probably a good thing).

From a linguistic perspective, they are totally wrong, but as they're probably just shorter commands to make things easier for the player, I think we should keep them.

tajmone commented 2 years ago

From a linguistic perspective, they are totally wrong, but as they're probably just shorter commands to make things easier for the player, I think we should keep them.

I agree. We might want to mark all occurrences of similar shorthand syntaxes (not only for DE, but everywhere) with some standard annotation command (e.g. -- brief malformed. or something like that, just for maintainers' sake),