コード例 #1
0
        private static void CheckJsonEquivalent(StringTokens tokens, TokenPredictor l, TokenPredictor r)
        {
            var lString = l.ToJson(tokens);
            var rString = r.ToJson(tokens);

            Assert.AreEqual(lString, rString);
        }
コード例 #2
0
        public void CreateAlphabetTest()
        {
            var tokens    = new StringTokens();
            var predictor = new TokenPredictor(3);

            List <int> alphabet = GetAlphabet(tokens);

            predictor.AddSequence(alphabet, 1);

            var json = predictor.ToJson(tokens);

            Assert.AreEqual(AlphabetJson, json);
        }
コード例 #3
0
        public void CreateAlphabetLetterByLetterTest()
        {
            var tokens    = new StringTokens();
            var predictor = new TokenPredictor(3);

            var alphabet = GetAlphabet(tokens);

            var incrementalAlphabet = new List <int>();

            foreach (var token in alphabet)
            {
                incrementalAlphabet.Add(token);
                predictor.AddSequenceTail(incrementalAlphabet, 1);
            }

            var json = predictor.ToJson(tokens);

            Assert.AreEqual(AlphabetJson, json);
        }