What does scoring an array of strings means? Does it mean checking for repeat count of every element?
A:
Func<string, int> scoringFunction;
this is scoring function, you will get it in the constructor, they did not said how it should score strings
public class MyClass
{
public void NextString(); // i really don't know what this function is supposed to do
{
string input = Console.ReadLine();
// maybe check here if _filter(input) == true
MyStrings.Add(input);
}
public List<string> MyStrings = new List<string>();
private int _n;
private Func<string, bool> _filter
private Func<string, int> _score
public MyClass(int n, Func<string, bool> filter, Func<string, int> score)
{
_n = n;
_filter = filter;
_score = score;
}
public IEnumerable<string> DoScoring()
{
return MyString.Where(_filter).OrderBy(_score).Take(_n);
}
}
of course this is very slow (and they said they will have "very large number" of strings)
Kikaimaru
2010-08-19 09:51:50
I guess we need to use Relection API (IMO) to call validate and scoring functions.
2010-08-19 10:27:30
why? edited....
Kikaimaru
2010-08-19 10:40:20
I guess NextString supposed to call Validate/filter function and if it returns true then it need to call Score function
2010-08-19 10:50:16
that sounds possible, but what thould N mean?
Kikaimaru
2010-08-19 11:00:45
I guess N used to retrieve top N results of top scoring strings
2010-08-19 11:05:15
A:
Someone on this forum: http://www.webdeveloper.com/forum/showthread.php?t=194986 has the same opinion as you. Score (an array) is counting how many times each value appears.
helios
2010-08-19 09:54:04