Deterministic library dispatch layer. Five new headers: - LibrarySelection: result struct with avoidedLibraries + justification - OperationClassifier: wraps taxonomy with ClassificationResult - PerTaskLibrarySelector: sort by score, pick max, build avoided list - SelectionJustificationLog: append-only auditable selection log - Sprint287IntegrationSummary: 8-task spec, all selections verified 25/25 tests passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#pragma once
|
|
// Step 1964: OperationClassifier
|
|
// Wraps OperationTaxonomy with a ClassificationResult that includes
|
|
// confidence and isKnown flags.
|
|
|
|
#include "OperationTaxonomy.h"
|
|
#include <string>
|
|
|
|
namespace whetstone {
|
|
|
|
struct ClassificationResult {
|
|
std::string domain; // e.g. "serialization.json" or "unknown"
|
|
float confidence; // 1.0 if known, 0.0 if "unknown"
|
|
bool isKnown;
|
|
};
|
|
|
|
class OperationClassifier {
|
|
public:
|
|
explicit OperationClassifier(OperationTaxonomy taxonomy)
|
|
: taxonomy_(std::move(taxonomy)) {}
|
|
|
|
ClassificationResult classify(const std::string& text) const {
|
|
auto domain = taxonomy_.classify(text);
|
|
bool known = (domain != "unknown");
|
|
return {domain, known ? 1.0f : 0.0f, known};
|
|
}
|
|
|
|
// Convenience: build with the default 40+ domain taxonomy
|
|
static OperationClassifier withDefaultTaxonomy() {
|
|
return OperationClassifier(OperationTaxonomy::buildDefault());
|
|
}
|
|
|
|
const OperationTaxonomy& taxonomy() const { return taxonomy_; }
|
|
|
|
private:
|
|
OperationTaxonomy taxonomy_;
|
|
};
|
|
|
|
} // namespace whetstone
|