diff --git a/javascript/_utils.js b/javascript/_utils.js
index 10917a9..9aae894 100644
--- a/javascript/_utils.js
+++ b/javascript/_utils.js
@@ -175,7 +175,16 @@ function flatten(obj, roots = [], sep = ".") {
// Calculate biased tag score based on post count and frequent usage
function calculateUsageBias(count, uses) {
- return Math.log(1 + count) + Math.log(1 + uses);
+ switch (TAC_CFG.frequencyFunction) {
+ case "Logarithmic (weak)":
+ return Math.log(1 + count) + Math.log(1 + uses);
+ case "Logarithmic (strong)":
+ return Math.log(1 + count) + 2 * Math.log(1 + uses);
+ case "Usage first":
+ return uses;
+ default:
+ return count;
+ }
}
// Beautify return type for easier parsing
function mapUseCountArray(useCounts) {
diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js
index 44b8616..d918711 100644
--- a/javascript/tagAutocomplete.js
+++ b/javascript/tagAutocomplete.js
@@ -223,6 +223,7 @@ async function syncOptions() {
showExtraNetworkPreviews: opts["tac_showExtraNetworkPreviews"],
modelSortOrder: opts["tac_modelSortOrder"],
frequencySort: opts["tac_frequencySort"],
+ frequencyFunction: opts["tac_frequencyFunction"],
// Insertion related settings
replaceUnderscores: opts["tac_replaceUnderscores"],
escapeParentheses: opts["tac_escapeParentheses"],
diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py
index e9c2701..25baa9c 100644
--- a/scripts/tag_autocomplete_helper.py
+++ b/scripts/tag_autocomplete_helper.py
@@ -399,7 +399,8 @@ def on_ui_settings():
# Dictionary of function options and their explanations
frequency_sort_functions = {
- "Logarithmic": "Will respect the base order and slightly prefer more frequent tags",
+ "Logarithmic (weak)": "Will respect the base order and slightly prefer often used tags",
+ "Logarithmic (strong)": "Same as Logarithmic (weak), but with a stronger bias",
"Usage first": "Will list used tags by frequency before all others",
}
@@ -431,7 +432,7 @@ def on_ui_settings():
"tac_showExtraNetworkPreviews": shared.OptionInfo(True, "Show preview thumbnails for extra networks if available"),
"tac_modelSortOrder": shared.OptionInfo("Name", "Model sort order", gr.Dropdown, lambda: {"choices": list(sort_criteria.keys())}).info("Order for extra network models and wildcards in dropdown"),
"tac_frequencySort": shared.OptionInfo(True, "Locally record tag usage and sort frequent tags higher").info("Will also work for extra networks, keeping the specified base order"),
- "tac_frequencyFunction": shared.OptionInfo("Logarithmic", "Function to use for frequency sorting", gr.Dropdown, lambda: {"choices": list(frequency_sort_functions.keys())}).info("; ".join([f'{key}: {val}' for key, val in frequency_sort_functions.items()])),
+ "tac_frequencyFunction": shared.OptionInfo("Logarithmic (weak)", "Function to use for frequency sorting", gr.Dropdown, lambda: {"choices": list(frequency_sort_functions.keys())}).info("; ".join([f'{key}: {val}' for key, val in frequency_sort_functions.items()])),
# Insertion related settings
"tac_replaceUnderscores": shared.OptionInfo(True, "Replace underscores with spaces on insertion"),
"tac_escapeParentheses": shared.OptionInfo(True, "Escape parentheses on insertion"),