Honeycomb und Control-Patch
This commit is contained in:
@@ -69,3 +69,34 @@ func TestNextPairUsesBoundedRotatingAnchors(t *testing.T) {
|
||||
t.Fatalf("rotating anchor did not reach the next semantic region, ok=%v comparisons=%d", ok, comparisons)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCategoryFiltersLimitEmbeddingAndThinkingCandidates(t *testing.T) {
|
||||
s, err := Open(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
nodes := []model.Node{
|
||||
{ID: "net-a", Kind: "knowledge", Label: "Net A", Categories: []string{"Netzwerk"}, Origin: "test"},
|
||||
{ID: "net-b", Kind: "knowledge", Label: "Net B", Categories: []string{"Netzwerk"}, Origin: "test"},
|
||||
{ID: "app-a", Kind: "knowledge", Label: "App A", Categories: []string{"Applikation"}, Origin: "test"},
|
||||
{ID: "none", Kind: "knowledge", Label: "Ohne", Origin: "test"},
|
||||
}
|
||||
for _, node := range nodes {
|
||||
s.UpsertNode(node)
|
||||
}
|
||||
pending := s.NodesForEmbeddingFiltered([]string{"Netzwerk"})
|
||||
if len(pending) != 2 {
|
||||
t.Fatalf("expected two network embeddings, got %d", len(pending))
|
||||
}
|
||||
uncategorized := s.NodesForEmbeddingFiltered([]string{"__uncategorized__"})
|
||||
if len(uncategorized) != 1 || uncategorized[0].ID != "none" {
|
||||
t.Fatalf("unexpected uncategorized nodes: %#v", uncategorized)
|
||||
}
|
||||
for _, node := range nodes {
|
||||
s.SetVector(node.ID, []float64{1, .01})
|
||||
}
|
||||
a, b, _, ok, _ := s.NextPairFiltered(.5, 8, []string{"Netzwerk"})
|
||||
if !ok || a.Categories[0] != "Netzwerk" || b.Categories[0] != "Netzwerk" {
|
||||
t.Fatalf("thinking filter returned wrong pair: ok=%v a=%+v b=%+v", ok, a, b)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user