oreshnik-cli 0.1.0 → 0.1.2
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/cli.js +24 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1610,17 +1610,27 @@ var NotesIngestionService = class {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
classifyProject(text, validIds) {
|
|
1612
1612
|
const lower = text.toLowerCase();
|
|
1613
|
-
const
|
|
1613
|
+
const candidates = [];
|
|
1614
1614
|
for (const [pid, keywords] of Object.entries(PROJECT_KEYWORDS)) {
|
|
1615
1615
|
if (!validIds.has(pid)) continue;
|
|
1616
1616
|
for (const kw of keywords) {
|
|
1617
|
-
|
|
1618
|
-
|
|
1617
|
+
const pos = lower.indexOf(kw);
|
|
1618
|
+
if (pos >= 0) {
|
|
1619
|
+
candidates.push({ id: pid, pos });
|
|
1619
1620
|
break;
|
|
1620
1621
|
}
|
|
1621
1622
|
}
|
|
1622
1623
|
}
|
|
1623
|
-
return
|
|
1624
|
+
if (candidates.length === 0) return [];
|
|
1625
|
+
if (candidates.length === 1) return [candidates[0].id];
|
|
1626
|
+
candidates.sort((a, b) => a.pos - b.pos);
|
|
1627
|
+
const first = candidates[0];
|
|
1628
|
+
const nearby = candidates.filter((c) => c.pos - first.pos <= 40);
|
|
1629
|
+
if (nearby.length > 1) {
|
|
1630
|
+
const span = lower.slice(first.pos, first.pos + 40);
|
|
1631
|
+
if (span.includes(" y ") || span.includes(" and ")) return nearby.map((c) => c.id);
|
|
1632
|
+
}
|
|
1633
|
+
return [first.id];
|
|
1624
1634
|
}
|
|
1625
1635
|
classifyOwner(text) {
|
|
1626
1636
|
const lower = text.toLowerCase();
|