Class: ClaudeMemory::Core::EmbeddingCandidateBuilder
- Inherits:
-
Object
- Object
- ClaudeMemory::Core::EmbeddingCandidateBuilder
- Defined in:
- lib/claude_memory/core/embedding_candidate_builder.rb
Overview
Pure logic for building embedding candidates from fact data Follows Functional Core pattern - no I/O, just transformations
Class Method Summary collapse
-
.build_candidates(facts_data) ⇒ Array<Hash>
Parse embeddings and prepare candidates for similarity calculation.
-
.parse_candidate(row) ⇒ Hash?
Parse a single fact row into a candidate.
Class Method Details
.build_candidates(facts_data) ⇒ Array<Hash>
Parse embeddings and prepare candidates for similarity calculation
13 14 15 16 17 |
# File 'lib/claude_memory/core/embedding_candidate_builder.rb', line 13 def self.build_candidates(facts_data) facts_data.map do |row| parse_candidate(row) end.compact end |
.parse_candidate(row) ⇒ Hash?
Parse a single fact row into a candidate
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/claude_memory/core/embedding_candidate_builder.rb', line 22 def self.parse_candidate(row) = JSON.parse(row[:embedding_json]) { fact_id: row[:id], embedding: , subject_entity_id: row[:subject_entity_id], predicate: row[:predicate], object_literal: row[:object_literal], scope: row[:scope] } rescue JSON::ParserError nil end |