ainslec / adventuron-issue-tracker

Adventuron Issues Tracker
4 stars 0 forks source link

Bug: The use of a preposition in a dialogue moves noun1 into noun2 #149

Open hnejfnvjojgrogjwm opened 4 years ago

hnejfnvjojgrogjwm commented 4 years ago

When typing the Spanish version of: [en] TELL JIM ABOUT CHER [spa] DECIR A JIM SOBRE CHER

Adventuron sorts out each word correctly, so TELL is verb0, JIM noun0, ABOUT (unknown word for Adventuron) verb1 and CHER noun1.

But in Spanish is normal to add a preposition between ABOUT and CHER. It will be kind of equivalent of: [en] TELL JIM ABOUT OF CHER [spa] DECIR A JIM ACERCA DE CHER

In this situation, Adventuron leaves noun1 empty and moves CHER to noun2. Please see the screenshot from the debug attached.

acerca_de

hnejfnvjojgrogjwm commented 3 years ago

This is a tricky one! As I have been investigating this issue, I found new information about its behaviour. For what I know, this issue is no related to the preposition as I thought at first. It depends on a combination of preposition and verb, only when the verb is not defined in the vocabulary.

Please reproduce the code provided and follow the steps to reproduce to better understand this issue.

language=spanish
start_at = my_location

locations{
   my_location : location "You are in a room with Jim." ;
   }

on_command{
   :if (verb0_is "decir" && noun0_is"jim"){
      :gosub"talk_to_jim";}
}

subroutines {
   talk_to_jim:subroutine{
   :match"_ isla"{
      :print"You mentioned the island.";
      :return;}
   :print"Jim doesn't understand.";
   }
}
vocabulary {
   :verb{aliases=[están]}
}

Steps to reproduce: Type the Spanish equivalent of "TELL JIM THEY ARE IN THE ISLAND": [spa] DECIR A JIM ESTÁN EN LA ISLA

Observe the results using the debug. "ISLA" is now noun1 and the message "you mentioned the island" is displayed correctly.

Type the Spanish equivalent of "TELL JIM THEY SLEEP IN THE ISLAND": [spa] DECIR A JIM DUERMEN EN LA ISLA

In this occasion the verb "sleep" (DUERMEN) is no defined in the vocabulary, the noun "isla" is tagged as noun2, while noun1 remains undefined. This time the character doesn't understand what we said.

hnejfnvjojgrogjwm commented 3 years ago

Note: I have fixed this issue in my game just adding the verbs to the vocabulary. So for me it is not a priority any more. But keep and eye on this because it may cause issues for other games or even other languages (I didn't test it in English).

hnejfnvjojgrogjwm commented 3 years ago

Update: I am suffering this issue again, when the parser leaves noun1 empty and sends the only noun in the sentence to noun2, then the "match" command doesn't read the input correctly.

image

Please notice in the screenshot that there are two prepositions, and that is what triggers the bug. This is perfectly correct in Spanish.

Suggested fix: If it is possible, it will be great if Adventuron can check if noun1 = empty & noun2 = "something", then move noun2 to noun1. Right now I can not imagine any sentence in which there is noun2 but not noun1...

Update: I have found a dirty fix. Just changed the first preposition ([es] "acerca" [en] "about") into a verb.

ainslec commented 3 years ago

Hi Ricardo. Sorry this is causing you bother.

For the sample sentence above, it would help if you could translate the full input , and tell me what category of word each word is (without dirty hacks).

hnejfnvjojgrogjwm commented 3 years ago

This is fixed for the game for now, just leaving the preposition "about" uncategorised, so there won't be two prepositions in the sentence. But if you want to keep this in mind for Adventuron 2, I will try to provide more details.

The sentence I used in the last example is: contar a Mehta acerca de profesor The English translation would be: tell to Mehta about of professor In fact, the same type of sentence I gave as an example in the original post (or original bug report) at the top of this page. Investigating a bit about Spanish grammar, I find an interesting thing. "acerca", Spanish version of "about", is not exactly a preposition. It is called "Locución preposicional", "Prepositional phrase" (I don't know if that is the correct translation). It is a word that always goes together with the preposition "de", Spanish version of "of". So, maybe the most correct classification for the parser would be to consider both words as a single preposition. So: preposition1 = "acerca de". Oh my god, language is complicated, isn't?

I have been thinking about how to implement this in game, and I have the simple solution and the more complicated solution.

Simple: do not categorise "acerca" as preposition. And that is what I did. Therefore there are not two prepositions in the sentence.

Complicated: Would be possible to have a list of words in the Spanish vocabulary hardcoded by default? Like giving all the prepositions already categorised? Those things aren't going to change from one adventure to another, as the language is what it is. I mean, each game can use a different vocabulary, but no one is going to change the basic rules of language and the list of prepositions is fixed for Spanish (and probably English too). That can save time and headaches to developers. And if so, can two words ("acerca de") be considered as one preposition? And if so, add adverbs to that pre-set vocabulary too. Those pre-set words would be displayed in the vocabulary when you create a new adventure (so devs are aware of it) and once they are there, you are free to overwrite them if you want. I don't know how does that works in terms of hardcoding... But seriously, as those are the rules of the language, I don't see any situation in which a dev would need to change it. And once a word is correctly classified as a preposition or adverb from the beginning and by default, there is no risk to be wrongly understood by the parser as a noun or a verb in the future. I think this can help to avoid future bugs and I can't imagine any negative side effects.

Just an idea. What do you think?