gatsby-source-notion-churnotion 1.0.91 → 1.0.93
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/onPostBootstrap.js +12 -7
- package/package.json +1 -2
package/dist/onPostBootstrap.js
CHANGED
@@ -8,11 +8,14 @@ const crypto_1 = __importDefault(require("crypto"));
|
|
8
8
|
const natural_1 = require("natural");
|
9
9
|
const constants_1 = require("./constants");
|
10
10
|
const compute_cosine_similarity_1 = __importDefault(require("compute-cosine-similarity"));
|
11
|
-
const
|
12
|
-
const manager = new
|
11
|
+
const node_nlp_1 = require("node-nlp");
|
12
|
+
const manager = new node_nlp_1.NlpManager({ languages: ["ko"] });
|
13
13
|
const getTokens = async (doc) => {
|
14
14
|
const result = await manager.process("ko", doc);
|
15
|
-
|
15
|
+
if (!result.tokens) {
|
16
|
+
return [];
|
17
|
+
}
|
18
|
+
return result.tokens.filter((token) => token.length > 1);
|
16
19
|
};
|
17
20
|
const vector_similarity_memo = new Map();
|
18
21
|
const md5 = (str) => {
|
@@ -64,6 +67,9 @@ const getTextFromRawText = async (doc) => {
|
|
64
67
|
.replace(/[\#\!\(\)\*\_\[\]\|\=\>\+\`\:\-]/g, "");
|
65
68
|
};
|
66
69
|
const getSpaceSeparatedDoc = async (doc) => {
|
70
|
+
if (!doc.trim()) {
|
71
|
+
return "";
|
72
|
+
}
|
67
73
|
const tokens = await getTokens(doc);
|
68
74
|
return tokens.join(" ");
|
69
75
|
};
|
@@ -74,10 +80,9 @@ const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId,
|
|
74
80
|
return;
|
75
81
|
}
|
76
82
|
const nodes = getNodesByType(constants_1.NODE_TYPE.Post);
|
77
|
-
const docs = nodes
|
78
|
-
id: node.id,
|
79
|
-
text
|
80
|
-
}));
|
83
|
+
const docs = nodes
|
84
|
+
.map((node) => ({ id: node.id, text: node.rawText }))
|
85
|
+
.filter((doc) => doc.text?.trim() !== "");
|
81
86
|
const tfidf = new natural_1.TfIdf();
|
82
87
|
// tfidf
|
83
88
|
docs.map(async (doc) => {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "gatsby-source-notion-churnotion",
|
3
3
|
"description": "Gatsby plugin that can connect with One Notion Database RECURSIVELY using official API",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.93",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|
@@ -49,7 +49,6 @@
|
|
49
49
|
"natural": "^8.0.1",
|
50
50
|
"node-fetch": "^3.3.2",
|
51
51
|
"node-nlp": "^5.0.0-alpha.4",
|
52
|
-
"node-nlp-typescript": "^1.0.3",
|
53
52
|
"notion-to-md": "^3.1.1",
|
54
53
|
"notion-types": "^7.1.5",
|
55
54
|
"typescript": "^5.7.2"
|