コード例 #1
0
        private static POSDictionary SerializeDeserializeDict(POSDictionary dict) {
            using (var data = new MemoryStream()) {
                dict.Serialize(new UnclosableStream(data));

                data.Seek(0, SeekOrigin.Begin);

                return new POSDictionary(data); 
            }
        }
コード例 #2
0
        private static POSDictionary SerializeDeserializeDict(POSDictionary dict)
        {
            using (var data = new MemoryStream()) {
                dict.Serialize(new UnclosableStream(data));

                data.Seek(0, SeekOrigin.Begin);

                return(new POSDictionary(data));
            }
        }
コード例 #3
0
        public void TestSerialization()
        {
            var dict = new POSDictionary();

            dict.Put("a", "1", "2", "3");
            dict.Put("b", "4", "5", "6");
            dict.Put("c", "7", "8", "9");
            dict.Put("Always", "RB", "NNP");

            Assert.AreEqual(dict, SerializeDeserializeDict(dict));
        }
コード例 #4
0
        public void TestSerialization() {

            var dict = new POSDictionary();

            dict.Put("a", "1", "2", "3");
            dict.Put("b", "4", "5", "6");
            dict.Put("c", "7", "8", "9");
            dict.Put("Always", "RB", "NNP");

            Assert.AreEqual(dict, SerializeDeserializeDict(dict));
        }
コード例 #5
0
 protected void ValidatePOSDictionary(POSDictionary posDic, AbstractModel posModel) {
     if (!posModel.ContainsOutcomes(posDic)) {
         throw new InvalidFormatException("Tag dictionary contains tags which are unknown by the model!");
     }
 }