Skip to content

Commit

Permalink
Fix compatibility with Hardrules metadata dict
Browse files Browse the repository at this point in the history
  • Loading branch information
ZJaume committed Aug 21, 2023
1 parent 5cb7b93 commit e3e4f42
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Bicleaner AI 2.3.2:
### Fixed:
- Fix compatibility with Hardrules metadata dict.


## Bicleaner AI 2.3.1:
### Added:
- `bicleaner-ai-download` quiet mode.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "bicleaner-ai"
version = "2.3.1"
version = "2.3.2"
license = {file = "LICENSE"}
authors = [
{ "name" = "Prompsit Language Engineering", "email" = "[email protected]" }
Expand Down
8 changes: 4 additions & 4 deletions src/bicleaner_ai/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def load_metadata(args, parser):
try:
# Load YAML
metadata_yaml = yaml.safe_load(metadata_file)
yamlpath = os.path.dirname(os.path.abspath(args.metadata))
metadata_yaml["yamlpath"] = yamlpath
yamldir = os.path.dirname(os.path.abspath(args.metadata))
metadata_yaml["yamldir"] = yamldir

# Read language pair and tokenizers
args.source_lang=metadata_yaml["source_lang"]
Expand All @@ -96,7 +96,7 @@ def load_metadata(args, parser):
logging.info(f"Enabling calibrated output with parameters: {cal_params}")
else:
cal_params = None
args.clf = get_model(metadata_yaml["classifier_type"])(yamlpath,
args.clf = get_model(metadata_yaml["classifier_type"])(yamldir,
metadata_yaml["classifier_settings"])
args.clf.load()

Expand All @@ -121,7 +121,7 @@ def load_metadata(args, parser):
logging.warning("Porn removal not present in metadata, disabling")
else:
try:
args.porn_removal = fasttext.load_model(os.path.join(yamlpath, metadata_yaml['porn_removal_file']))
args.porn_removal = fasttext.load_model(os.path.join(yamldir, metadata_yaml['porn_removal_file']))
except:
args.porn_removal = fasttext.load_model(args.metadata_yaml['porn_removal_file'])
else:
Expand Down

0 comments on commit e3e4f42

Please sign in to comment.