MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / extract_handcrafted_features

Function extract_handcrafted_features

bench/embedding_experiment.py:34–47  ·  view source on GitHub ↗
(prompt: str, system_prompt: str | None = None)

Source from the content-addressed store, hash-verified

32
33
34def extract_handcrafted_features(prompt: str, system_prompt: str | None = None) -> np.ndarray:
35 full_text = f"{system_prompt or ''} {prompt}".strip()
36 struct_dims = extract_structural_features(full_text)
37 unicode_blocks = extract_unicode_block_features(full_text)
38 kw_dims = extract_keyword_features(prompt)
39
40 feats = []
41 for d in struct_dims:
42 feats.append(d.score)
43 for _, v in sorted(unicode_blocks.items()):
44 feats.append(v)
45 for d in kw_dims:
46 feats.append(d.score)
47 return np.array(feats, dtype=np.float32)
48
49
50class AvgPerceptron:

Callers 1

run_experimentFunction · 0.85

Calls 3

appendMethod · 0.45

Tested by

no test coverage detected