Skip to content

Commit

Permalink
Merge branch 'master' into jdk-21-fix-for-regex
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnaber committed Oct 28, 2024
2 parents 4e83456 + cc3891b commit b259e63
Show file tree
Hide file tree
Showing 928 changed files with 423,925 additions and 504,488 deletions.
4 changes: 4 additions & 0 deletions .circleci.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_API_TOKEN}</password>
</server>
<server>
<id>nvdApiServerId</id>
<password>${env.nvdApiKey}</password>
</server>
</servers>
</settings>
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
security-scan:
resource_class: medium
executor:
name: docker-openjdk11
name: docker-openjdk17
environment:
MAVEN_OPTS: -Xmx3500m
steps:
Expand All @@ -60,7 +60,7 @@ jobs:
test-and-deploy-full:
resource_class: medium+
executor:
name: docker-openjdk11
name: docker-openjdk17
environment:
MAVEN_OPTS: -Xmx3500m
steps:
Expand All @@ -82,7 +82,7 @@ jobs:
test-and-deploy-partial:
resource_class: medium+
executor:
name: docker-openjdk11
name: docker-openjdk17
environment:
MAVEN_OPTS: -Xmx3500m
steps:
Expand Down Expand Up @@ -196,6 +196,6 @@ commands:
command: |
cd $CIRCLE_WORKING_DIRECTORY && .circleci/kick_off_premium.sh
executors:
docker-openjdk11:
docker-openjdk17:
docker:
- image: cimg/openjdk:11.0
- image: cimg/openjdk:17.0
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
.class
.classpath
.idea
.run
.ignore
.project
.settings
.metadata
.vscode/
build
target
target-ide
atomFeedChecksDB
derby.log
.surefire-*
Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Portuguese, Polish, Dutch, and [more than 20 other languages](https://languageto
It finds many errors that a simple spell checker cannot detect.

* **[Jobs at LanguageTool](https://languagetool.org/careers)**
* [LanguageTool Forum](https://forum.languagetool.org)
* [How to run your own LanguageTool server](https://dev.languagetool.org/http-server)
* [HTTP API documentation](https://languagetool.org/http-api/swagger-ui/#!/default/post_check)
* [How to use our public server via HTTP](https://dev.languagetool.org/public-http-api)
Expand Down Expand Up @@ -33,13 +34,13 @@ For more technical details, see [our dev pages](https://dev.languagetool.org).

## Scripted installation and building
To install or build using a script, simply type:
```
```bash
curl -L https://raw.githubusercontent.com/languagetool-org/languagetool/master/install.sh | sudo bash <options>
```

If you wish to have more options, download the `install.sh` script. Usage options follow:

```
```bash
sudo bash install.sh <options>

Usage: install.sh <option> <package>
Expand Down Expand Up @@ -92,10 +93,6 @@ Test the result in `languagetool-standalone/target/`.
Test the result in `languagetool-wikipedia/target`.
./build.sh languagetool-office-extension package -DskipTests

Test the result in `languagetool-office-extension/target`, rename the `*.zip` to `*.oxt` to install it in LibreOffice/OpenOffice.

Now you can use the bleeding edge development copy of LanguageTool `*.jar` files, be aware that it might contain regressions.
Expand Down
2 changes: 1 addition & 1 deletion build-zip.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# fast way to build the ZIP for testing an deployment

mvn -pl '!languagetool-http-client,!languagetool-wikipedia,!languagetool-office-extension,!languagetool-dev' clean package -DskipTests
mvn -pl '!languagetool-http-client,!languagetool-wikipedia,!languagetool-dev' clean package -DskipTests
36 changes: 20 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
#!/bin/bash
#!/usr/bin/env bash

if [ $# -lt 2 ]
then
self=$(basename $0)

if [ $# -lt 2 ]; then
echo "Helps building parts of LanguageTool - for a complete build, run mvn directly"
echo "Usage: `basename $0` <project> <goals...>"
echo "Usage: $self <project> <goals...>"
echo "Examples:"
echo " ./`basename $0` languagetool-standalone clean package (will package the standalone module)"
echo " ./`basename $0` languagetool-standalone clean package -DskipTests (as above but without running tests)"
echo " ./`basename $0` en clean test (will test the English module)"
echo " ./$self languagetool-standalone clean package (will package the standalone module)"
echo " ./$self languagetool-standalone clean package -DskipTests (as above but without running tests)"
echo " ./$self en clean test (will test the English module)"
exit 1
fi

MODULE=$1
module=$1

if [ \! -d $MODULE ]
then
MODULE="languagetool-language-modules/$MODULE"
if [ ! -d $module ]; then
module_path="languagetool-language-modules/$module"
else
module_path="$module"
fi

COMMAND="mvn --projects $MODULE --also-make ${@:2}"
echo "Running: $COMMAND"
command="mvn --projects $module_path --also-make ${@:2}"
echo "Running: $command"

$command
exitcode=$?

$COMMAND
BUILDEXITCODE=$?
# these don't work on their own, so delete them to avoid confusion:
rm languagetool-standalone/target/languagetool-standalone-*.jar 2> /dev/null
rm languagetool-wikipedia/target/languagetool-wikipedia-*.jar 2> /dev/null
rm languagetool-commandline/target/languagetool-commandline-*.jar 2> /dev/null
exit $BUILDEXITCODE

exit $exitcode
2 changes: 0 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ build () {
else
./build.sh languagetool-standalone package
./build.sh languagetool-wikipedia package -DskipTests
./build.sh languagetool-office-extension package -DskipTests
fi
}

Expand All @@ -215,7 +214,6 @@ build_quiet () {
else
./build.sh languagetool-standalone package
./build.sh languagetool-wikipedia package -DskipTests
./build.sh languagetool-office-extension package -DskipTests
fi
}

Expand Down
6 changes: 3 additions & 3 deletions languagetool-client-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
</properties>

<dependencies>
<dependency>
<groupId>org.languagetool</groupId>
<artifactId>language-all</artifactId>
<version>5.9</version>
<version>6.5</version>
</dependency>
<!--
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static void printMatches(List<RuleMatch> ruleMatches,
}
if (verbose && rule instanceof AbstractPatternRule) {
AbstractPatternRule pRule = (AbstractPatternRule) rule;
output += " line=" + pRule.getXmlLineNumber();
output += " (line " + pRule.getXmlLineNumber()+")";
}
System.out.println(output);
String msg = lang.toAdvancedTypography(match.getMessage()); //.replaceAll("<suggestion>", lang.getOpeningDoubleQuote()).replaceAll("</suggestion>", lang.getClosingDoubleQuote())
Expand Down
22 changes: 4 additions & 18 deletions languagetool-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
<dependency>
<groupId>com.hankcs</groupId>
<artifactId>aho-corasick-double-array-trie</artifactId>
Expand All @@ -65,10 +69,6 @@
<groupId>com.optimaize.languagedetector</groupId>
<artifactId>language-detector</artifactId>
</dependency>
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>emoji-java</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
Expand Down Expand Up @@ -315,20 +315,6 @@
</plugins>
</build>
</profile>
<profile>
<id>jdk8</id>
<activation>
<jdk>(,8)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>protoc</id>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ public AnalyzedTokenReadings[] getTokensWithoutWhitespace() {
return nonBlankTokens.clone();
}

/**
* Get the length of the array returned by {@link #getTokensWithoutWhitespace()} without additional allocations.
*/
@ApiStatus.Internal
public int getNonWhitespaceTokenCount() {
return nonBlankTokens.length;
}

/**
* @since 4.5
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,15 @@ public AnalyzedToken readingWithTagRegex(String posTagRegex) {
}
return null;
}

public AnalyzedToken readingWithTagRegex(Pattern pattern) {
for (AnalyzedToken reading : anTokReadings) {
if (reading.getPOSTag() != null && pattern.matcher(reading.getPOSTag()).matches()) {
return reading;
}
}
return null;
}

/**
* Returns the first reading that matches a given lemma.
Expand Down
Loading

0 comments on commit b259e63

Please sign in to comment.