perda.core_data_structures.search_indexes#

pydantic model perda.core_data_structures.search_indexes.VariableKeywordIndex[source]#

Bases: BaseModel

Normalized searchable text per variable, built once at parse time.

Fields:
field row_to_var_id: list[int] [Required]#

Maps index row position to variable ID

field normalized_text: list[str] [Required]#

Lower-cased text of each variable’s name and description, with camelCase and period boundaries split into separate words

pydantic model perda.core_data_structures.search_indexes.VariableSemanticIndex[source]#

Bases: BaseModel

Vector index over variable description embeddings, built once at parse time.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
field faiss_index: IndexFlatIP [Required]#

Inner-product index holding L2-normalized description vectors

field row_to_var_id: list[int] [Required]#

Maps index row position to variable ID

perda.core_data_structures.search_indexes.normalize_search_text(text)[source]#

Lower-case text and split camelCase and period boundaries into separate words.

Parameters:

text (str) – Raw text, such as a C++ variable name joined with its description.

Returns:

Normalized text, e.g. “pcm.wheelSpeeds.frontRight” becomes “pcm wheel speeds front right”.

Return type:

str

perda.core_data_structures.search_indexes.variable_keyword_index_from_csv_mappings(id_to_cpp_name, id_to_descript)[source]#

Normalize every variable’s name and description into searchable text.

Parameters:
  • id_to_cpp_name (dict[int, str]) – Mapping from variable ID to its C++ variable name.

  • id_to_descript (dict[int, str]) – Mapping from variable ID to its human-readable description.

Returns:

Normalized text for each variable, aligned with row_to_var_id.

Return type:

VariableKeywordIndex