Beispiel #1
0
 public void TestLoadInvalidRessource()
 {
     try
     {
         RuleLoader.LoadFromRessource("invalidName");
         Assert.Fail("ArgumentException expected");
     }
     catch (ArgumentException)
     {
     }
 }
Beispiel #2
0
        public void TestSimpleGerman2()
        {
            Phonetizer p = new Phonetizer();

            p.Rules = RuleLoader.LoadFromRessource("phonet4n.Core.german_2.csv");
            Assert.AreEqual(919 * 3, p.Rules.Length);

            Assert.AreEqual("NEIA", p.Phonetize("Meier"));
            Assert.AreEqual("NEIA", p.Phonetize("Mayer"));
            Assert.AreEqual("FEIFA", p.Phonetize("Pfeiffer"));
            Assert.AreEqual("FEIFA", p.Phonetize("Pfeifer"));
        }
Beispiel #3
0
        public void TestRecurringDigits_Strip()
        {
            Phonetizer p = new Phonetizer(false);

            p.Rules = RuleLoader.LoadFromRessource("phonet4n.Core.german_1.csv");
            Assert.AreEqual(919 * 3, p.Rules.Length);

            Assert.AreEqual("TEST01", p.Phonetize("Teest01"));
            Assert.AreEqual("TEST01", p.Phonetize("Teest001"));
            Assert.AreEqual("0123456789", p.Phonetize("00112233445566778899"));
            Assert.AreEqual("0", p.Phonetize("0000"));
        }
Beispiel #4
0
        public void TestLoadRessources()
        {
            string[] res1 = RuleLoader.LoadFromRessource("phonet4n.Core.german_1.csv");
            Assert.AreEqual(RuleLoader.DefaultRules, res1);

            string[] csv1 = RuleLoader.LoadFromCSV("../../rules/german_1.csv");
            Assert.AreEqual(res1, csv1);

            string[] res2 = RuleLoader.LoadFromRessource("phonet4n.Core.german_2.csv");
            string[] csv2 = RuleLoader.LoadFromCSV("../../rules/german_2.csv");
            Assert.AreEqual(res2, csv2);

            Assert.AreNotEqual(res1, res2);
        }