I MAKE : I want to find special words from programming domain (HTML,JavaScript,Back-end...) in big text (1000+ words) and put all programming words that I find to the new array
PROBLEM : In my mind there is yet only one way to do this.
- Write VERY BIG array with programming words
- Write a cycle that will compare every word from BIG TEXT with words from BIG ARRAY (with programming words)
But I think there is some solution that greatly simplify the task.
Any idea how to make this MORE easier ?
I write on server JavaScript
EDIT : guys i know about indexOf and etc. thank you but i want to find
- Very fast algorithm to do it
- How can I avoid writing the programming words (500+)
"SOLVED :" I found underscore.js Example :
var tagsObject = {
"Java":"JAVA",
"J2EE":"J2EE"
}
var words = "Java is a big language ! ! "
var words = content.split(/\b/); // make array
words = _.uniq(words); // make array with uniq words
console.log( _.intersection(words,_.keys(tagsObject))); // Computes the list of values that are the intersection of all the arrays, return array
//_.keys(tagsObject) - return array with keys