@velvetmonkey/flywheel-crank 0.6.0 → 0.6.1
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.js +45 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -985,15 +985,29 @@ var indexReady = false;
|
|
|
985
985
|
var indexError = null;
|
|
986
986
|
var cooccurrenceIndex = null;
|
|
987
987
|
var DEFAULT_EXCLUDE_FOLDERS = [
|
|
988
|
+
// Periodic notes
|
|
988
989
|
"daily-notes",
|
|
989
990
|
"daily",
|
|
990
991
|
"weekly",
|
|
992
|
+
"weekly-notes",
|
|
991
993
|
"monthly",
|
|
994
|
+
"monthly-notes",
|
|
992
995
|
"quarterly",
|
|
996
|
+
"yearly-notes",
|
|
993
997
|
"periodic",
|
|
994
998
|
"journal",
|
|
999
|
+
// Working folders
|
|
995
1000
|
"inbox",
|
|
996
|
-
"templates"
|
|
1001
|
+
"templates",
|
|
1002
|
+
"attachments",
|
|
1003
|
+
"tmp",
|
|
1004
|
+
"new",
|
|
1005
|
+
// Clippings & external content (article titles are not concepts)
|
|
1006
|
+
"clippings",
|
|
1007
|
+
"readwise",
|
|
1008
|
+
"articles",
|
|
1009
|
+
"bookmarks",
|
|
1010
|
+
"web-clips"
|
|
997
1011
|
];
|
|
998
1012
|
async function initializeEntityIndex(vaultPath2) {
|
|
999
1013
|
const cacheFile = path4.join(vaultPath2, ".claude", "wikilink-entities.json");
|
|
@@ -1091,7 +1105,31 @@ function tokenizeForMatching(content) {
|
|
|
1091
1105
|
const stems = new Set(tokens.map((t) => stem(t)));
|
|
1092
1106
|
return { tokens: tokenSet, stems };
|
|
1093
1107
|
}
|
|
1094
|
-
var MAX_ENTITY_LENGTH =
|
|
1108
|
+
var MAX_ENTITY_LENGTH = 25;
|
|
1109
|
+
var MAX_ENTITY_WORDS = 3;
|
|
1110
|
+
var ARTICLE_PATTERNS = [
|
|
1111
|
+
/\bguide\s+to\b/i,
|
|
1112
|
+
/\bhow\s+to\b/i,
|
|
1113
|
+
/\bcomplete\s+/i,
|
|
1114
|
+
/\bultimate\s+/i,
|
|
1115
|
+
/\bchecklist\b/i,
|
|
1116
|
+
/\bcheatsheet\b/i,
|
|
1117
|
+
/\bcheat\s+sheet\b/i,
|
|
1118
|
+
/\bbest\s+practices\b/i,
|
|
1119
|
+
/\bintroduction\s+to\b/i,
|
|
1120
|
+
/\btutorial\b/i,
|
|
1121
|
+
/\bworksheet\b/i
|
|
1122
|
+
];
|
|
1123
|
+
function isLikelyArticleTitle(name) {
|
|
1124
|
+
if (ARTICLE_PATTERNS.some((pattern) => pattern.test(name))) {
|
|
1125
|
+
return true;
|
|
1126
|
+
}
|
|
1127
|
+
const words = name.split(/\s+/).filter((w) => w.length > 0);
|
|
1128
|
+
if (words.length > MAX_ENTITY_WORDS) {
|
|
1129
|
+
return true;
|
|
1130
|
+
}
|
|
1131
|
+
return false;
|
|
1132
|
+
}
|
|
1095
1133
|
var MIN_SUGGESTION_SCORE = 5;
|
|
1096
1134
|
var MIN_MATCH_RATIO = 0.4;
|
|
1097
1135
|
function scoreEntity(entityName, contentTokens, contentStems) {
|
|
@@ -1147,6 +1185,9 @@ function suggestRelatedLinks(content, options = {}) {
|
|
|
1147
1185
|
if (entityName.length > MAX_ENTITY_LENGTH) {
|
|
1148
1186
|
continue;
|
|
1149
1187
|
}
|
|
1188
|
+
if (isLikelyArticleTitle(entityName)) {
|
|
1189
|
+
continue;
|
|
1190
|
+
}
|
|
1150
1191
|
if (linkedEntities.has(entityName.toLowerCase())) {
|
|
1151
1192
|
continue;
|
|
1152
1193
|
}
|
|
@@ -1165,6 +1206,8 @@ function suggestRelatedLinks(content, options = {}) {
|
|
|
1165
1206
|
continue;
|
|
1166
1207
|
if (entityName.length > MAX_ENTITY_LENGTH)
|
|
1167
1208
|
continue;
|
|
1209
|
+
if (isLikelyArticleTitle(entityName))
|
|
1210
|
+
continue;
|
|
1168
1211
|
if (linkedEntities.has(entityName.toLowerCase()))
|
|
1169
1212
|
continue;
|
|
1170
1213
|
const boost = getCooccurrenceBoost(entityName, directlyMatchedEntities, cooccurrenceIndex);
|