예제 #1
0
 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
     });
 }
예제 #2
0
        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());
        }