feedkeeper 0.38.5 → 0.38.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feedkeeper",
3
- "version": "0.38.5",
3
+ "version": "0.38.6",
4
4
  "description": "A lightweight, self-hosted RSS reader and remote MCP server for your news, blogs, and AI workflows.",
5
5
  "keywords": [
6
6
  "rss",
@@ -23,6 +23,24 @@ function normalizedTitle(value) {
23
23
  return (value ?? "").normalize("NFKD").replace(/\p{M}/gu, "").toLocaleLowerCase("en")
24
24
  .replace(/[^\p{L}\p{N}]+/gu, " ").trim();
25
25
  }
26
+ const TITLE_STOPWORDS = new Set([
27
+ // English
28
+ "a", "an", "and", "are", "as", "at", "be", "been", "before", "after", "ahead", "about", "amid", "by", "for",
29
+ "from", "has", "have", "had", "he", "her", "his", "in", "into", "is", "it", "its", "more", "new", "not", "of",
30
+ "on", "or", "out", "over", "report", "reports", "said", "says", "she", "that", "the", "their", "them", "they",
31
+ "this", "to", "up", "was", "were", "what", "when", "where", "which", "who", "why", "will", "with", "would",
32
+ // German
33
+ "aber", "als", "am", "an", "auch", "auf", "aus", "bei", "beim", "bis", "das", "dass", "dem", "den", "der", "des",
34
+ "die", "ein", "eine", "einem", "einen", "einer", "eines", "er", "es", "für", "fur", "hat", "haben", "im", "in",
35
+ "ist", "mit", "nach", "nicht", "noch", "nur", "oder", "sich", "sie", "sind", "so", "über", "uber", "um", "und",
36
+ "uns", "unter", "vom", "von", "vor", "war", "was", "werden", "wie", "will", "wird", "wurde", "zu", "zum", "zur",
37
+ ]);
38
+ function significantTitleWords(normalized) {
39
+ if (!normalized)
40
+ return new Set();
41
+ const tokens = normalized.split(" ").filter((word) => word.length >= 2 && !TITLE_STOPWORDS.has(word));
42
+ return new Set(tokens);
43
+ }
26
44
  function duplicate(a, b) {
27
45
  if (a.url && a.url === b.url)
28
46
  return true;
@@ -31,12 +49,25 @@ function duplicate(a, b) {
31
49
  if (Math.abs(a.published - b.published) > 48 * 3_600_000)
32
50
  return false;
33
51
  const words = a.words, otherWords = b.words;
34
- if (words.size < 6 || otherWords.size < 6)
35
- return false;
36
- if (Math.min(words.size, otherWords.size) / Math.max(words.size, otherWords.size) < 0.9)
37
- return false;
38
- const shared = [...words].filter((word) => otherWords.has(word)).length;
39
- return shared / (words.size + otherWords.size - shared) >= 0.9;
52
+ if (words.size >= 6 && otherWords.size >= 6) {
53
+ const shared = [...words].filter((word) => otherWords.has(word)).length;
54
+ if (shared / (words.size + otherWords.size - shared) >= 0.75)
55
+ return true;
56
+ }
57
+ const sigA = a.significant, sigB = b.significant;
58
+ const minSig = Math.min(sigA.size, sigB.size);
59
+ const sameSource = a.article.subscriptionId === b.article.subscriptionId;
60
+ if (sameSource && minSig >= 3) {
61
+ const sharedSig = [...sigA].filter((word) => sigB.has(word)).length;
62
+ if (sharedSig >= 3 || (sharedSig >= 2 && sharedSig / minSig >= 0.4))
63
+ return true;
64
+ }
65
+ else if (!sameSource && minSig >= 4) {
66
+ const sharedSig = [...sigA].filter((word) => sigB.has(word)).length;
67
+ if (sharedSig >= 4 || (sharedSig >= 3 && sharedSig / minSig >= 0.5))
68
+ return true;
69
+ }
70
+ return false;
40
71
  }
41
72
  /** Selection is deterministic and independent of images and device opening counters.
42
73
  * First favour new stories, then relax source caps to fill a small library fairly. */
@@ -47,7 +78,14 @@ export function selectEdition(candidates, settings) {
47
78
  // Normalize URLs and Unicode once, not for every pair on every selection pass.
48
79
  const prepared = candidates.map((article) => {
49
80
  const title = normalizedTitle(article.title);
50
- return { article, title, words: new Set(title.split(" ")), url: canonicalArticleUrl(article.url), published: Date.parse(article.publishedAt) };
81
+ return {
82
+ article,
83
+ title,
84
+ words: new Set(title.split(" ")),
85
+ significant: significantTitleWords(title),
86
+ url: canonicalArticleUrl(article.url),
87
+ published: Date.parse(article.publishedAt),
88
+ };
51
89
  });
52
90
  const feeds = new Map();
53
91
  const folders = new Map();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedkeeper/server",
3
- "version": "0.38.5",
3
+ "version": "0.38.6",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }