Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
//找出每行从行尾开始第一个汉字
if(flag == 1) {
for(var i=line.length-1;i>=0;i--) {
var lastChar = line.charAt(i);
if(lastChar.isCN()) {
words.push(lastChar);
chars += lastChar;
break;
}
}
}
}
var finalRes = pinyin(chars, {style: pinyin.STYLE_FINALS});
for(var i in finalRes) {
finals.push(finalRes[i][0]);
}
// console.log(finals);
return {words:words,finals:finals};
}
flag = 1;//从下面一行开始就是歌词正文了
continue;
}
//找出每行从行尾开始第一个汉字
if(flag == 1) {
for(var i=line.length-1;i>=0;i--) {
var lastChar = line.charAt(i);
if(lastChar.isCN()) {
chars += lastChar;
break;
}
}
}
}
var footRes = pinyin(chars, {style: pinyin.STYLE_FINALS});
for(var i in footRes) {
var foot = footRes[i][0];
foots.push(foot);
if(!finals_word_map.hasOwnProperty(foot)) {
finals_word_map[foot] = [];
}
finals_word_map[foot].push(chars[i]);
}
var wc = {};
wordCount(foots,wc);
var sortedFoot = sort(wc);
if(sortedFoot.length>=1 && sortedFoot.length<=2) {
specialLyrics.push(filepath.split('/').pop());
}