gatsby-source-notion-churnotion 1.0.92 → 1.0.94
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/onPostBootstrap.js +13 -10
- package/package.json +1 -1
package/dist/onPostBootstrap.js
CHANGED
@@ -12,7 +12,12 @@ const node_nlp_1 = require("node-nlp");
|
|
12
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.entities) {
|
16
|
+
return [];
|
17
|
+
}
|
18
|
+
return result.entities
|
19
|
+
.map((entity) => entity.utteranceText)
|
20
|
+
.filter((text) => text.length > 1);
|
16
21
|
};
|
17
22
|
const vector_similarity_memo = new Map();
|
18
23
|
const md5 = (str) => {
|
@@ -64,20 +69,18 @@ const getTextFromRawText = async (doc) => {
|
|
64
69
|
.replace(/[\#\!\(\)\*\_\[\]\|\=\>\+\`\:\-]/g, "");
|
65
70
|
};
|
66
71
|
const getSpaceSeparatedDoc = async (doc) => {
|
72
|
+
if (!doc.trim()) {
|
73
|
+
return "";
|
74
|
+
}
|
67
75
|
const tokens = await getTokens(doc);
|
68
76
|
return tokens.join(" ");
|
69
77
|
};
|
70
78
|
const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId, reporter, cache }, options) => {
|
71
|
-
const { etriToken } = options;
|
72
|
-
if (etriToken === "") {
|
73
|
-
reporter.info("[Related Post] Skip getting related post logic.");
|
74
|
-
return;
|
75
|
-
}
|
76
79
|
const nodes = getNodesByType(constants_1.NODE_TYPE.Post);
|
77
|
-
const docs = nodes
|
78
|
-
id: node.id,
|
79
|
-
text
|
80
|
-
})
|
80
|
+
const docs = nodes
|
81
|
+
.map((node) => ({ id: node.id, text: node.rawText }))
|
82
|
+
.filter((doc) => doc.text?.trim() !== "");
|
83
|
+
reporter.info(`[TEST get Docs] ${docs}`);
|
81
84
|
const tfidf = new natural_1.TfIdf();
|
82
85
|
// tfidf
|
83
86
|
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.94",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|