summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-07-04 14:18:08 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-07-04 14:18:08 +0000
commit8be929db3bdc66f31501600fa3046f616b7e8154 (patch)
tree7a084836442a47f5325a336aba8016782aafae25
parent4a527525956f3ebb6de772ed284268406c53055e (diff)
downloadmorph-sam/splitting-fixes-plus-other-stuff.tar.gz
Fix issue when overriding default chunk splitting rulessam/splitting-fixes-plus-other-stuff
When overriding a default chunk splitting rule, the use 'break' would mean that some of the other default chunk split rules might be ignored. This isn't ever what you want. I also clarified the current behaviour in a comment. I think in future we should add a mechanism to extend the default rules, as well as the current mechanism which allows only replacing them. But that is a separate issue.
-rw-r--r--morphlib/artifactsplitrule.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/morphlib/artifactsplitrule.py b/morphlib/artifactsplitrule.py
index 4440f329..76b3fb5e 100644
--- a/morphlib/artifactsplitrule.py
+++ b/morphlib/artifactsplitrule.py
@@ -229,10 +229,11 @@ def unify_chunk_matches(morphology):
name = morphology['name']
for suffix, patterns in DEFAULT_CHUNK_RULES:
ca_name = name + suffix
- # Default rules are replaced by explicit ones
- if ca_name in split_rules.artifacts:
- break
- split_rules.add(ca_name, FileMatch(patterns))
+ # Explicit rules override the default rules. This is an all-or-nothing
+ # override: there is no way to extend the default split rules right now
+ # without duplicating them in the chunk morphology.
+ if ca_name not in split_rules.artifacts:
+ split_rules.add(ca_name, FileMatch(patterns))
return split_rules