MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / overlap

Function overlap

graph-ui/src/twin/reader-rewrite.ts:150–161  ·  view source on GitHub ↗

How much two sentences overlap, 0 to 1.

(one: Set<string>, other: Set<string>)

Source from the content-addressed store, hash-verified

148
149/** How much two sentences overlap, 0 to 1. */
150function overlap(one: Set<string>, other: Set<string>): number {
151 if (one.size === 0 || other.size === 0) {
152 return one.size === other.size ? 1 : 0;
153 }
154 let shared = 0;
155 for (const word of one) {
156 if (other.has(word)) {
157 shared += 1;
158 }
159 }
160 return shared / (one.size + other.size - shared);
161}
162
163/**
164 * The order of the statements, checked where the facts cannot check it.

Callers 1

orderRefusalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected