Spanish: New Grammar Module with Initialization #35
Replies: 7 comments 12 replies
-
@tajmone, after watching the Italian library I think a pretty similar system could be implemented to the Spanish one. Initializing GNA should be a little bit easier because there are no gender considerations for most prepositions (with two exceptions, which I'll list in a moment). I guess some conjunctions should also be included ("and", "to"...). Prepositions gender and numberFrom the prepositions most used (and the ones I remember), only two change depending on gender or number:
I'd want to try and make some test suites, but I'll need your help with the setup and things related to it :) (see my reply in #33). In the meantime, I'll keep looking for translations and orthographic correction in the code. I had a busy weekend so I couldn't review much, but when I have made some more commits I'll start a pull request. |
Beta Was this translation helpful? Give feedback.
-
GNA References in INFSP 6 Sources@Rich15, I've been looking at the sources of the Spanish library for Inform 6, which I also stored on the Wiki for reference. The file that interests us for the sake of the grammar module is Here follow a few selections from that source, with the GNA arrays and the original comments (which are quite useful). Articles
GNA Tables
Pronouns TableThe following table is less clear to me what it's needed for, but I'm including it here anyway.
Of course, these snippets on their own are a bit out of context, but I believe they represent well all the aspects that our initialization code will need to handle. Also, it's important to notice that Inform tries to deduce most of the GNA procedurally, on the fly, whereas in ALAN we'll be assigning all the required references on each and every game instance, at initialization time. So our goal is to be able to determine how to allow author to provide a single descriptor (e.g. the definite article) and be able to derive all other GNA related stuff from that. If the article is not enough, because of some edge cases (e.g. like the above mentioned "aguila" which is feminine even though it takes "el" as article) we can always provide a special reference for that — e.g. in the Italian library I used a pseudo article "l'f" to indicate the feminine variant of the "l'" article, which is masculine. So, there's always an easy workaround to handle exceptions, once the general picture is clear. Now we only need to come up with a way to translated all these grammar rules into ALAN code, and trying to keep it as simple and terse as possible. |
Beta Was this translation helpful? Give feedback.
-
New Grammar Module (DRAFT)@Rich15, I've managed to setup the new Immediate Results!So far, I've only added some extra code to define all Spanish articles as NOISE WORDS (i.e. to be ignored by the parser);
and this single line alone allowed me to safely delete around 100 redundant SYNTAX definition from the library code! (have a look at the branch commits, to see for yourself how a small change can reduce code size) E.g. the pALANte library previously required the following SYNTAX to handle all possible input combinations:
whereas now it's sufficient to write only:
since all articles are stripped away from the player input at parse time. I also believe that now the library can handle properly commands with any articles, whereas before it only understood the "el" article. The next step will be to define all propositions variants as synonyms of their base form (e.g. "del" → "de", etc.) so that SYNTAXes only need to mention one preposition for all genders and numbers, since the parser will translate all variations to the base form during parsing. This will further reduce the number of redundant SYNTAXes in the library, slimming down the code even more. Initialization Code from pALANte LibWhile moving all "grammar related" code to the new module, I discovered that the original pALANte library did contain some sort of initialization code, defined as an EVENT which was supposed to be SCHEDULED for execution in the START section of every adventure (I didn't use it in the test adventures, which is why some GNA might not be showing correctly). Here's the code:
Although the approach I had in mind is a bit different, I'm trying to see if something can be recycled from this EVENT. But first I might need some help from you to understand a couple of things here... The
|
Beta Was this translation helpful? Give feedback.
-
New Initialization Code In Place@Rich15, I've managed to replace in the And I've added the new The original pALANte grammar attributes I've tweaked the Vampiro and the test adventure to adopt the new system, replacing all So far, so good. But of course it's still a draft and there's quite some work left to do, i.e. covering all the various grammar aspects that were not dealt with in the pALANte library. Next StepsHere's a list of things that deserve being looked into:
So @Rich15, I thought you might want to be kept up to date with ongoing work on the new grammar module, and hopefully the above info provides a good status resume. I hope you'll find some time to play around with it and give me some feedback. I'm quite optimistic, in the past weeks the Spanish library has made some huge leaps in terms of improvements and fixes, and it seems that it's going into the right direction — let's just hope there are no big surprises awaiting around the corner (like the parameters bug of #43), you never know. But then, again, it's thanks to new challenges like this non-English library update that many ALAN limits and bugs were discovered and resolved in the past — an aspect of pioneering work which I truly love, because any work that helps a language evolve always carries and added value of merit, beside its own intrinsic value as a final product. |
Beta Was this translation helpful? Give feedback.
-
Hello @tajmone! This last week I couldn't get in the computer because I was feeling pretty bad but finally I'm feeling better. The grammar module is looking really great! You have done an excellent job creating the grammar initialization. I'll soon start testing some things with the already existing adventures. I still have the Noise Words
"él" shouldn't be included in this line, since it isn't an article but a personal pronoun (he). I don't know if any commands use "él" but it's better to take it out of there before a bug pops. pALANte Attributes
|
Beta Was this translation helpful? Give feedback.
-
New Rake Functionality on The Way!@thoni56 and @Rich15, I didn't disappear from the project, it's just that I've been (ans still are) very busy updating the ALAN StdLib repository, where I'm switching the entire toolchain to use only Rake to carry out tasks that before were handled with using Bash, batch and SED scripts. So in the past week I've been working mostly on the custom Rake modules to automate ALAN and AsciiDoc related tasks — modules which are shared among all the ALAN repositories. Therefore, the good news is that once I've finished working on the StdLib repository I'll be updating the Rake modules here too, which will add more features to this repository. The toughest part has been replacing the SED script that sanitizes/converts ARun-generated transcripts into well formed AsciiDoc files. Now the sanitation is done all in Ruby, so there's no need to run Rake in Bash in order to use SED. Also, I've improved the sanitation criteria compared to the previous SED script. Once the Rake modules will be ready, we'll be able to enjoy using dynamically generated ALAN examples in the documentation of the libraries too! This is something which we really need right now, so we can start documenting how the new Spanish grammar module works, but at the same time ensure that all examples in the documentation always mirror the latest library behaviour — which means we'll spot immediately bugs and library breakages, but also that as bugs are being fixed so the documentation will auto-fix itself. I've almost finished handling the Rake switch in StdLib, just need to add one more custom Rake method (sanitation of ALAN sources) and the update all the repository documentation — which I guess is going to take me the whole afternoon, since all the Bash and batch scripts have been deleted, and the new build system needs to be documented from scratch. So, I'll probably won't be able to do any work on the libraries this weekend, but I should be able to update the Rake modules at some point during the week, and then setup a draft documentation for the Spanish library too, as well as start adding dynamic examples to the English documentation. Apart from this, all is well here. |
Beta Was this translation helpful? Give feedback.
-
Lib 0.3.1 — Added Support for Feminine Nouns taking "EL"I've just update the Spanish library with the tweaked grammar module that can now handle feminine nouns requiring the "EL" article. The solution was tested and documented, and seems to work fine, including when there's a preceding adjective and the normal "LA" article needs to be used instead. @Rich15, when you have time please have a look at the updated Spanish documentation and tests, and let me know what you think of this solution. |
Beta Was this translation helpful? Give feedback.
-
@Rich15, as mentioned in other Discussions (#33) I have the impression that the Spanish Foundation Library would greatly benefit from an initialization system that takes care of handling GNA (gender, number, animate/inanimate) by defining for each noun the required elements at initialization time.
I think that what I've done with the Alan3-Italian project (Italian translation of the StdLib 2) would be very close to what is needed here.
You can refer to the
lib_italian.i
module for the full fledged (and commented) code (the Italian Foundation is still in early draft, and haven't ported that code fully yet).If you could study the
lib_italian.i
module it might provide you insight as to whether that would work for Spanish too. The ALAN code should be rather intuitive, and I've added lots of comments and examples, which should make it fairly intuitive to study — also, I think that the Spanish and Italian are similar enough for you to be able to understand all is linguistic references and examples (reading is always easy, the hard part is writing).In any case, I think that the first step would be to move all code that relates to Spanish grammar issues to a dedicated module, e.g.
gramática.i
, so we have all the code in one place, which makes it easier to track what's doing what.(ALAN doesn't impose order specific definitions, e.g. that a class declaration follows its instances, which makes it easy to organize code as one wishes).
Then, the second step will be to create at least one test example which covers all GNA cases (actor, containers, lists, inventories, etc.) so that we have in the repository a reference transcript with correct accordance of GNA. This would allow us to implement the initialization code and track any breaking changes, because any changes in the generated transcript would show up in Git's work area, allowing us to catch any unexpected result in changes diffs.
I can't stress how important it is to have a good test suite, especially before introducing big changes like this, because the transcripts are our means to ensure that the new code will produce the expected output.
In this respect, your help would be invaluable, because you could create one or more small test adventures to cover all the possible gender and number combinations for different game objects, actors, etc., and their test solution script to generate the transcripts — I can do very little here, due to lack of Spanish knowledge.
Solutions/transcripts (
*.a3s
/*.a3t
) can also contain comments (starting with;
), so it's easy to annotate bugs, things to change, etc. Again, I use the; @XXX
notation in transcripts too (e.g.; @BUG
,;@NOTE
, etc.) to make it easy to search for annotation in transcripts throughout the entire repository, at once.I'll now begin studying the Spanish code more closely, and move to a separate grammar module everything that has to do with grammar related definitions. I've also started to collect links to Spanish grammar references and tutorial in English, which I'll be adding to the Wiki, so I can get a clearer picture of what the initialization code should do.
I'll be posting here further considerations, "discoveries", proposal and questions, so we can keep this goal all in one discussion, at least until we've set some clear goals — then we could create a milestone in the Dashboard, with all its sub-tasks as individual Issues to accomplish (probably this change is going to require multiple steps).
Any suggestions in this respect? Questions? Considerations?
Beta Was this translation helpful? Give feedback.
All reactions