support custom rules as custom filter (#10626)

This commit is contained in:
Stefan Viol 2024-05-30 08:55:23 +02:00 committed by GitHub
parent dcfe50e488
commit 024229c4a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

1
.gitignore vendored
View file

@ -6,6 +6,7 @@
.class
.classpath
.idea
.run
.ignore
.project
.settings

View file

@ -124,6 +124,13 @@ class PipelinePool implements KeyedPooledObjectFactory<PipelineSettings, Pipelin
.build();
return TelemetryProvider.INSTANCE.createSpan("createPipeline", attributes, () -> {
Pipeline lt = new Pipeline(lang, params.altLanguages, motherTongue, cache, globalConfig, userConfig, params.inputLogging);
//Add custom rules as filter if there are implement the RuleMatchFilter interface
//TODO: Will not work anymore if we handle custom rules as remote rules
for (Rule rule : userConfig.getRules()) {
if (rule instanceof RuleMatchFilter) {
lt.addMatchFilter((RuleMatchFilter) rule);
}
}
lt.setMaxErrorsPerWordRate(config.getMaxErrorsPerWordRate());
lt.disableRules(disabledRuleIds);
if (config.getLanguageModelDir() != null) {