MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / similarity_score

Method similarity_score

core/error_database.py:66–85  ·  view source on GitHub ↗

Calculate similarity to another error pattern.

(self, other: "ErrorPattern")

Source from the content-addressed store, hash-verified

64 return pattern
65
66 def similarity_score(self, other: "ErrorPattern") -> float:
67 """Calculate similarity to another error pattern."""
68 score = 0.0
69
70 # Same error type is strong signal
71 if self.error_type == other.error_type:
72 score += 0.4
73
74 # Similar error messages
75 msg_similarity = self._string_similarity(
76 self.error_message.lower(),
77 other.error_message.lower()
78 )
79 score += msg_similarity * 0.4
80
81 # Same file type context
82 if self.context.get("file_ext") == other.context.get("file_ext"):
83 score += 0.2
84
85 return min(1.0, score)
86
87 def _string_similarity(self, s1: str, s2: str) -> float:
88 """Simple string similarity using common words."""

Callers 1

find_similar_errorsMethod · 0.95

Calls 2

_string_similarityMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected