Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Draft - Lingua::ES::Conjugate

by dHarry (Abbot)
on Dec 19, 2011 at 13:33 UTC ( #944243=note: print w/ replies, xml ) Need Help??


in reply to Draft - Lingua::ES::Conjugate

¡Hola Ea!

There are a lot more tenses in Spanish than the ones you mention:) Check for example: Wordreference (the one stop solution for this humble student of Castellano). You only posted a snippet of code, I went through it on github though.

I would probably have implemented it differently. I think I would have chopped up all different tenses in categories, e.g.

  • Indicativo (presente, imperfecto, pretérito, futuro, condicional)
  • Tiempos compuestos (pretérito perfecto, pluscuamperfecto, futuro perfecto, condicional perfecto)
  • Subjuntivo (presente, imperfecto, futuro)
  • Imperativo (afirmativo, negativo)
and use commonalities per category. NB there are even more tenses;)

Also with respect to irregular verbs there is also a lot of structure, e.g. types of irregularity. Furthermore sometimes verbs are only irregular in some person and/or in some tense(s). I think you can make use of this structure.

All in all you need about 90 ways of conjugating to cover close to a 100% of the verbs (based on the examples in my Spanish dictionary).

un abrazo

Harry


Comment on Re: Draft - Lingua::ES::Conjugate
Re^2: Draft - Lingua::ES::Conjugate
by Ea (Friar) on Dec 19, 2011 at 15:34 UTC

    Gracias, Harry

    I like treeware myself. This site only displays the first lines of code and provides a download link at the end of the code section to improve readability. I've got a good idea of all the verbs required, just not enough energy to finish it at the moment. The compound tenses are the ones that are bugging me a bit. I had hoped that all I would have to do is to run the auxiliary verb "haber" through the conjugate method and then add on the past participle, but the tail end of the conjugate sub makes that an ugly modification.

    Currently, it's

    my $verb_class = get_class($conj); my $stem = get_stem($conj); my $ending = $endings->{$conj->{tense}}->{$verb_class}->[ _get_end +ing_index($conj) ] or carp "No ending found for $conj->{tense} tense +of $conj->{verb} in conjugate( @_ )\n"; if ( my $pronoun = is_reflexive($conj) ) { # commands and infinitives can have the pronoun afterwards, wh +ich changes the accenting return "$pronoun $stem$ending"; } return $stem . $ending;

    The irregular verbs are being handled by hashes that hold the special cases which weren't as bad as I'd expected. The imperfect, future and conditional are finished as are the regular forms of the present, preterite and subjunctives. There are a dozen classes of spelling changes which need to be handled and I've glossed over the imperative. As I'm only conjugating verbs for now, I'm not considering object pronouns which can get caught up between the verbs or stuck on the end. Just trying to keep it simple.

    I do wonder why this hasn't been written before now. It isn't that hard and should have some uses. Essentially, it's the reverse of Lingua::StopWords for Spanish verbs. Personally, I could see this in the backend of a quiz site or app. Any thoughts on where you'd think it would be useful?

    Que vayas bien,
    Boyd

      Any thoughts on where you'd think it would be useful?

      I can see it go into a website to learn Spanish, maybe complemented by:

      • A dictionary
      • Common usage of the verbs
      I can also see it acting as a building block for other applications, e.g. generating sentences, validating sentences etc.

Re^2: Draft - Lingua::ES::Conjugate
by Anonymous Monk on Jan 03, 2012 at 17:20 UTC
    As a former native Spaniard, i can assure you this:
    Indicativo (presente, imperfecto, pretérito, futuro, condicional)
    Tiempos compuestos (pretérito perfecto, pluscuamperfecto, futuro perfecto, condicional perfecto)
    Subjuntivo (presente, imperfecto, futuro)
    Imperativo (afirmativo, negativo)


    It's just to make it sound as we have some sort of "lexical rules" or "coherent structures", as well as the accented words, plus middle H usage, v or b, y or LL, etc...

    We can just survive a whole life with the basic verbs and about 100 words...

    Don't be fooled by the Real Academia Española, we send there all the elder writers/bookworms to have them busy over "language quality", to prevent them from raving at wild 60+ parties over Benidorm! (tourists could not follow their rythm overnight and fainted, increasing national healthcare costs).

    Remember, never try to follow the lead of a Spaniard on a party, no matter how old he/she is, he/she is being training hard since chilhood!... You won't ever know what hit you!! =8-P

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://944243]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-08-27 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (237 votes), past polls