Skip to content

Commit

Permalink
#96 start adding post and pre reform variants of Portuguese
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnaber committed Apr 21, 2014
1 parent 2720c78 commit f1b5d51
Show file tree
Hide file tree
Showing 11 changed files with 3,715 additions and 3,496 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,6 @@ clearText = Clear Text
ruleDetailsLink = Rule details on community.languagetool.org

addSpaceBetweenSentences = Add a space between sentences

pt-PT-pre-reform = Portuguese (Portugal, pre-reform)
pt-PT-post-reform = Portuguese (Portugal, post-reform)
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,6 @@ clearText = Clear Text
ruleDetailsLink = Rule details on community.languagetool.org

addSpaceBetweenSentences = Add a space between sentences

pt-PT-pre-reform = Portuguese (Portugal, pre-reform)
pt-PT-post-reform = Portuguese (Portugal, post-reform)
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public List<Class<? extends Rule>> getRelevantRules() {
UppercaseSentenceStartRule.class,
WordRepeatRule.class,
WhitespaceRule.class,
SentenceWhitespaceRule.class,
//Specific to Portuguese
PortugueseCompoundRule.class
SentenceWhitespaceRule.class
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* LanguageTool, a natural language style checker
* Copyright (C) 2014 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.language;

import org.languagetool.rules.Rule;
import org.languagetool.rules.pt.PostReformPortugueseCompoundRule;

import java.util.ArrayList;
import java.util.List;

/**
* Post-spelling-reform Portuguese.
* @since 2.6
*/
public class PostReformPortugalPortuguese extends PortugalPortuguese {

@Override
public String getName() {
return "Portuguese (Portugal, post-reform)";
}

@Override
public String getVariant() {
return "post-reform";
}

@Override
public List<Class<? extends Rule>> getRelevantRules() {
final List<Class<? extends Rule>> rules = new ArrayList<>(super.getRelevantRules());
rules.add(PostReformPortugueseCompoundRule.class);
return rules;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* LanguageTool, a natural language style checker
* Copyright (C) 2014 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.language;

import org.languagetool.rules.Rule;
import org.languagetool.rules.pt.PreReformPortugueseCompoundRule;

import java.util.ArrayList;
import java.util.List;

/**
* Pre-spelling-reform Portuguese.
* @since 2.6
*/
public class PreReformPortugalPortuguese extends PortugalPortuguese {

@Override
public String getName() {
return "Portuguese (Portugal, pre-reform)";
}

@Override
public String getVariant() {
return "pre-reform";
}

@Override
public List<Class<? extends Rule>> getRelevantRules() {
final List<Class<? extends Rule>> rules = new ArrayList<>(super.getRelevantRules());
rules.add(PreReformPortugueseCompoundRule.class);
return rules;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
/**
* Checks that compounds (if in the list) are not written as separate words.
*
* @author Daniel Naber
* @deprecated use {@link PreReformPortugueseCompoundRule} or {@link PostReformPortugueseCompoundRule} instead (deprecated sine 2.6)
*/
public class PortugueseCompoundRule extends AbstractCompoundRule {

private static final String FILE_NAME = "/pt/compounds.txt";
private static final String FILE_NAME = "/pt/pre-reform-compounds.txt";

public PortugueseCompoundRule(final ResourceBundle messages) throws IOException {
super(messages, FILE_NAME,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* LanguageTool, a natural language style checker
* Copyright (C) 2006 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.rules.AbstractCompoundRule;

import java.io.IOException;
import java.util.ResourceBundle;

/**
* Checks that compounds (if in the list) are not written as separate words.
* @since 2.6
*/
public class PostReformPortugueseCompoundRule extends AbstractCompoundRule {

private static final String FILE_NAME = "/pt/post-reform-compounds.txt";

public PostReformPortugueseCompoundRule(final ResourceBundle messages) throws IOException {
super(messages, FILE_NAME,
"Esta palavra é hifenizada.",
"Esta palavra é escrita em conjunto.",
"Esta palavra é uma palavra ou com um hífen.");
super.setShort("Juntos grafias de palavras");
}


@Override
public String getId() {
return "PT_COMPOUNDS_PRE_REFORM";
}

@Override
public String getDescription() {
return "Juntos ortografia de palavras, por exemplo 'CD-ROM' em vez de 'CD ROM'";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* LanguageTool, a natural language style checker
* Copyright (C) 2006 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.rules.AbstractCompoundRule;

import java.io.IOException;
import java.util.ResourceBundle;

/**
* Checks that compounds (if in the list) are not written as separate words.
* @since 2.6
*/
public class PreReformPortugueseCompoundRule extends AbstractCompoundRule {

private static final String FILE_NAME = "/pt/pre-reform-compounds.txt";

public PreReformPortugueseCompoundRule(final ResourceBundle messages) throws IOException {
super(messages, FILE_NAME,
"Esta palavra é hifenizada.",
"Esta palavra é escrita em conjunto.",
"Esta palavra é uma palavra ou com um hífen.");
super.setShort("Juntos grafias de palavras");
}


@Override
public String getId() {
return "PT_COMPOUNDS_POST_REFORM";
}

@Override
public String getDescription() {
return "Juntos ortografia de palavras, por exemplo 'CD-ROM' em vez de 'CD ROM'";
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
languageClasses=org.languagetool.language.Portuguese,org.languagetool.language.PortugalPortuguese,org.languagetool.language.BrazilianPortuguese
languageClasses=org.languagetool.language.Portuguese,org.languagetool.language.PortugalPortuguese,org.languagetool.language.PreReformPortugalPortuguese,org.languagetool.language.PostReformPortugalPortuguese,org.languagetool.language.BrazilianPortuguese
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# LanguageTool, a natural language style checker (http://www.languagetool.org)
# Copyright (C) 2005-2014 Daniel Naber (http://www.danielnaber.de)

# Portuguese post-reform compound words that are usually not written as
# separate words.
# Encoding: UTF-8
# All words must contain at least one hyphen, even if the
# word is usually not spelled with a hyphen
# "+" at the end of the line will turn off the suggestion that

# TODO: add words here
Loading

0 comments on commit f1b5d51

Please sign in to comment.