C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Noise Words


Posted Date: 28 Aug 2008    Resource Type: Code Snippets    Category: Validations

Posted By: Geetha       Member Level: Gold
Rating:     Points: 10



A noise word is a word such as the or if that is so common that it is not useful in searches.

To Find the Noise words occurrence in a given string split the string and then compare each string in the array with the noise words list.

FindWordNoise method is to split the search string and it will call the FindNoise method to compare the words with the noise words list. If the string contains noise word then the return value at last will be 1.


private int FindWordNoise(string src)
{
int ret = 0;
string Delimiter = "' ";
string[] words = src.Split(Delimiter.ToCharArray());
for (int i = 0; i < words.Length; i++)
{
int srchresult = FindNoise(words[i].Trim());
if (srchresult == 1)
{
ret = 1;
break;
}
}
return ret;
}

private int FindNoise(string src)
{
int ret = 0;
string[] parm = { "<", ">", "-", "=", "/", "&", "(", ")", ",", "%", "the", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "$", "a", "about", "after", "all", "also", "an", "and", "another", "any", "are", "as", "at", "b", "be", "because", "been", "before", "being", "between", "both", "but", "by", "c", "came", "can", "come", "could", "d", "did", "do", "does", "e", "each", "else", "f", "for", "from", "g", "get", "got", "h", "had", "has", "have", "he", "her", "here", "him", "himself", "his", "how", "i", "if", "in", "into", "is", "it", "its", "j", "just", "k", "l", "like", "m", "make", "many", "me", "might", "more", "most", "much", "must", "my", "n", "never", "now", "o", "of", "on", "only", "or", "other", "our", "out", "over", "p", "q", "r", "re", "s", "said", "same", "see", "should", "since", "so", "some", "still", "such", "t", "take", "Test", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "those", "through", "to", "too", "u", "under", "up", "use", "v", "very", "w", "want", "was", "way", "we", "well", "were", "what", "when", "where", "which", "while", "who", "will", "with", "would", "x", "y", "you", "your", "z" };
for (int i = 0; i < parm.Length; i++)
{
if (src == parm[i])
{
ret = 1;
return ret;
}
}
return ret;
}





Responses

Author: Shivashankar Chincholi    18 Sep 2008Member Level: Gold   Points : 0
Hi Geetha,


Usefull code.

Regards
Shivu...


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Search Strings  .  Noise Words  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Validating Guid
Previous Resource: Using Cookies in Asp.NET
Return to Discussion Resource Index
Post New Resource
Category: Validations


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

efax

Contact Us    Privacy Policy    Terms Of Use