public void TestJsonToVWString() { var jsonContext = new JsonContext() { Label = new SimpleLabel { Label = 25 }, Ns1 = new Namespace1 { Foo = 1, Age = "25", DontConsider = "XXX" }, Ns2 = new Namespace2 { FeatureA = true }, Clicks = 5 }; var jsonContextString = JsonConvert.SerializeObject(jsonContext); using (var validator = new VowpalWabbitExampleJsonValidator("")) { validator.Validate("25 |a Bar:1 Age25 |b Marker | Clicks:5 MoreClicks:0", jsonContextString, VowpalWabbitLabelComparator.Simple); } }
public void TestJsonToVWString() { var jsonContext = new JsonContext() { Label = new SimpleLabel { Label = 25 }, Ns1 = new Namespace1 { Foo = 1, Age = "25", DontConsider = "XXX", EscapeCharacterString = "a: a | a\ta", EscapeCharactersText = "b: b | b\tb" }, Ns2 = new Namespace2 { FeatureA = true }, Clicks = 5 }; var jsonContextString = JsonConvert.SerializeObject(jsonContext); using (var validator = new VowpalWabbitExampleJsonValidator(new VowpalWabbitSettings { Arguments = "--json", EnableStringExampleGeneration = true, EnableStringFloatCompact = true, EnableThreadSafeExamplePooling = true })) { validator.Validate("25 | Clicks:5 MoreClicks:0 |a Bar:1 Age25 EscapeCharacterStringa__a___a_a b_ b _ b b |b Marker", jsonContextString, VowpalWabbitLabelComparator.Simple); } }