vue-hook-optimizer 0.0.83 → 0.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1802,7 +1802,6 @@ function buildWeightedGraph(graph, options = {}) {
|
|
|
1802
1802
|
const { semanticWeight = 1, similarityThreshold = .3 } = options;
|
|
1803
1803
|
const weighted = /* @__PURE__ */ new Map();
|
|
1804
1804
|
const allNodes = /* @__PURE__ */ new Set();
|
|
1805
|
-
const connectedPairs = /* @__PURE__ */ new Set();
|
|
1806
1805
|
for (const [node, edges] of graph) {
|
|
1807
1806
|
allNodes.add(node);
|
|
1808
1807
|
for (const edge of edges) allNodes.add(edge.node);
|
|
@@ -1814,8 +1813,6 @@ function buildWeightedGraph(graph, options = {}) {
|
|
|
1814
1813
|
weighted.get(node).set(edge.node, Math.max(currentWeight, structuralWeight));
|
|
1815
1814
|
const reverseWeight = weighted.get(edge.node).get(node) || 0;
|
|
1816
1815
|
weighted.get(edge.node).set(node, Math.max(reverseWeight, structuralWeight));
|
|
1817
|
-
const pairKey = [node.label, edge.node.label].sort().join("|");
|
|
1818
|
-
connectedPairs.add(pairKey);
|
|
1819
1816
|
}
|
|
1820
1817
|
if (semanticWeight > 0) {
|
|
1821
1818
|
const nodeWordsCache = /* @__PURE__ */ new Map();
|
|
@@ -1842,14 +1839,11 @@ function buildWeightedGraph(graph, options = {}) {
|
|
|
1842
1839
|
const wordsB = nodeWordsCache.get(nodeB);
|
|
1843
1840
|
const similarity = calculateSemanticSimilarityCached(nodeA.label, nodeB.label, wordsA, wordsB);
|
|
1844
1841
|
if (similarity > similarityThreshold) {
|
|
1845
|
-
const isConnected = connectedPairs.has(comparedKey);
|
|
1846
1842
|
const semanticEdgeWeight = similarity * semanticWeight;
|
|
1847
|
-
const currentAB = weighted.get(nodeA).get(nodeB)
|
|
1848
|
-
|
|
1849
|
-
weighted.get(
|
|
1850
|
-
|
|
1851
|
-
const newWeightBA = isConnected ? Math.max(currentBA, semanticEdgeWeight) : currentBA + semanticEdgeWeight;
|
|
1852
|
-
weighted.get(nodeB).set(nodeA, Math.min(newWeightBA, 2));
|
|
1843
|
+
const currentAB = weighted.get(nodeA).get(nodeB);
|
|
1844
|
+
if (typeof currentAB === "number") weighted.get(nodeA).set(nodeB, Math.min(Math.max(currentAB, semanticEdgeWeight), 2));
|
|
1845
|
+
const currentBA = weighted.get(nodeB).get(nodeA);
|
|
1846
|
+
if (typeof currentBA === "number") weighted.get(nodeB).set(nodeA, Math.min(Math.max(currentBA, semanticEdgeWeight), 2));
|
|
1853
1847
|
}
|
|
1854
1848
|
}
|
|
1855
1849
|
}
|