Skip to content

Commit

Permalink
feat(#276): mvp
Browse files Browse the repository at this point in the history
  • Loading branch information
Marat-Tim committed Feb 2, 2025
1 parent 0ec77f4 commit 66cd72a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,24 @@ SOFTWARE.
<artifactId>jmh-maven-plugin</artifactId>
<version>0.2.2</version>
</plugin>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://opennlp.sourceforge.net/models-1.5/en-pos-perceptron.bin</url>
<outputFileName>en-pos-perceptron.bin</outputFileName>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
17 changes: 4 additions & 13 deletions src/main/java/org/eolang/lints/misc/LtTestNotVerb.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

import com.jcabi.xml.XML;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
Expand All @@ -36,6 +34,7 @@
import opennlp.tools.postag.POSModel;
import opennlp.tools.postag.POSTaggerME;
import org.cactoos.io.ResourceOf;
import org.cactoos.io.UncheckedInput;
import org.cactoos.list.ListOf;
import org.cactoos.text.TextOf;
import org.cactoos.text.UncheckedText;
Expand All @@ -49,11 +48,6 @@
* with POS tagging capabilities in order to determine the part of speech and
* tense for test object name.
* @since 0.0.22
* @todo #257:60min Configure model download only during the build and place into the JAR.
* Currently, we download model file each time when creating the lint, which may
* be slow in the usage of this lint. Instead, let's configure maven to download
* model file during the build, and place into JAR, so lint will be able to locate
* file from resources faster.
*/
public final class LtTestNotVerb implements Lint<XML> {

Expand Down Expand Up @@ -143,17 +137,14 @@ public String name() {
private static POSModel defaultPosModel() {
try {
return new POSModel(
new URI("https://opennlp.sourceforge.net/models-1.5/en-pos-perceptron.bin")
.toURL()
new UncheckedInput(
new ResourceOf("en-pos-perceptron.bin")
).stream()
);
} catch (final IOException exception) {
throw new IllegalStateException(
"Failed to read from I/O", exception
);
} catch (final URISyntaxException exception) {
throw new IllegalStateException(
"URI syntax is broken", exception
);
}
}
}

0 comments on commit 66cd72a

Please sign in to comment.