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] Revert English corrections #10653

Merged
merged 7 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public List<Rule> getRelevantRules(ResourceBundle messages, UserConfig userConfi
//Specific to Portuguese:
new PostReformPortugueseCompoundRule(messages, this, userConfig),
new PortugueseColourHyphenationRule(messages, this, userConfig),
new PortugueseOrthographyReplaceRule(messages, this),
new PortugueseReplaceRule(messages, this),
new PortugueseBarbarismsRule(messages, "/pt/barbarisms.txt", this),
//new PortugueseArchaismsRule(messages, "/pt/archaisms-pt.txt"), // see https://github.com/languagetool-org/languagetool/issues/3095
Expand Down Expand Up @@ -288,17 +289,23 @@ public Map<String, Integer> getPriorityMap() {

@Override
protected int getPriorityForId(String id) {
// generic spelling rule
if (id.startsWith("MORFOLOGIK_RULE")) {
return -50;
}
if (id.startsWith("AI_PT_GGEC_REPLACEMENT_ORTHOGRAPHY_SPELL")) {
// simple replace spelling rule
if (id.startsWith("PT_SIMPLE_REPLACE_ORTHOGRAPHY")) {
return -49;
}
if (id.startsWith("AI_PT_GGEC_REPLACEMENT_OTHER")) {
return -4;
// AI spelling rule
if (id.startsWith("AI_PT_GGEC_REPLACEMENT_ORTHOGRAPHY_SPELL")) {
return -48;
}
if (id.startsWith("PT_MULTITOKEN_SPELLING")) {
return -49;
return -48;
}
if (id.startsWith("AI_PT_GGEC_REPLACEMENT_OTHER")) {
return -4;
}
// enclitic diacritics always take precedence over pronoun placement
if (id.startsWith("ACENTUAÇÃO_VOGAL_ÊNCLISE")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/* LanguageTool, a natural language style checker
* Copyright (C) 2005-2015 Daniel Naber (http://www.danielnaber.de)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
*/
package org.languagetool.rules.pt;

import org.languagetool.Language;
import org.languagetool.rules.AbstractSimpleReplaceRule;
import org.languagetool.rules.Categories;
import org.languagetool.rules.ITSIssueType;
import org.languagetool.tools.Tools;

import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

import java.net.URL;

/**
* Rule for simple and frequent one-to-one spelling fixes in Portuguese.
*
* @author p-goulart
*/
public class PortugueseOrthographyReplaceRule extends AbstractSimpleReplaceRule {

public static final String PORTUGUESE_SIMPLE_REPLACE_ORTHOGRAPHY_RULE = "PT_SIMPLE_REPLACE_ORTHOGRAPHY";

private static final Map<String, List<String>> wrongWords = loadFromPath("/pt/replace_orthography.txt");
private static final Locale PT_LOCALE = new Locale("pt");

@Override
public Map<String, List<String>> getWrongWords() {
return wrongWords;
}

public PortugueseOrthographyReplaceRule(ResourceBundle messages, Language language) {
super(messages, language);
super.setCategory(Categories.TYPOS.getCategory(messages));
setLocQualityIssueType(ITSIssueType.Misspelling);
useSubRuleSpecificIds();
}

@Override
public String getId() {
return PORTUGUESE_SIMPLE_REPLACE_ORTHOGRAPHY_RULE;
}

@Override
public boolean isCaseSensitive() {
return false;
}

@Override
public Locale getLocale() {
return PT_LOCALE;
}

@Override
public String getDescription() {
return messages.getString("desc_spelling");
}

@Override
public String getShort() {
return messages.getString("desc_spelling_short");
}

@Override
public String getMessage(String token, List<String> replacements) {
return messages.getString("spelling");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3530,6 +3530,13 @@
</pattern>
<disambig action="ignore_spelling"/>
</rule>

<rule id="IGNORE_SPELLING_RS_LAUGHTER">
<pattern>
<token regexp="yes">(rs){2,15}</token>
</pattern>
<disambig action="ignore_spelling"/>
</rule>
</rulegroup>

<rulegroup name="Add interjection tag to common laughter onomatopoeia" id="INTERJ_LAUGHTER">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- copied from French -->
<!ENTITY english_no "nos?|as?|tos?|dos?|vi|pela">
<!ENTITY english_no "nos?|as?|tos?|dos?|vi|pela|favor|por">

<!ENTITY english_wh_words "what|when|where|whom?|whose|why|how|which">
<!ENTITY english_prepositions "in|on|after|behind|before|off?|from|with|without|
Expand Down Expand Up @@ -34,7 +34,7 @@
during|going|such|many|then|year|became|later|well|including|area|both|make|name|
called|until|while|against|may|number|season|several|team|work|born|
early|family|now|based|life|released|since|began|century|each|end|
following|found|located|town|around|day|government|named|
following|found|located|town|around|government|named|
often|three|too|up|along|built|career|include|left|own|still|
took|held|last|members|much|than|within|another|company|death|
down|even|five|however|published|received|served|become|best|died|history|
Expand All @@ -56,7 +56,7 @@
success|successful|track|units|white|added|attack|below|brought|census|changed|
county|decided|ever|fact|generally|hand|households|instead|introduced|least|
mid|mother|outside|private|professional|provide|provided|saw|seven|soon|space|
study|systems|teams|thus|women|september|allowed|battle|beginning|
study|systems?|teams|thus|women|september|allowed|battle|beginning|
books|director|eight|female|find|ground|higher|industry|interest|
league|lived|market|night|owned|placed|previous|primary|reached|related|
reported|runs|strong|winning|august|january|july|march|always|approximately|
Expand Down Expand Up @@ -106,7 +106,7 @@
agreement|allowing|applied|attacks|ball|bank|birth|claim|compared|
conducted|connected|critical|dead|designated|develop|enemy|
entitled|estate|estimated|existing|expanded|expected|fellow|fighting|
floor|follow|forward|founder|fully|goes|granted|hands|hour|
floor|follow|forward|founder|fully?|goes|granted|hands|hour|
ice|leaves|literature|necessary|newly|occupied|occur|occurred|
oldest|organizations|organized|owner|paid|parish|powers|promoted|providing|
read|receive|reduced|refers|refused|respectively|say|settled|settlement|
Expand Down Expand Up @@ -162,7 +162,7 @@
benefit|bird|borders|boundary|bringing|broad|changing|coastal|cold|
concerns|concluded|constituency|continuing|counties|coverage|covering|
crisis|criticized|dating|declined|distinguished|dog|dominated|earth|
easy|edited|engineer|enjoyed|entering|extent|favor|feel|finding|flows|
easy|edited|engineer|enjoyed|entering|extent|feel|finding|flows|
formally|happened|historian|hundreds|investment|kingdom|lasted|
learn|leg|longest|manufacturing|measures|medicine|mining|missing|
mounted|mouth|movements|musician|narrow|ownership|painted|paintings|
Expand All @@ -175,7 +175,7 @@
advertising|animated|anyone|appeal|apply|appointment|artillery|
asks|assault|assembly|attributed|benefits|blocks|buy|championships|
chapter|circumstances|claiming|closer|colony|colors|continuous|corporate|
crowd|crown|customers|dated|daughters|debuted|defeating|departure|
crowd|crown|customers?|dated|daughters|debuted|defeating|departure|
destroy|detailed|drawing|drugs|electrical|eleven|else|encouraged|
essentially|everyone|evil|expensive|facing|fighter|generated|governments|
identical|infantry|integrated|journey|junction|latest|lawyer|
Expand All @@ -200,7 +200,13 @@
spending|spoke|stream|studying|submarine|sufficient|suggest|suitable|
supposed|surgery|survey|swimming|team's|anyway|anyhow|anywhere|
somewhere|somebody|somehow|whatever|whoever|whosever|whomever|
whichever|whenever|wherever|however|art|miss|mister
whichever|whenever|wherever|however|miss|mister|whats|theyre|
weve|theyve|shes|im|Im|youre|whos|wouldve|couldve|whens|wheres|hows|
dictionary|cards?|services?|kids?|groups?|skills?|news?|news?|
tomorrow|yesterday|(sun|mon|tues|wednes|thurs|fri|satur)?days?|
thanks?|welcome|black|yellow|orange|green|purple|gr[ae]y|blue|express|
coffee|academy|gold|golden|tech|clean|dirty|users?|sellers?|buyers?|
release|headlines?|points?|transfers?|foot|feet
">

<!ENTITY english_common "&english_wh_words;|&english_prepositions;|&english_adverbs;|&english_pronouns;|&english_determiners;|&english_common_verbs;|&english_conjunctions;|&english_word_list;|&english_suffixed_word;">
Original file line number Diff line number Diff line change
Expand Up @@ -12044,4 +12044,9 @@ touch screens NCFP000_
José Luiz NPMSS00_
Sofia Kovalevskaya NPFSS00_
Maya Plisetskaia NPFSS00_
Campos Elísios NPMP000
Campos Elísios NPMP000

QR code NCMS000_
QR codes NCMP000_
code review NCCS000_
code reviews NCCP000_
Loading
Loading