Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pat-tree

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pat-tree - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

65

lib/PATtree.js

@@ -1,3 +0,3 @@

var Tree = require("./BTree.js");
var Node = require("./Node.js");
var Node = require("bin-tree").Node;
var Tree = require("bin-tree").BTree;
var utils = require("./utils.js");

@@ -45,6 +45,6 @@ var stopWords = require("./stopWords.js").list;

tree.push(item);
});
});
result.tree = tree;
return result;
},

@@ -75,3 +75,3 @@

correct = false;
throw "index and id not aligned, index: " + i + ", id: " + nodes[i].id;
throw "index and id not aligned, index: " + i + ", id: " + nodes[i].id;
}

@@ -92,7 +92,7 @@ var node = nodes[i];

node.sistringRepres = nodes[node.sistringRepres];
}
}
}
}
},
},

@@ -146,3 +146,3 @@

paper.push(word);
}
}
for(var i = 0; i < words.length; i++) {

@@ -152,3 +152,3 @@ var word = words[i];

for(var j = 0; j < doc.length; j++) {
if(doc.substring(j, j + word.length) == word) {
if(doc.substring(j, j + word.length) == word) {
var valid = true;

@@ -175,3 +175,3 @@ for(var k = j; k < j + word.length; k++) {

} else {
result += " " + paper[i].keyword;
result += " " + paper[i].keyword;
}

@@ -183,3 +183,3 @@ i += paper[i].keyword.length - 1;

} else {
result += " " + paper[i].char;
result += " " + paper[i].char;
}

@@ -190,3 +190,3 @@ }

},
extractSLP: function(TFTrheshold, SETreshold, verbose) {

@@ -203,3 +203,3 @@ var owner = this;

if(node.type == owner.INTERNAL && node.totalFrequency > TFTrheshold) {
var sistring = owner._restorePrefix(node);
var sistring = owner._restorePrefix(node);
if(sistring != "" && sistrings.indexOf(sistring) == -1) {

@@ -215,3 +215,3 @@ var map = {};

console.log("done collecting No." + lexicalPatters.length + " node");
}
}
}

@@ -222,3 +222,3 @@ }

if(verbose) {
console.log("collection completed, number of nodes: " + lexicalPatters.length + ", sorting nodes");
console.log("collection completed, number of nodes: " + lexicalPatters.length + ", sorting nodes");
}

@@ -242,3 +242,3 @@ lexicalPatters.sort(function(item1, item2) {

var sistring = map.sistring;
var fstOverlapString = sistring.slice(0, sistring.length - 1);

@@ -252,5 +252,5 @@ var sndOverlapString = sistring.slice(1, sistring.length);

if(fstOverlap && sndOverlap) {
map.se = map.frequency / (fstOverlap.frequency + sndOverlap.frequency - map.frequency);
map.se = map.frequency / (fstOverlap.frequency + sndOverlap.frequency - map.frequency);
} else if(fstOverlap) {
map.se = map.frequency / (fstOverlap.frequency - map.frequency);
map.se = map.frequency / (fstOverlap.frequency - map.frequency);
} else if(sndOverlap) {

@@ -262,4 +262,4 @@ map.se = map.frequency / (sndOverlap.frequency - map.frequency);

if(fstOverlap) {
fstOverlap.candidate = false;
}
fstOverlap.candidate = false;
}
if(sndOverlap) {

@@ -274,6 +274,6 @@ sndOverlap.candidate = false;

console.log("done processing No." + result.length + " item");
}
}
}
}
}
if(verbose) {

@@ -310,5 +310,5 @@ console.log("extracting SLP completes, total " + result.length + " SLPs")

this.maxSistringLength = sistring.length;
this._appendZeroes(this.maxSistringLength);
this._appendZeroes(this.maxSistringLength);
} else {
sistring += Array(this.maxSistringLength - sistring.length + 1).join("0");
sistring += Array(this.maxSistringLength - sistring.length + 1).join("0");
}

@@ -354,3 +354,3 @@ this._insert(tree, tree.root, sistring, index);

} else {
this._insert(tree, node.right, sistring, index);
this._insert(tree, node.right, sistring, index);
}

@@ -411,3 +411,3 @@ } else {

var nodeBranchBit = nodeString[branchBit].valueOf();
var nodeBranchBit = nodeString[branchBit].valueOf();
var sistringBranchBit = sistring[branchBit].valueOf();

@@ -427,3 +427,3 @@ if(nodeBranchBit == 0 && sistringBranchBit == 1) {

} else if(type == "left") {
tree.appendLeftChild(parent, subtree);
tree.appendLeftChild(parent, subtree);
} else if(type == "right") {

@@ -560,5 +560,5 @@ tree.appendRightChild(parent, subtree);

console.log(" sistring: " + owner._restoreSistring(externalNode));
console.log(" indexes: " + externalNode.indexes);
console.log(" indexes: " + externalNode.indexes);
}
} else if(node.type == owner.EXTERNAL) {

@@ -569,7 +569,7 @@ console.log("sistring: " + owner._restoreSistring(node));

console.log();
});
});
if(printDocuments)
{
console.log("documents:");
console.log(this.documents);
console.log(this.documents);
}

@@ -608,4 +608,1 @@ },

}
{
"name": "pat-tree",
"version": "1.0.6",
"version": "1.0.7",
"description": "PAT tree construction for Chinese documents, keyword extraction and text segmentation",

@@ -36,4 +36,5 @@ "main": "index.js",

"dependencies": {
"node-uuid": "^1.4.1"
"node-uuid": "^1.4.1",
"bin-tree": "git+https://git@github.com/roackb2/bin-tree.git"
}
}

@@ -286,2 +286,3 @@ pat-tree

* 1.0.7 Require the bin-tree module instead of including source files in the project.
* 1.0.6 Correct require path

@@ -288,0 +289,0 @@ * 1.0.5 Restructure folders

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc