gatsby-source-notion-churnotion 1.0.92 → 1.0.93

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,9 @@ 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
+ if (!result.tokens) {
16
+ return [];
17
+ }
15
18
  return result.tokens.filter((token) => token.length > 1);
16
19
  };
17
20
  const vector_similarity_memo = new Map();
@@ -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.map((node) => ({
78
- id: node.id,
79
- text: node.rawText,
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.92",
4
+ "version": "1.0.93",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",