Пример #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
 /// <summary>
 /// Returns the number of actions defined by this context.
 /// </summary>
 public int GetNumberOfActions(string context)
 {
     return(VowpalWabbitJsonSerializer.GetNumberOfActionDependentExamples(context));
 }