gatsby-source-notion-churnotion 1.0.90 → 1.0.92
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/gatsby-node.d.ts +1 -0
- package/dist/gatsby-node.js +3 -2
- package/dist/onPostBootstrap.js +11 -2
- package/package.json +2 -1
package/dist/gatsby-node.d.ts
CHANGED
package/dist/gatsby-node.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.createSchemaCustomization = exports.sourceNodes = exports.onPluginInit = void 0;
|
3
|
+
exports.onPostBootstrap = exports.createSchemaCustomization = exports.sourceNodes = exports.onPluginInit = void 0;
|
4
4
|
var onPluginInit_1 = require("./onPluginInit");
|
5
5
|
Object.defineProperty(exports, "onPluginInit", { enumerable: true, get: function () { return onPluginInit_1.onPluginInit; } });
|
6
6
|
var source_nodes_1 = require("./source-nodes");
|
7
7
|
Object.defineProperty(exports, "sourceNodes", { enumerable: true, get: function () { return source_nodes_1.sourceNodes; } });
|
8
8
|
var createSchemaCustomization_1 = require("./createSchemaCustomization");
|
9
9
|
Object.defineProperty(exports, "createSchemaCustomization", { enumerable: true, get: function () { return createSchemaCustomization_1.createSchemaCustomization; } });
|
10
|
-
|
10
|
+
var onPostBootstrap_1 = require("./onPostBootstrap");
|
11
|
+
Object.defineProperty(exports, "onPostBootstrap", { enumerable: true, get: function () { return onPostBootstrap_1.onPostBootstrap; } });
|
package/dist/onPostBootstrap.js
CHANGED
@@ -8,6 +8,12 @@ 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 node_nlp_1 = require("node-nlp");
|
12
|
+
const manager = new node_nlp_1.NlpManager({ languages: ["ko"] });
|
13
|
+
const getTokens = async (doc) => {
|
14
|
+
const result = await manager.process("ko", doc);
|
15
|
+
return result.tokens.filter((token) => token.length > 1);
|
16
|
+
};
|
11
17
|
const vector_similarity_memo = new Map();
|
12
18
|
const md5 = (str) => {
|
13
19
|
const md5 = crypto_1.default.createHash("md5");
|
@@ -36,6 +42,7 @@ const getRelatedPosts = (id, bow_vectors) => {
|
|
36
42
|
vector,
|
37
43
|
};
|
38
44
|
return Array.from(bow_vectors.entries())
|
45
|
+
.filter(([otherId]) => otherId !== id)
|
39
46
|
.sort((x, y) => {
|
40
47
|
const vector_x = {
|
41
48
|
id: x[0],
|
@@ -48,7 +55,8 @@ const getRelatedPosts = (id, bow_vectors) => {
|
|
48
55
|
return (getMemorizedVectorSimilarity(vector_y, vector_node) -
|
49
56
|
getMemorizedVectorSimilarity(vector_x, vector_node));
|
50
57
|
})
|
51
|
-
.map((x) => x[0])
|
58
|
+
.map((x) => x[0])
|
59
|
+
.slice(0, 5);
|
52
60
|
};
|
53
61
|
const getTextFromRawText = async (doc) => {
|
54
62
|
return doc
|
@@ -56,7 +64,8 @@ const getTextFromRawText = async (doc) => {
|
|
56
64
|
.replace(/[\#\!\(\)\*\_\[\]\|\=\>\+\`\:\-]/g, "");
|
57
65
|
};
|
58
66
|
const getSpaceSeparatedDoc = async (doc) => {
|
59
|
-
|
67
|
+
const tokens = await getTokens(doc);
|
68
|
+
return tokens.join(" ");
|
60
69
|
};
|
61
70
|
const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId, reporter, cache }, options) => {
|
62
71
|
const { etriToken } = options;
|
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.92",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|
@@ -48,6 +48,7 @@
|
|
48
48
|
"metascraper-url": "^5.45.25",
|
49
49
|
"natural": "^8.0.1",
|
50
50
|
"node-fetch": "^3.3.2",
|
51
|
+
"node-nlp": "^5.0.0-alpha.4",
|
51
52
|
"notion-to-md": "^3.1.1",
|
52
53
|
"notion-types": "^7.1.5",
|
53
54
|
"typescript": "^5.7.2"
|