Hi,
I want sample sode for stemming txt file using stemming algorithem in c# windows or Asp.net.
Stemming means,If i enter "playing cicket" the algorithen return
"play","cricket"
it remove ing ,ed,and join words etc.
some example
watched->watch
crying->cry
dangerous->danger
MHD Fawaz EnayaPosted Mar 10, 2009, 1:54 PM
http://tartarus.org/~martin/PorterStemmer/
Bechir BejaouiPosted Feb 12, 2009, 5:02 AM
First you add the namespace
System.Text.RegularExpressions
Then you have to stock all suffixes within a data base or a table. I put them in an array to simplify the issue. Then you retrive all sufixes in a list. You retrieve also all targeted words in a list here an example of what to do exactly:
string[] instances = {"hopeless","powerful","freedom"};
string[] suffixes = { "less", "ful", "dom" };
string result = "";
foreach (string instance in instances)
{
foreach (string suffix in suffixes)
{
if (Regex.IsMatch(instance, suffix))
{
result = Regex.Replace(instance, suffix, "", RegexOptions.None);
Console.WriteLine(result);
}
}
}
Console.WriteLine("The job is done");
Console.Read();
Posted Feb 11, 2009, 11:36 PM
Hi,
Stemming means,If i enter "playing cicket" the algorithen return
"play","cricket"
it remove ing ,ed,and join words etc.
some example
watched->watch
crying->cry
dangerous->danger
Bechir BejaouiPosted Feb 11, 2009, 4:47 PM