Class: SentinelRb::Client::Mock
- Defined in:
- lib/sentinel_rb/client/mock.rb
Overview
Enhanced mock client with improved detection for testing
Instance Method Summary collapse
- #analyze_content(prompt) ⇒ Object
- #fact_check(_statement) ⇒ Object
-
#initialize(config) ⇒ Mock
constructor
A new instance of Mock.
- #similarity(text1, text2) ⇒ Object
Constructor Details
#initialize(config) ⇒ Mock
Returns a new instance of Mock.
9 10 11 12 |
# File 'lib/sentinel_rb/client/mock.rb', line 9 def initialize(config) super @relevance_scores = config["mock_scores"] || {} end |
Instance Method Details
#analyze_content(prompt) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/sentinel_rb/client/mock.rb', line 27 def analyze_content(prompt) # Enhanced mock analysis with better pattern detection score = calculate_mock_relevance(prompt) { relevance_score: score, raw_response: score.to_s } end |
#fact_check(_statement) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/sentinel_rb/client/mock.rb', line 37 def fact_check(_statement) # Mock fact-checking - always returns neutral result { accurate: true, confidence: 0.8, reason: "Mock fact-check: No real verification performed" } end |
#similarity(text1, text2) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sentinel_rb/client/mock.rb', line 14 def similarity(text1, text2) # Enhanced similarity calculation with Japanese support words1 = extract_words(text1) words2 = extract_words(text2) return 0.0 if words1.empty? || words2.empty? intersection = (words1 & words2).length union = (words1 | words2).length intersection.to_f / union end |