コード例 #1
0
        public void TestDefaults()
        {
            DoubleMetaphoneFilterFactory factory = new DoubleMetaphoneFilterFactory(new Dictionary <String, String>());
            TokenStream inputStream = new MockTokenizer(new StringReader("international"), MockTokenizer.WHITESPACE, false);

            TokenStream filteredStream = factory.Create(inputStream);

            assertEquals(typeof(DoubleMetaphoneFilter), filteredStream.GetType());
            AssertTokenStreamContents(filteredStream, new String[] { "international", "ANTR" });
        }
コード例 #2
0
        public void TestSettingSizeAndInject()
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["inject"]        = "false";
            parameters["maxCodeLength"] = "8";
            DoubleMetaphoneFilterFactory factory = new DoubleMetaphoneFilterFactory(parameters);

            TokenStream inputStream = new MockTokenizer(new StringReader("international"), MockTokenizer.WHITESPACE, false);

            TokenStream filteredStream = factory.Create(inputStream);

            assertEquals(typeof(DoubleMetaphoneFilter), filteredStream.GetType());
            AssertTokenStreamContents(filteredStream, new String[] { "ANTRNXNL" });
        }