memory 测试自包含:合成 word2vec 模型替代 /tmp 大模型依赖,测试不再联网下载 fastText

This commit is contained in:
root
2026-08-05 09:59:30 +08:00
parent 93efb1773f
commit c6ebbfca34
5 changed files with 171 additions and 44 deletions

View File

@ -15,8 +15,8 @@ type bilingualEvent struct {
}
func TestBilingualPruningAccuracy(t *testing.T) {
zhPath := "/tmp/cc.zh.top200k.vec"
enPath := "/tmp/cc.en.top200k.vec"
zhPath := writeSynthModel(t, 300)
enPath := writeSynthModel(t, 300)
// Test with Chinese-only vs Chinese+English
type modelConfig struct {
@ -103,8 +103,8 @@ func TestBilingualPruningAccuracy(t *testing.T) {
}
func TestBilingualCrossLingualSimilarity(t *testing.T) {
zhPath := "/tmp/cc.zh.top200k.vec"
enPath := "/tmp/cc.en.top200k.vec"
zhPath := writeSynthModel(t, 300)
enPath := writeSynthModel(t, 300)
e := NewStaticEmbedder(zhPath, enPath)
if !e.Loaded() {
t.Skip("embedder not loaded")
@ -137,7 +137,7 @@ func TestBilingualCrossLingualSimilarity(t *testing.T) {
}
func TestBilingualEdgeCases(t *testing.T) {
zhPath := "/tmp/cc.zh.top200k.vec"
zhPath := writeSynthModel(t, 300)
e := NewStaticEmbedder(zhPath)
if !e.Loaded() {
t.Skip("embedder not loaded")
@ -165,7 +165,7 @@ func TestBilingualEdgeCases(t *testing.T) {
}
func TestBilingualVectorizeClean(t *testing.T) {
zhPath := "/tmp/cc.zh.top200k.vec"
zhPath := writeSynthModel(t, 300)
e := NewStaticEmbedder(zhPath)
inputs := []string{