var stopwordnumbers = [ "once", "twice", "thrice", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "nineth", "tenth", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", , "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "tweenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety", "hundred", "hundreds", "and", "-", "thousand", "thousands", "million", "millions", "billion", "billions" ]; var stopwordsymbols = ["+","-","*","%","/","?","!","^","'","\"",",",";","\\","."] //This next one built from //https://github.com/Yoast/YoastSEO.js/blob/develop/src/config/stopwords.js //https://gist.github.com/sebleier/554280 //and other resources var stopwordsmin3=["me","i","up","yep","yeap","hi","hey","will","not","yes","is","it","he","she","they","them","theirs","us","our","we","you","your","yours","a","ah","lol","thanks","do","please","pls","plis","xd","wait","caca", "yeah", "no", "ok", "act","adj","ago","ain","all","and","any","are","a's","ask","big","but","buy","can","cit","co.","com","con","cry","c's","did","don","due","edu","end","est","etc","far","few","fix","for","get","gmt","got","gov","had","has","hed","her","hes","hid","him","his","how","htm","i'd","ill","i'm","inc","int","isn","itd","its","ive","les","let","'ll","los","low","ltd","man","may","men","mil","mrs","mug","nay","net","new","non","nor","nos","not","now","off","ohh","old","omg","one","ord","org","our","out","own","par","pas","per","put","que","ran","ref","run","saw","say","sec","see","she","six","sub","sup","ten","the","til","tip","tis","too","top","try","t's","two","ups","use","'ve","via","viz","vol","was","way","web","wed","who","why","won","www","yes","yet","you","able","abst","aint","also","amid","area","aren","arpa","asks","auth","away","back","been","best","bill","biol","both","call","came","cant","case","cmon","come","copy","dare","date","dear","didn","does","done","dont","down","each","else","ends","even","ever","face","fact","felt","fify","fill","find","fire","five","four","free","from","full","gave","gets","give","goes","gone","good","hadn","half","hasn","have","he'd","hell","help","here","hers","he's","high","home","html","http","i.e.","ibid","i'll","inc.","into","isnt","it'd","itll","it's","i've","join","just","keep","kept","keys","kind","knew","know","last","less","lest","lets","like","line","long","look","made","make","many","mean","mill","mine","miss","more","most","move","msie","much","must","name","near","need","next","nine","none","null","okay","once","ones","only","onto","open","ours","over","page","part","past","plus","pmid","puts","refs","ring","room","said","same","says","seem","seen","sees","self","sent","shan","shed","shes","show","side","site","some","soon","stop","such","sure","take","tell","test","text","than","that","them","then","they","thin","this","thou","thru","thus","till","'tis","took","turn","twas","unto","upon","used","uses","uucp","very","vols","want","wasn","ways","we'd","well","went","were","weve","what","when","whim","whod","whom","whos","will","wish","with","wont","work","year","youd","your","zero","about","above","added","after","again","ahead","ain't","allow","alone","along","among","apart","areas","arent","arise","aside","asked","backs","began","begin","being","below","brief","can't","cases","cause","clear","click","c'mon","comes","could","didnt","doesn","doing","don't","downs","early","eight","empty","ended","et-al","every","faces","facts","fewer","fifth","fifty","finds","first","forth","forty","found","front","fully","given","gives","going","goods","great","group","hadnt","hasnt","haven","he'll","hello","hence","heres","how'd","how's","index","inner","isn't","it'll","itse”","keeps","known","knows","large","later","least","let's","liked","looks","lower","makes","maybe","maynt","means","might","minus","mustn","needn","needs","never","newer","noone","noted","novel","often","older","one's","opens","order","other","ought","owing","pages","parts","place","point","proud","quite","right","rooms","round","seems","seven","shall","shant","she'd","shell","she's","shown","shows","sides","since","sixty","small","sorry","state","still","taken","tends","thank","thanx","thats","their","there","these","theyd","thick","thing","think","third","those","three","today","tried","tries","truly","turns","'twas","twice","under","until","using","value","wants","wasnt","we'll","wells","we're","weren","we've","whats","where","which","while","who'd","whole","wholl","who's","whose","why'd","why's","width","won't","words","works","world","would","years","you'd","youll","young","youre","yours","youve","abroad","across","allows","almost","always","amidst","amount","anyhow","anyone","anyway","appear","aren't","around","asking","backed","became","become","before","begins","behind","beings","beside","better","beyond","bottom","cannot","causes","couldn","course","darent","detail","didn't","differ","doesnt","downed","during","effect","eighty","either","eleven","ending","enough","evenly","except","fairly","former","giving","gotten","groups","hadn't","hardly","hasn't","havent","having","hereby","herein","here's","higher","himse”","hither","how'll","indeed","inside","inward","itself","lately","latest","latter","length","likely","little","longer","mainly","making","mayn't","member","merely","mightn","mostly","mustnt","myself","namely","nearly","needed","neednt","neverf","newest","ninety","nobody","no-one","number","obtain","oldest","opened","orders","others","parted","placed","places","please","points","poorly","rather","really","recent","saying","second","seeing","seemed","selves","shan't","she'll","should","showed","showns","states","system","taking","thanks","thatll","that's","thatve","theirs","thence","thered","theres","they'd","theyll","theyre","theyve","thickv","things","thinks","thirty","though","throug","toward","trying","turned","twelve","twenty","unless","unlike","useful","versus","wanted","wasn't","well-b","werent","what'd","whatll","what's","whatve","whence","when'd","when's","wheres","whilst","who'll","why'll","widely","within","wonder","worked","wouldn","you'll","you're","you've","adopted","affects","against","already","amongst","another","anybody","anymore","anyways","awfully","backing","because","becomes","believe","besides","between","billion","briefly","caption","certain","changes","clearly","contain","couldnt","daren't","despite","doesn't","downing","exactly","example","farther","fifteen","follows","forever","forward","further","general","getting","greater","grouped","happens","haven't","herself","highest","himself","howbeit","however","hundred","ignored","insofar","instead","largely","longest","looking","members","mightnt","million","mustn't","must've","needing","needn't","neither","nothing","nowhere","numbers","omitted","opening","ordered","oughtnt","outside","overall","parting","perhaps","pointed","present","problem","quickly","readily","regards","related","results","seconds","section","seeming","serious","seventy","several","shouldn","showing","similar","sincere","smaller","someday","somehow","someone","specify","suggest","that'll","that've","thereby","there'd","therein","therell","thereof","therere","there's","thereto","thereve","they'll","they're","they've","thoughh","thought","through","towards","turning","undoing","upwards","usually","various","wanting","webpage","website","welcome","weren't","what'll","what've","when'll","whereas","whereby","where'd","wherein","where's","whether","whither","whoever","willing","without","working","wouldnt","younger","actually","affected","although","amoungst","announce","anything","anywhere","backward","becoming","computer","consider","contains","couldn't","could've","describe","directly","doubtful","entirely","evermore","everyone","followed","formerly","furthers","greatest","grouping","hereupon","homepage","inasmuch","indicate","interest","latterly","likewise","meantime","mightn't","might've","moreover","netscape","normally","obtained","opposite","ordering","oughtn't","pointing","possible","possibly","presents","probably","problems","promptly","provided","provides","recently","research","reserved","resulted","secondly","sensible","shouldnt","slightly","smallest","somebody","somethan","sometime","somewhat","strongly","there'll","there're","there've","thorough","thoughts","thousand","together","trillion","unlikely","usefully","whatever","whenever","where'll","wherever","whomever","wouldn't","would've","youngest","yourself","ableabout","according","affecting","alongside","available","backwards","beginning","certainly","currently","described","different","downwards","elsewhere","everybody","following","furthered","generally","greetings","hereafter","hopefully","immediate","important","indicated","indicates","interests","invention","meanwhile","microsoft","necessary","neverless","obviously","otherwise","ourselves","pagecount","presented","primarily","regarding","resulting","seriously","shouldn't","should've","similarly","something","sometimes","somewhere","specified","therefore","thereupon","volumtype","whereupon","whichever","accordance","afterwards","apparently","appreciate","associated","beforehand","beginnings","concerning","containing","definitely","especially","everything","everywhere","furthering","importance","interested","particular","presenting","presumably","previously","reasonably","regardless","relatively","specifying","themselves","themselves","thereafter","thoroughly","throughout","underneath","usefulness","whereafter","yourselves","accordingly","appropriate","considering","differently","furthermore","immediately","information","interesting","necessarily","nonetheless","potentially","significant","consequently","nevertheless","particularly","respectively","specifically","successfully","sufficiently","approximately","corresponding","predominantly","significantly","substantially","unfortunately","notwithstanding"] function cleantext(txtin,removenumbers,removesymbols,removewordsmin3, removespaces) { //Remove contractions txtin = txtin.replace(/\'m/g,' am') txtin = txtin.replace(/\'re/g,' are') txtin = txtin.replace(/\'s/g,' is') txtin = txtin.replace(/ain\'t/g,' is not it') txtin = txtin.replace(/n\'t/g,' not') txtin = txtin.replace(/\'ll/g,' will') txtin = txtin.replace(/\'d/g,' would') txtin = txtin.replace(/\'ve/g,' have') txtin = txtin.replace(/r u /g,'are you') txtin = txtin.replace(/\bim\b/g,'i am') txtin = txtin.replace(/\bwhats\b/g,'what is') txtin = txtin.replace(/\bwheres\b/g,'where is') txtin = txtin.replace(/\bwhos\b/g,'who is') //Remove numbers if (removenumbers > 0) { for (i=0;i 0) { for (i=0;i 0) { for (i=0;i 0) { txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); txtin = txtin.replace(/ /g," "); } return txtin.trim() }