我正在编写一些需要一段文本的内容,并将其分解为可用于查找类似文本块的可能的数据库查询.(类似于我输入时生成的"类似问题"列表)基本过程:
这是我到目前为止所拥有的:
//baseList starts with an empty array
//candList starts with the array of unique stems
//target is where the arrays of unique combinations are stored
function createUniqueCombos(baseList,candList,target){
for(var i=0;i<candList.length;i++){
//copy the base List
var newList = baseList.slice(0);
//add the candidate list item to the base list copy
newList.push(candList[i]);
//add the new array to the target array
target.push(newList);
//re-call function using new array as baseList
//and remaining candidates as candList
var nextCandList = candList.slice(i + 1); …Run Code Online (Sandbox Code Playgroud)