feature: Update BaseMetric class #63
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to the
BaseMetric
class and its associated unit tests, as well as updates to therun_query
method across multiple metric implementations in thewefe
library. The changes enhance input validation, improve documentation, and refactor the handling of parameters for consistency and clarity.Enhancements to
BaseMetric
:Refactored Input Validation:
_check_input
method to validate additional parameters (lost_vocabulary_threshold
andwarn_not_found_words
) and replaced generic exceptions with more specific ones (TypeError
andValueError
).preprocessor_args
andsecondary_preprocessor_args
removed for cleaner code.Improved Documentation:
BaseMetric
class and its methods, including attributes and parameter descriptions.Updates to
run_query
Methods:run_query
methods across multiple metric classes (ECT
,MAC
,RIPA
,RND
,RNSB
,WEAT
) to use named parameters (query
,model
,lost_vocabulary_threshold
,warn_not_found_words
) for_check_input
calls, improving readability and consistency.Unit Test Improvements:
tests/metrics/test_base_metric.py
for clarity and documentation purposes._check_input
method and parameter changes.These changes collectively improve code maintainability, enhance developer experience, and ensure stricter validation of inputs across the library.