示例#1
0
        public void TestJsonNumADFs()
        {
            using (var validator = new VowpalWabbitExampleJsonValidator(""))
            {
                Assert.AreEqual(2,
                                VowpalWabbitJsonSerializer.GetNumberOfActionDependentExamples(
                                    "{\"_text\":\"a b c\",\"a\":{\"_text\":\"d e f\"},_multi:[{\"a\":1},{\"b\":2,\"c\":3}]}"));

                Assert.AreEqual(0,
                                VowpalWabbitJsonSerializer.GetNumberOfActionDependentExamples(
                                    "{\"_text\":\"a b c\",\"a\":{\"_text\":\"d e f\"},_multi:[]}"));

                Assert.AreEqual(0,
                                VowpalWabbitJsonSerializer.GetNumberOfActionDependentExamples(
                                    "{\"_text\":\"a b c\",\"a\":{\"_text\":\"d e f\"}}"));
            }
        }
示例#2
0
文件: VWJson.cs 项目: yannstad/mwt-ds
 /// <summary>
 /// Returns the number of actions defined by this context.
 /// </summary>
 public int GetNumberOfActions(string context)
 {
     return(VowpalWabbitJsonSerializer.GetNumberOfActionDependentExamples(context));
 }