Fix hint foundry selection
Change-Id: I6cd5d400324648c68eae63a67acd4d49e75367b5
diff --git a/README.md b/README.md
index f1372ea..f70c4a6 100644
--- a/README.md
+++ b/README.md
@@ -197,8 +197,8 @@

The annotation helper hints can be configured at runtime via configuration
-file or environment variable. The default foundries are: `base`, `corenlp`,
-`dereko`, `malt`, `marmot`, `opennlp`, `spacy`, `treetagger`. Additionally available is `ud` (udpipe).
+file or environment variable. By default all available foundries are offered: `base`, `corenlp`,
+`dereko`, `malt`, `marmot`, `opennlp`, `spacy`, `tt`, `ud`.
To **exclude** specific foundries from the defaults, prefix them with `-`:
diff --git a/dev/js/src/default.js b/dev/js/src/default.js
index 39d211e..a453ed7 100644
--- a/dev/js/src/default.js
+++ b/dev/js/src/default.js
@@ -11,5 +11,6 @@
"hint/foundries/marmot",
"hint/foundries/opennlp",
"hint/foundries/spacy",
- "hint/foundries/treetagger"
+ "hint/foundries/treetagger",
+ "hint/foundries/ud"
]);
diff --git a/dev/js/src/hint/foundries.js b/dev/js/src/hint/foundries.js
index 053954e..d1aabe7 100644
--- a/dev/js/src/hint/foundries.js
+++ b/dev/js/src/hint/foundries.js
@@ -84,7 +84,8 @@
* Filter available foundries based on configuration.
* Reads from data-hint-foundries attribute on body element.
* Each foundry module pushes entries like ["Name", "prefix/", "Description"]
- * to ah["-"]. The prefix (e.g., "corenlp/") is matched against enabled list.
+ * to ah["-"]. The prefix (e.g., "corenlp/", "base/s=", "tt/") is matched
+ * against the enabled list by extracting the foundry name (part before /).
*/
ah.filterByConfig = function () {
const body = document.body;
@@ -97,12 +98,12 @@
if (enabledFoundries.length === 0) return;
// Filter the root foundry list ah["-"]
- // Each entry is ["Name", "prefix/", "Description"]
- // Match prefix (without trailing /) against enabled list
+ // Each entry is ["Name", "prefix/...", "Description"]
+ // Extract foundry name from prefix: "corenlp/" -> "corenlp", "base/s=" -> "base", "tt/" -> "tt"
this["-"] = this["-"].filter(entry => {
if (!entry || !entry[1]) return false;
- // Extract foundry name from prefix like "corenlp/" -> "corenlp"
- const foundryName = entry[1].replace(/\/$/, '').toLowerCase();
+ // Extract foundry name as the part before the first '/'
+ const foundryName = entry[1].split('/')[0].toLowerCase();
return enabledFoundries.includes(foundryName);
});
};
diff --git a/kalamar.conf b/kalamar.conf
index 4cffecb..4682c0a 100644
--- a/kalamar.conf
+++ b/kalamar.conf
@@ -84,6 +84,6 @@
## Can also be set via KALAMAR_HINT_FOUNDRIES environment variable.
## Use '-foundry' to exclude from defaults, e.g. ['-spacy', '-corenlp']
# hint_foundries => ['base', 'corenlp', 'dereko', 'malt',
- # 'marmot', 'opennlp', 'spacy', 'treetagger']
+ # 'marmot', 'opennlp', 'spacy', 'tt']
}
}
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 89c8a16..b4186b2 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -344,7 +344,7 @@
# Items starting with '-' exclude that foundry from defaults (e.g., '-spacy')
# If only exclusions are specified, they're removed from defaults
# If any positive items exist, they replace the defaults entirely
- my @default_foundries = qw(base corenlp dereko malt marmot opennlp spacy treetagger);
+ my @default_foundries = qw(base corenlp dereko malt marmot opennlp spacy tt);
my $hint_foundries;
my $config_foundries;