Skip to content

Commit

Permalink
[nl] update to use instance
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-baas committed Dec 21, 2023
1 parent d0afe7e commit 0060925
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public String[] getCountries() {
@NotNull
@Override
public Tagger createDefaultTagger() {
return new DutchTagger();
return DutchTagger.INSTANCE;
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,13 @@ public class CompoundAcceptor {
}
}

private final DutchTagger DutchTagger;
private DutchTagger dutchTagger = DutchTagger.INSTANCE;

CompoundAcceptor() {
this.DutchTagger = new DutchTagger();
}

public CompoundAcceptor(DutchTagger DutchTagger) {
this.DutchTagger = DutchTagger;
this.dutchTagger = DutchTagger;
}

boolean acceptCompound(String word) {
Expand Down Expand Up @@ -622,14 +621,14 @@ boolean acceptCompound(String part1, String part2) {
}

private boolean isNoun(String word) throws IOException {
return DutchTagger.getPostags(word).stream().anyMatch(k -> {
return dutchTagger.getPostags(word).stream().anyMatch(k -> {
assert k.getPOSTag() != null;
return k.getPOSTag().startsWith("ZNW") && !part2Exceptions.contains(word);
});
}

private boolean isExistingWord(String word) throws IOException {
return DutchTagger.getPostags(word).stream().anyMatch(k -> k.getPOSTag() != null);
return dutchTagger.getPostags(word).stream().anyMatch(k -> k.getPOSTag() != null);
}

private boolean hasCollidingVowels(String part1, String part2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*/
public class DutchTagger extends BaseTagger {

public static final DutchTagger INSTANCE = new DutchTagger();
private static final Pattern PATTERN1_A = compile("([^aeiouáéíóú])(á)([^aeiouáéíóú])");
private static final Pattern PATTERN1_E = compile("([^aeiouáéíóú])(é)([^aeiouáéíóú])");
private static final Pattern PATTERN1_I = compile("([^aeiouáéíóú])(í)([^aeiouáéíóú])");
Expand Down

0 comments on commit 0060925

Please sign in to comment.