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

Support Java9 Platform Module System(JPMS) #9406

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.apache.commons.io.input.BOMInputStream;
import org.languagetool.*;
import org.languagetool.bitext.TabBitextReader;
import org.languagetool.language.*;
import org.languagetool.language.en.AmericanEnglish;
import org.languagetool.language.en.English;
import org.languagetool.language.identifier.LanguageIdentifier;
import org.languagetool.language.identifier.LanguageIdentifierService;
import org.languagetool.rules.Rule;
Expand Down
1 change: 1 addition & 0 deletions languagetool-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
<manifestEntries>
<ComponentVersion>${project.version}</ComponentVersion>
<Implementation-Date>${maven.build.timestamp}</Implementation-Date>
<Automatic-Module-Name>org.languagetool.core</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,21 @@ private static Language createLanguageObjects(URL url, String className) {

static boolean hasPremium(String className) {
return className.matches("org\\.languagetool\\.language\\.(" +
"pt\\.Portuguese|pt\\.AngolaPortuguese|pt\\.BrazilianPortuguese|pt\\.MozambiquePortuguese|pt\\.PortugalPortuguese|" +
"Portuguese|AngolaPortuguese|BrazilianPortuguese|MozambiquePortuguese|PortugalPortuguese|" +
"de\\.German|de\\.GermanyGerman|de\\.AustrianGerman|de\\.SwissGerman|" +
"German|GermanyGerman|AustrianGerman|SwissGerman|" +
"nl\\.Dutch|fr\\.French|es\\.Spanish|" +
"Dutch|French|Spanish|" +
"en\\.English|en\\.AustralianEnglish|en\\.AmericanEnglish|en\\.BritishEnglish|en\\.CanadianEnglish|en\\.NewZealandEnglish|en\\.SouthAfricanEnglish" +
"English|AustralianEnglish|AmericanEnglish|BritishEnglish|CanadianEnglish|NewZealandEnglish|SouthAfricanEnglish" +
")");
}

/**
* Get the Language object for the given language class name or try to create it and add to dynamic languages.
*
* @param className e.g. <code>org.languagetool.language.English</code>
* @param className e.g. <code>org.languagetool.language.en.English</code>
* @return a Language object
* @throws RuntimeException if language not found in classpath
* @since 5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public Contributor(String name, String url) {
public Contributor(String name) {
this(name, null);
}

public String getName() {
return name;
}

public String getUrl() {
return url;
}
Expand All @@ -53,5 +53,4 @@ public String getUrl() {
public String toString() {
return name;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ protected void runTests(Language lang, String onlyRunCode, String additionalVali
testNoQuotesAroundSuggestion(lang);
testJavaRules(onlyRunCode);
//testExampleAvailable(onlyRunCode);
testConfusionSetLoading();
testConfusionSetLoading(onlyRunCode);
countTempOffRules(lang);
testCoherencyBaseformIsOtherForm(lang);
testReplaceRuleReplacements(lang);
try {
new DisambiguationRuleTest().testDisambiguationRulesFromXML();
new DisambiguationRuleTest().testDisambiguationRulesFromXMLAndSpecificLanguage(onlyRunCode);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -218,7 +218,8 @@ private void testJavaRules(String onlyRunCode) throws IOException {
float printLimitSeconds = 0.2f;
for (Language language : Languages.getWithDemoLanguage()) {
if (onlyRunCode != null && !language.getShortCodeWithCountryAndVariant().equals(onlyRunCode)) {
System.out.println("Skipping " + language); // speed up for languages that are sub classes (e.g. simple German)
// System.out.println("Skipping " + language);
// speed up for languages that are sub classes (e.g. simple German)
continue;
}
System.out.println("Running for " + language + ", printing only tests that take > " + printLimitSeconds + " seconds:");
Expand All @@ -244,8 +245,12 @@ private void testJavaRules(String onlyRunCode) throws IOException {
}
}

private void testConfusionSetLoading() {
private void testConfusionSetLoading(String onlyRunCode) {
for (Language language : Languages.get()) {
if (onlyRunCode != null && !language.getShortCodeWithCountryAndVariant().equals(onlyRunCode)) {
continue;
}
System.out.println("Running " + language);
try {
List<Rule> rules = language.getRelevantLanguageModelRules(JLanguageTool.getMessageBundle(), new FakeLanguageModel(), null);
if (rules.size() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -56,6 +57,18 @@ public void testDisambiguationRulesFromXML() throws Exception {
testDisambiguationRulesFromXML(null);
}

public void testDisambiguationRulesFromXMLAndSpecificLanguage(String onlyRunCode) throws Exception {
Set<Language> ignoredLanguages = new HashSet<>();
if (onlyRunCode != null) {
for (Language lang : Languages.getWithDemoLanguage()) {
if (!lang.getShortCodeWithCountryAndVariant().contains(onlyRunCode)) {
ignoredLanguages.add(lang);
}
}
}
testDisambiguationRulesFromXML(ignoredLanguages);
}

private void testDisambiguationRulesFromXML(Set<Language> ignoredLanguages)
throws IOException, ParserConfigurationException, SAXException {
for (Language lang : Languages.getWithDemoLanguage()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.languagetool.dev;

import org.languagetool.JLanguageTool;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.de.GermanyGerman;
import org.languagetool.rules.Rule;
import org.languagetool.rules.de.GermanSpellerRule;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.languagetool.dev;

import org.languagetool.AnalyzedToken;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.de.GermanyGerman;
import org.languagetool.synthesis.Synthesizer;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import de.danielnaber.jwordsplitter.GermanWordSplitter;
import org.languagetool.AnalyzedTokenReadings;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.de.GermanyGerman;
import org.languagetool.tagging.Tagger;
import org.languagetool.tools.StringTools;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import de.danielnaber.jwordsplitter.GermanWordSplitter;
import org.languagetool.JLanguageTool;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.de.GermanyGerman;
import org.languagetool.rules.de.GermanSpellerRule;
import org.languagetool.tools.StringTools;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.languagetool.dev;

import org.languagetool.JLanguageTool;
import org.languagetool.language.AmericanEnglish;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.en.AmericanEnglish;
import org.languagetool.language.de.GermanyGerman;
import org.languagetool.rules.de.GermanSpellerRule;
import org.languagetool.rules.en.MorfologikAmericanSpellerRule;
import org.languagetool.tagging.de.GermanTagger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.commons.lang3.StringUtils;
import org.languagetool.*;
import org.languagetool.broker.ResourceDataBroker;
import org.languagetool.language.AmericanEnglish;
import org.languagetool.language.en.AmericanEnglish;
import org.languagetool.language.Contributor;
import org.languagetool.rules.ConfusionSetLoader;
import org.languagetool.rules.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import org.languagetool.AnalyzedTokenReadings;
import org.languagetool.JLanguageTool;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.de.GermanyGerman;
import org.languagetool.tagging.Tagger;
import org.languagetool.tools.StringTools;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.languagetool.JLanguageTool;
import org.languagetool.Language;
import org.languagetool.Languages;
//import org.languagetool.language.English;
//import org.languagetool.language.en.English;
import org.languagetool.rules.Rule;
import org.languagetool.rules.patterns.PatternRule;
import org.languagetool.rules.patterns.PatternToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.languagetool.chunking.Chunker;
import org.languagetool.dev.dumpcheck.*;
import org.languagetool.dev.eval.FMeasure;
import org.languagetool.language.English;
import org.languagetool.language.en.English;
import org.languagetool.languagemodel.LanguageModel;
import org.languagetool.languagemodel.LuceneLanguageModel;
import org.languagetool.rules.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.languagetool.dev.bigdata;

import org.languagetool.AnalyzedToken;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.de.GermanyGerman;
import org.languagetool.languagemodel.LuceneLanguageModel;
import org.languagetool.synthesis.Synthesizer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.languagetool.dev.bigdata;

import org.languagetool.JLanguageTool;
import org.languagetool.language.AmericanEnglish;
import org.languagetool.language.en.AmericanEnglish;
import org.languagetool.rules.ConfusionPair;
import org.languagetool.rules.ConfusionSetLoader;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.languagetool.JLanguageTool;
import org.languagetool.Language;
import org.languagetool.Languages;
import org.languagetool.language.AmericanEnglish;
import org.languagetool.language.en.AmericanEnglish;
import org.languagetool.rules.ConfusionSetLoader;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import org.languagetool.JLanguageTool;
import org.languagetool.commandline.CommandLineTools;
import org.languagetool.language.English;
import org.languagetool.language.en.English;
import org.languagetool.tokenizers.Tokenizer;
import org.languagetool.tools.StringTools;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package org.languagetool.dev.eval;

import org.languagetool.JLanguageTool;
import org.languagetool.language.BritishEnglish;
import org.languagetool.language.English;
import org.languagetool.language.en.BritishEnglish;
import org.languagetool.language.en.English;
import org.languagetool.languagemodel.LanguageModel;
import org.languagetool.languagemodel.LuceneLanguageModel;
import org.languagetool.markup.AnnotatedText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
import org.apache.commons.io.IOUtils;
import org.languagetool.JLanguageTool;
import org.languagetool.Language;
import org.languagetool.language.AmericanEnglish;
import org.languagetool.language.BritishEnglish;
import org.languagetool.language.English;
import org.languagetool.language.en.AmericanEnglish;
import org.languagetool.language.en.BritishEnglish;
import org.languagetool.languagemodel.LanguageModel;
import org.languagetool.languagemodel.LuceneLanguageModel;
import org.languagetool.rules.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.languagetool.dev.errorcorpus.ErrorCorpus;
import org.languagetool.dev.errorcorpus.ErrorSentence;
import org.languagetool.dev.errorcorpus.SimpleCorpus;
import org.languagetool.language.English;
import org.languagetool.language.en.English;
import org.languagetool.languagemodel.LanguageModel;
import org.languagetool.languagemodel.LuceneLanguageModel;
import org.languagetool.languagemodel.LuceneSingleIndexLanguageModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.commons.io.FileUtils;
import org.junit.Ignore;
import org.junit.Test;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.de.GermanyGerman;

public class CommonCrawlToNgramTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.junit.Test;
import org.languagetool.AnalyzedSentence;
import org.languagetool.JLanguageTool;
import org.languagetool.language.English;
import org.languagetool.language.en.English;

import java.io.IOException;
import java.util.List;
Expand Down
11 changes: 11 additions & 0 deletions languagetool-language-modules/ar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>org.languagetool.language.ar</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
*/
package org.languagetool.language;
package org.languagetool.language.ar;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.languagetool.Language;
import org.languagetool.LanguageMaintainedState;
import org.languagetool.UserConfig;
import org.languagetool.language.Contributor;
import org.languagetool.languagemodel.LanguageModel;
import org.languagetool.rules.*;
import org.languagetool.rules.ar.*;
Expand Down Expand Up @@ -96,8 +97,8 @@ public Synthesizer createDefaultSynthesizer() {
@Override
public Contributor[] getMaintainers() {
return new Contributor[]{
new Contributor("Taha Zerrouki"),
new Contributor("Sohaib Afifi")
new Contributor("Taha Zerrouki", null),
new Contributor("Sohaib Afifi", null)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
package org.languagetool.rules.ar;

import org.languagetool.language.Arabic;
import org.languagetool.language.ar.Arabic;
import org.languagetool.rules.AbstractSimpleReplaceRule2;
import org.languagetool.rules.Categories;
import org.languagetool.rules.Example;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
package org.languagetool.rules.ar;

import org.languagetool.language.Arabic;
import org.languagetool.language.ar.Arabic;
import org.languagetool.rules.AbstractSimpleReplaceRule2;
import org.languagetool.rules.Categories;
import org.languagetool.rules.Example;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
package org.languagetool.rules.ar;

import org.languagetool.language.Arabic;
import org.languagetool.language.ar.Arabic;
import org.languagetool.rules.AbstractSimpleReplaceRule2;
import org.languagetool.rules.Categories;
import org.languagetool.rules.Example;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.jetbrains.annotations.NotNull;
import org.languagetool.UserConfig;
import org.languagetool.language.Arabic;
import org.languagetool.language.ar.Arabic;
import org.languagetool.rules.spelling.hunspell.HunspellRule;
import org.languagetool.tools.ArabicStringTools;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.languagetool.AnalyzedSentence;
import org.languagetool.AnalyzedToken;
import org.languagetool.AnalyzedTokenReadings;
import org.languagetool.language.Arabic;
import org.languagetool.language.ar.Arabic;
import org.languagetool.rules.*;
import org.languagetool.synthesis.ar.ArabicSynthesizer;
import org.languagetool.tagging.ar.ArabicTagger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
package org.languagetool.rules.ar;

import org.languagetool.language.Arabic;
import org.languagetool.language.ar.Arabic;
import org.languagetool.rules.AbstractSimpleReplaceRule2;
import org.languagetool.rules.Categories;
import org.languagetool.rules.Example;
Expand Down
Loading