Example #1
0
        public void WordAndPuncs_Spaces()
        {
            var validChars = ValidCharacters.Load(ksXmlHeader +
                                                  "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc</WordForming>" +
                                                  "<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
                                                  "<Other>-\uFFFCU+0020</Other>" +
                                                  "</ValidCharacters>", "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            var english            = Cache.ServiceLocator.WritingSystemManager.Get("en");
            var lgCharPropEngineEn = Cache.WritingSystemFactory.get_CharPropEngine(english.Handle);

            FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

            List <WordAndPunct> wordsAndPunc = categorizer.WordAndPuncts(" ");

            Assert.AreEqual(0, wordsAndPunc.Count);

            wordsAndPunc = categorizer.WordAndPuncts("   ");
            Assert.AreEqual(0, wordsAndPunc.Count);
        }
        public void WordAndPuncs_Spaces()
        {
            ValidCharacters validChars = ValidCharacters.Load(ksXmlHeader +
                                                              "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc</WordForming>" +
                                                              "<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
                                                              "<Other>-\uFFFCU+0020</Other>" +
                                                              "</ValidCharacters>", "Test WS", null);

            ILgCharacterPropertyEngine lgCharPropEngineEn = (ILgCharacterPropertyEngine)
                                                            m_cache.Cache.LanguageWritingSystemFactoryAccessor.get_CharPropEngine(
                InMemoryFdoCache.s_wsHvos.En);

            FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

            List <WordAndPunct> wordsAndPunc = categorizer.WordAndPuncts(" ");

            Assert.AreEqual(0, wordsAndPunc.Count);

            wordsAndPunc = categorizer.WordAndPuncts("   ");
            Assert.AreEqual(0, wordsAndPunc.Count);
        }
Example #3
0
        public void WordAndPuncs_OverridePunc()
        {
            var validChars = ValidCharacters.Load(ksXmlHeader +
                                                  "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd\uFFFCe\uFFFC.</WordForming>" +
                                                  "<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
                                                  "<Other>'\uFFFC-\uFFFC#</Other>" +
                                                  "</ValidCharacters>", "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            ILgCharacterPropertyEngine lgCharPropEngineEn = Cache.WritingSystemFactory.get_CharPropEngine(
                m_wsEn);

            FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

            List <WordAndPunct> wordsAndPunc = categorizer.WordAndPuncts("abc.de");

            // We expect one word to be returned.
            Assert.AreEqual(1, wordsAndPunc.Count);
            Assert.AreEqual("abc.de", wordsAndPunc[0].Word);
        }
Example #4
0
        public void WordAndPuncs_EmptyString()
        {
            var validChars = ValidCharacters.Load(ksXmlHeader +
                                                  "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc</WordForming>" +
                                                  "<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
                                                  "<Other>-\uFFFCU+0020</Other>" +
                                                  "</ValidCharacters>", "Test WS", null, null);
            var english            = Cache.ServiceLocator.WritingSystemManager.Get("en");
            var lgCharPropEngineEn = Cache.WritingSystemFactory.get_CharPropEngine(
                english.Handle);

            FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

            List <WordAndPunct> wordsAndPunc = categorizer.WordAndPuncts("");

            // We expect one word to be returned.
            Assert.AreEqual(0, wordsAndPunc.Count);
        }
		public void WordAndPuncs_OverridePunc()
		{
			var validChars = ValidCharacters.Load(ksXmlHeader +
				"<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd\uFFFCe\uFFFC.</WordForming>" +
				"<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
				"<Other>'\uFFFC-\uFFFC#</Other>" +
				"</ValidCharacters>", "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
			ILgCharacterPropertyEngine lgCharPropEngineEn = Cache.WritingSystemFactory.get_CharPropEngine(
				m_wsEn);

			FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

			List<WordAndPunct> wordsAndPunc = categorizer.WordAndPuncts("abc.de");

			// We expect one word to be returned.
			Assert.AreEqual(1, wordsAndPunc.Count);
			Assert.AreEqual("abc.de", wordsAndPunc[0].Word);
		}
        public void WordAndPuncs_OverridePunc()
        {
            ValidCharacters validChars = ValidCharacters.Load(ksXmlHeader +
                                                              "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd\uFFFCe\uFFFC.</WordForming>" +
                                                              "<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
                                                              "<Other>'\uFFFC-\uFFFC#</Other>" +
                                                              "</ValidCharacters>", "Test WS", null);

            ILgCharacterPropertyEngine lgCharPropEngineEn = (ILgCharacterPropertyEngine)
                                                            m_cache.Cache.LanguageWritingSystemFactoryAccessor.get_CharPropEngine(
                InMemoryFdoCache.s_wsHvos.En);

            FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

            List <WordAndPunct> wordsAndPunc = categorizer.WordAndPuncts("abc.de");

            // We expect one word to be returned.
            Assert.AreEqual(1, wordsAndPunc.Count);
            Assert.AreEqual("abc.de", wordsAndPunc[0].Word);
        }
		public void WordAndPuncs_EmptyString()
		{
			var validChars = ValidCharacters.Load(ksXmlHeader +
				"<ValidCharacters><WordForming>a\uFFFCb\uFFFCc</WordForming>" +
				"<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
				"<Other>-\uFFFCU+0020</Other>" +
				"</ValidCharacters>", "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
			var english = Cache.ServiceLocator.WritingSystemManager.Get("en");
			var lgCharPropEngineEn = Cache.WritingSystemFactory.get_CharPropEngine(
				english.Handle);

			FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

			List<WordAndPunct> wordsAndPunc = categorizer.WordAndPuncts("");

			// We expect one word to be returned.
			Assert.AreEqual(0, wordsAndPunc.Count);
		}