public void Map(string key, string value, IMapperCollector collector) { var r = new Random(); var x = -1.0 + (r.NextDouble() * 2.0); var y = -1.0 + (r.NextDouble() * 2.0); var d = x * x + y * y; if (d >= 1.0) return; collector.Collect("x", "1"); }
public void Map(string key, string value, IMapperCollector collector) { // key = dummy // value = full file path // Console.WriteLine("Mapper started: key="+key+", value="+value); var words = value.Trim().Split(new[] { ' ', ',', ';', '.', '\n', '\r', '\t', '\"', '(', ')', '/', '\\', '{', '}', '[', ']', ':', '<','>','-', '+', '!', '#', '$', '!', '?' }); for (int i = 0; i < words.Length; i++) { // if (i % 5 == 0 && i > 0) // Console.WriteLine("mapper for " + key + ": " + i + " of " + words.Length + " done."); var tag = words[i]; var tag2 = NormalizeString(tag).ToLower().Trim(); if (tag2.Length > 2 && tag2.Length < 40) if (tag2 != "") collector.Collect(tag2, "1"); } // Console.WriteLine("Mapper done."); }
public void Map(string key, string value, IMapperCollector collector) { collector.Collect(value, key); }