Skip to content

Commit

Permalink
OPENNLP-1557 - Create Model Jars on-the-fly (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzo1 authored May 27, 2024
1 parent 9a29e9c commit 6af838c
Show file tree
Hide file tree
Showing 21 changed files with 850 additions and 7 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Java CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
- name: Build with Maven
run: mvn -V clean install --no-transfer-progress
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ nbactions.xml
nb-configuration.xml
*.DS_Store
.checkstyle
*.bin
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ compile group: "org.apache.opennlp", name: "opennlp-models-langdetect", version:

For more details please check our [documentation](http://opennlp.apache.org/docs/)

## Adding a new Model

Ensure to add a new model to the `expected-models.txt` file located in `opennlp-models-test`.

## Contributing

Expand Down
41 changes: 39 additions & 2 deletions opennlp-models-langdetect/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,45 @@
</parent>

<artifactId>opennlp-models-langdetect</artifactId>
<version>0.1-SNAPSHOT</version>

<name>Apache OpenNLP Models Lang-Detect</name>
<name>Apache OpenNLP Models :: Lang-Detect</name>

<properties>
<dist.base>${asf.dist.base}</dist.base>
<model.family>langdetect</model.family>
<model.name>langdetect-183.bin</model.name>
<model.version>1.8.3</model.version>
<model.sha256>2ddf585fac2e02a9dcfb9a4a9cc9417562eaac351be2efb506a2eaa87f19e9d4</model.sha256>
</properties>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/model.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.bin</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<configuration>
<url>${dist.base}/${model.family}/${model.version}/${model.name}</url>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

This file was deleted.

18 changes: 18 additions & 0 deletions opennlp-models-langdetect/src/main/resources/model.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model.name=${model.name}
model.version=${model.version}
model.sha256=${model.sha256}
75 changes: 75 additions & 0 deletions opennlp-models-sentdetect/opennlp-models-sentdetect-de/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-models-sentdetect</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>

<artifactId>opennlp-models-sentdetect-de</artifactId>

<name>Apache OpenNLP Models :: Sent-Detect :: German</name>

<properties>
<dist.base>${asf.dist.base}</dist.base>
<model.family>ud-models-1.0</model.family>
<model.name>opennlp-de-ud-gsd-sentence-1.0-1.9.3.bin</model.name>
<model.version>1.9.3</model.version>
<model.sha256>2d4da68109269aab96d128004fe0b88c8a0d226c0ead2b40afc0d10c6d5dc182</model.sha256>
</properties>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/model.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.bin</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<configuration>
<url>${dist.base}/${model.family}/${model.name}</url>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model.name=${model.name}
model.version=${model.version}
model.sha256=${model.sha256}
75 changes: 75 additions & 0 deletions opennlp-models-sentdetect/opennlp-models-sentdetect-en/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-models-sentdetect</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>

<artifactId>opennlp-models-sentdetect-en</artifactId>

<name>Apache OpenNLP Models :: Sent-Detect :: English</name>

<properties>
<dist.base>${asf.dist.base}</dist.base>
<model.family>ud-models-1.0</model.family>
<model.name>opennlp-en-ud-ewt-sentence-1.0-1.9.3.bin</model.name>
<model.version>1.9.3</model.version>
<model.sha256>8dddd7e582cedef4a79a83fd340cefcdafe58419bd20520fec90492ea4bffd11</model.sha256>
</properties>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/model.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.bin</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<configuration>
<url>${dist.base}/${model.family}/${model.name}</url>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model.name=${model.name}
model.version=${model.version}
model.sha256=${model.sha256}
75 changes: 75 additions & 0 deletions opennlp-models-sentdetect/opennlp-models-sentdetect-fr/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-models-sentdetect</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>

<artifactId>opennlp-models-sentdetect-fr</artifactId>

<name>Apache OpenNLP Models :: Sent-Detect :: French</name>

<properties>
<dist.base>${asf.dist.base}</dist.base>
<model.family>ud-models-1.0</model.family>
<model.name>opennlp-1.0-1.9.3fr-ud-ftb-sentence-1.0-1.9.3.bin</model.name>
<model.version>1.9.3</model.version>
<model.sha256>94e57992d4b671909ccb3c5d8e6cb81c84ac96c1c6a19b8b4e7b0197a41cc870</model.sha256>
</properties>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/model.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.bin</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<configuration>
<url>${dist.base}/${model.family}/${model.name}</url>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit 6af838c

Please sign in to comment.