Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pt] LanguageTool doesn't detect the need of crasis in sentence #3709

Open
hmslima opened this issue Oct 16, 2020 · 2 comments
Open

[pt] LanguageTool doesn't detect the need of crasis in sentence #3709

hmslima opened this issue Oct 16, 2020 · 2 comments

Comments

@hmslima
Copy link

hmslima commented Oct 16, 2020

Here is the sentence:

Um policial a paisana trocou tiros com três homens que tentavam roubar um banco.

It should be:

Um policial à paisana trocou tiros com três homens que tentavam roubar um banco.

For those who don't know Portuguese, the crasis "à" is a contraction between the preposition "a" (that means "to" or "at") and the feminine definite article "a".

Anyway, even if a crasis doesn't apply here, LT should notice that something is strange since there is a possible definite article ("a") just after a name ("policial") but nothing between them. The following four sentences below are correct:

Exposta, a polícia - The police is exposed
Exposta à polícia - She is exposed to the police
Glória, a rainha - Glória the queen
Glória à rainha - Glory to the queen

However, the following two sentences below are wrong, but LT doesn't detect any error.

Exposta a polícia
Glória a rainha

@marcoagpinto
Copy link
Member

Yes, @jaumeortola said I need to create a list of words with crasis by hand.

It is in my TO-DO list.

@hmslima
Copy link
Author

hmslima commented Oct 17, 2020

@marcoagpinto

Yes, jaumeortola said I need to create a list of words with crasis by hand.

I don't know how do you guys work with LanguageTool's code, but if you allow me, I have some pseudo-codes for you.

By the way, I am using the grammar "A gramática para concursos públicos" by Fernando Pestana (most of the examples and explanations that I will use are from his grammar). It's a grammar for Brazilian Portuguese, I don't know how much it's different from European Portuguese.





If LT sees some structure like ((noun OR adjective) + "a" + (noun OR adjective)) you already can say that something is wrong. For example, "Glória a rainha" can be corrected to "Glória , a rainha" or "Glória à rainha".

Other example:

Comi uma caça a espanhola anteontem

Since there is an indefinite article before "caça", LT can easily know that "caça" is a noun instead a conjugation of the verb "caçar". Even if LT doesn't know about prepositional phrases, the software can detect that there is something wrong here – rememeber the ((noun OR adjective) + "a" + (noun OR adjective)) "rule" –, so it can suggest the following sentences:

(1) Comi uma caça, a espanhola anteontem

(2) Comi uma caça à espanhola anteontem

The sentence (1) is strange, but we expect that the user will be able to choose the correct sentence.



LT surely already knows the gender of the nouns, so you can make the rule that the crasis cannot be used before masculine nouns (so you don't need to inform noun by noun, the software should be able to handle with it by itself). The crasis is not applicable to the sentence just below because the nouns are masculine:

Andou a cavalo pela cidadezinha, mas preferiria ter andado a

Now you only need to worry with the exceptions, that are the feminine words "casa" and "terra":

Fui a casa resolver um problema

Os marinheiros retornaram a terra

But these exceptions have an exception, you must use the crasis if these words are accompanied by adjective or phrase with value of adjective (actually, anything that modifies the noun if I am not mistaken):

Fui à casa dela resolver um problema

Os marinheiros retornaram à terra natal

Here is my pseudo-code

if ((indirect_transitive_verb OR word_that_requires_preposition) + feminine_noun)
{
    if (indirect_transitive_verb_has_no_preposition)
    {
        message("Verbo ", indirect_transitive_verb, " exige uma preposição");
    }
    else
    {
        // Do nothing
    }
}
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a" + feminine_noun)
{
    if (feminine_noun != "casa" AND feminine_noun != "terra")
    {
        message ("Se ", feminine_noun, " não é um substantivo generalista, provavelmente uma crase é necessária.");
    }
    else if ((feminine_noun == "casa" OR feminine_noun == "terra") + modifier_of_the_feminine_noun)
    {
        message ("Provavelmente esta frase necessita de uma crase.");
    }
    else
    {
        // Do nothing
    }
}


I believe that the list of words that you need to make manually is a list of verbs, am I right? Because seems to me that LT can detect the gender of the Portuguese noun.

Does LT can determine whether a Portuguese verb is intransitive, direct transitive or indirect transitive?

Conheço a aluna.

Refiro-me à aluna.

"Conheço a aluna" doesn't have crasis because "conhecer" is a direct transitive verb while "Refiro-me à aluna" has crasis because "referir" is an indirect transitive verb.



It's very difficult (if it's not impossible) to LT know if it's dealing with a general noun (that does'n receive crasis) or a defined noun (that receives crasis). So it's better if LT treat this case like the crasis is optional here (actually it's not optional, the rules are clear! But it's difficult to teach a software to know the difference...). The following two sentences are correct, the difference is that the nouns in the first one have general meaning while the nouns in the second sentence are individualized.

Não foi feita menção a mulher, nem a criança, tampouco a homem

Não foi feita menção à mulher, nem à criança, tampouco ao homem



From now, I will talk only about more cases where the crasis is prohibited. I don't tell about other obligatory cases because I don't know how would you teach LT how to detect adjective/adverbial/conjunctive/prepositional "locuções", although the ((noun OR adjective OR pronoun) + "a" + (noun OR adjective OR pronoun)) "rule" can accidentally detect a lot of these "locuções". Also, I won't talk about the facultative cases because I don't think it's necessary to LT and only would make thing more complex than they already are.



There is no crasis before the indefinite article "uma":

Iremos a uma reunião muito importante no domingo

However, there is an exception, before a numeral showing time, you must use crasis

Chegarei à uma (hora)

[...] // It represents the pseudo-code that I showed you before
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a uma" + feminine_noun)
{
    there_is_no_crasis_in_this_case ();
}
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a uma" + ("hora" OR end_of_phrase))
{
    there_must_be_a_crasis_here ();
}
else
{
    // Do nothing
}


There is no crasis before names of saints or famous women:

Tenho devoção a Santa Maria Madalena.

Muito devemos a Teresa de Calcutá.

Dirigiu-se a santa Rita em oração com fervor

But Pestana says that the crasis is mandatory in "Tenho devoção à Virgem" because the definite article can appear because fo intentional/emotional/stylistic reasons, therefore, if we want to be close to such historic figures, treating them with affection, the use of article is not wrong.

[...] // Know that this "[...]" represents all the code that I am accumulating from previous pseudo-codes
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a" + ("santa" OR list_of_names_of_female_saints_or_historic_feminine_figures))
{
    if ("devoção a Virgem")
    {
        there_must_be_a_crasis_here ();
    }
    else
    {
        there_is_no_crasis_in_this_case ();
    }
}


There is no crasis before personal pronouns, interrogative pronouns, undefined pronouns, demonstrative pronouns and relative pronouns.

Fizemos referência a Vossa Excelência, não a ela.

A quem vocês se reportaram no Plenário?

Assisto a toda peça de teatro no RJ, afinal, sou um crítico.

Entreguei o livro a esta editora, mas ela desprezou a obra.

A atriz brasileira a cuja peça aludi já ganhou dois prêmios internacionais.

But of course that there are exceptions... you can use crasis before:

  • form of address (senhora, senhorita, dona, dama, madame, doutora, etc)

Destes teu coração à senhorita, e, ainda assim, ela te ignoraste?

  • some undefined pronouns ("pouca(s)", "muitas", "demais", "outra(s)" and "várias")

De uma geração à outra, tudo pode mudar

  • some demonstrative pronouns ("aquele(a/s)", "aquilo", "mesma(s)", "própria(s)" and "tal")

Dedicou-se à própria vida, esquecendo as outras pessoas que o rodeavam.

  • the relative pronoun "a qual"

A fórmula à qual a economia brasileira está subordinada não passa de uma regra básica.

[...]
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a" + undefined_pronoun)
{
    if (undefined_pronoun == ("pouca(s)" OR "muitas" OR "demais" OR "outra(s)" OR "várias))
    {
        there_must_be_a_crasis_here ();
    }
    else
    {
        there_is_no_crasis_in_this_case ();
    }
}
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a" + demonstrative_pronoun)
{
    if (demonstrative_pronoun == ("aquele(a/s)", "aquilo", "mesma(s)", "própria(s)" and "tal"))
    {
        there_must_be_a_crasis_here ();
    }
    else
    {
        there_is_no_crasis_in_this_case ();
    }
}
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a" + relative_pronoun)
{
    if (relative_pronoun == ("a qual"))
    {
        there_must_be_a_crasis_here ();
    }
    else
    {
        there_is_no_crasis_in_this_case ();
    }
}


There is no crasis before a verb in the infinitive

A partir de hoje serei um pai melhor, pois voltei a trabalhar

Blusas a partir de R19,90

[...]
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a" + infinitive_verb)
{
    there_is_no_crasis_in_this_case ();
}


There is no crasis after any preposition

Fui para a Rússia

[...]
else if (preposition + "a" + feminine_noun)
{
    there_is_no_crasis_in_this_case ();
}


There is no crasis between repeated words that form a phrase

Quero que você fique cara a cara e diga a verdade.

Nosso dia a dia nunca mais foi o mesmo após o furacão.

[...]
else if ((feminine_noun1 + "a" + feminine_noun2) AND (feminine_noun1 == feminine_noun2))
{
    there_is_no_crasis_in_this_case ();
}


There is no crasis before expressions substantived sentences

O conectivo “se” às vezes equivale a “já que”

[...]
else if ((indirect_transitive_verb OR word_that_requires_preposition) + "a" + quotation_mark + more_than_one_word + quotation_mark)
{
    there_is_no_crasis_in_this_case ();
}




Of course that there are more information to be taken into account and my pseudocode surely has a lot of flaws, but I do think that it's a good start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants