public Document ToDoc(Func <Case, string> classSelector, Func <Case, string> textSelector) { return(new Document { Class = new Class { Name = classSelector(this) }, Words = VocabBuilder.Tokenize(textSelector(this)).Words }); }
public static List <Document> Parse(string source, string @class) { var serialized = JsonConvert.DeserializeObject <JObject>(source); return((serialized["items"] as JArray).Select(token => new Document { Words = VocabBuilder.Tokenize(token["title"].ToString()).Words, Class = new Class { Name = @class } }).ToList()); }