public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Dictionary<string, object> analyzerDict = serializer.Deserialize<Dictionary<string, object>>(reader);
            Dictionary<string, object> fieldDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(analyzerDict.First().Value.ToString());

            SnowballAnalyzer analyzer = new SnowballAnalyzer(analyzerDict.First().Key);
            AnalyzerBase.Deserialize(analyzer, fieldDict);
            analyzer.Language = SnowballLanguageEnum.Find(fieldDict.GetString(_LANGUAGE, SnowballAnalyzer._LANGUAGE_DEFAULT.ToString()));
            if (fieldDict.ContainsKey(_STOPWORDS))
            {
                string stopwordsStr = fieldDict.GetString(_STOPWORDS);
                if (stopwordsStr.Equals(SnowballAnalyzer._EMPTY_STOPWORDS_DEFAULT))
                {
                    analyzer.Stopwords = new List<string>();
                }
                else
                {
                    analyzer.Stopwords = JsonConvert.DeserializeObject<IEnumerable<string>>(stopwordsStr);
                }
            }

            analyzer.StopwordsPath = fieldDict.GetStringOrDefault(_STOPWORDS_PATH);

            return analyzer;
        }
        public void PASS_Serialize_No_Stopwords()
        {
            SnowballAnalyzer analyzer = new SnowballAnalyzer("name")
            {
                Version = 4.6,
                Language = SnowballLanguageEnum.Finnish,
                StopwordsPath = "path",
                Stopwords = new List<string>(),
                Aliases = new List<string>() { "alias1", "alias2" }
            };

            string json = JsonConvert.SerializeObject(analyzer);
            Assert.IsNotNull(json);

            string expectedJson = "{\"name\":{\"type\":\"snowball\",\"version\":4.6,\"aliases\":[\"alias1\",\"alias2\"],\"language\":\"Finnish\",\"stopwords\":\"_none_\",\"stopwords_path\":\"path\"}}";
            Assert.AreEqual(expectedJson, json);
        }
        public void PASS_Create()
        {
            SnowballAnalyzer analyzer = new SnowballAnalyzer("name")
            {
                Version = 4.6,
                Language = SnowballLanguageEnum.Finnish,
                Stopwords = new List<string>() { "stop1", "stop2" },
                Aliases = new List<string>() { "alias1", "alias2" },
                StopwordsPath = "path"
            };

            Assert.IsNotNull(analyzer);
            Assert.AreEqual("name", analyzer.Name);
            Assert.AreEqual(4.6, analyzer.Version);
            Assert.AreEqual("path", analyzer.StopwordsPath);
            Assert.AreEqual(SnowballLanguageEnum.Finnish, analyzer.Language);
            Assert.AreEqual("stop1", analyzer.Stopwords.First());
            Assert.AreEqual("stop2", analyzer.Stopwords.Last());
            Assert.AreEqual("alias1", analyzer.Aliases.First());
            Assert.AreEqual("alias2", analyzer.Aliases.Last());
        }