Exemplo n.º 1
0
		public void BestFoundNotPartial()
		{
			WordBreakGuesserTester tester = new WordBreakGuesserTester();
			tester.Init(new List<string> {"the", "there","is"});
			int[] breakLocs = tester.BreakResults("thereis");
			Assert.True(breakLocs.Length == 2); //we should have found 2 words
			Assert.True(breakLocs[0] == 0 && breakLocs[1] == 5);//there at index 0, and is at index 5
		}
Exemplo n.º 2
0
		public void BestFoundPunctuationTest()
		{
			WordBreakGuesserTester tester = new WordBreakGuesserTester();
			tester.Init(new List<string> { "there", "isn't", "a", "problem", "is", "this", "fail" });
			int[] breakLocs = tester.BreakResults("thereisn'tapunctuationproblem,isthere?thisshould'tfailifthereis");
			Assert.True(breakLocs.Length == 11); //we should have found thirteen words
			//there at index 0, isn't at 5, a at 10, is at 61
			Assert.True(breakLocs[0] == 0 && breakLocs[1] == 5 && breakLocs[2] == 10 && breakLocs[10] == 61);
		}
Exemplo n.º 3
0
		public void BestFoundMoreRobust()
		{
			WordBreakGuesserTester tester = new WordBreakGuesserTester();
			tester.Init(new List<string> { "the", "he", "here", "a", "there", "is", "rest", "easy" });
			int[] breakLocs = tester.BreakResults("therestiseasy");
			Assert.True(breakLocs.Length == 4); //we should have found four words
			//the at index 0, rest at 3, is at 7, easy at 9
			Assert.True(breakLocs[0] == 0 && breakLocs[1] == 3 && breakLocs[2] == 7 && breakLocs[3] == 9);
		}
Exemplo n.º 4
0
        public void SkipFalseWholeSentenceWord()
        {
            WordBreakGuesserTester tester = new WordBreakGuesserTester();

            tester.Init(new List <string> {
                "thisisnotaword"
            });
            int[] breakLocs = tester.BreakResults("thisisnotaword");
            Assert.True(breakLocs.Length == 0);
        }
Exemplo n.º 5
0
        public void BestFoundNotPartial()
        {
            WordBreakGuesserTester tester = new WordBreakGuesserTester();

            tester.Init(new List <string> {
                "the", "there", "is"
            });
            int[] breakLocs = tester.BreakResults("thereis");
            Assert.True(breakLocs.Length == 2);                  //we should have found 2 words
            Assert.True(breakLocs[0] == 0 && breakLocs[1] == 5); //there at index 0, and is at index 5
        }
Exemplo n.º 6
0
        public void BestFoundPunctuationTest()
        {
            WordBreakGuesserTester tester = new WordBreakGuesserTester();

            tester.Init(new List <string> {
                "there", "isn't", "a", "problem", "is", "this", "fail"
            });
            int[] breakLocs = tester.BreakResults("thereisn'tapunctuationproblem,isthere?thisshould'tfailifthereis");
            Assert.True(breakLocs.Length == 11);             //we should have found thirteen words
            //there at index 0, isn't at 5, a at 10, is at 61
            Assert.True(breakLocs[0] == 0 && breakLocs[1] == 5 && breakLocs[2] == 10 && breakLocs[10] == 61);
        }
Exemplo n.º 7
0
        public void BestFoundMoreRobust()
        {
            WordBreakGuesserTester tester = new WordBreakGuesserTester();

            tester.Init(new List <string> {
                "the", "he", "here", "a", "there", "is", "rest", "easy"
            });
            int[] breakLocs = tester.BreakResults("therestiseasy");
            Assert.True(breakLocs.Length == 4);             //we should have found four words
            //the at index 0, rest at 3, is at 7, easy at 9
            Assert.True(breakLocs[0] == 0 && breakLocs[1] == 3 && breakLocs[2] == 7 && breakLocs[3] == 9);
        }
Exemplo n.º 8
0
		public void DontDieOnLongData()
		{
			WordBreakGuesserTester tester = new WordBreakGuesserTester();
			tester.Init(new List<string> { "the", "a", "is", "rest", "easy", "that", "for", "there", "on"});
			int[] breakLocs = tester.BreakResults("fourscoreandsevenyearsagoourforefathersbroughtforthonthiscontinentanewnationconcievedinliberty" +
												  "anddedicatedtothepropsitionthatallmenarecreatedequalnowweareengagedinagreatcivilwartestingwhether" +
												  "thatnationoranynationsoconceivedandsodedicatedcanlongendourewearemetonagreatbattlefieldofthatwar" +
												  "wehavecometodedicateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthat" +
												  "nationmightliveitisaltogetherfittingandproperthatweshoulddothisbutinalargersensewecannotdedicate" +
												  "wecannotconsecratewecannothallowthisgroundthebravemenlivinganddeadwhostruggledherehaveconsecrated" +
												  "itfaraboveourpoorpowertoaddordetracttheworldwilllittlenotenorlongrememberwhatwesayherebutitcannever" +
												  "forgetwhattheydidhereitisforusthelivingrathertobededicatedheeretotheunfinishedworkwhichtheywhofought" +
												  "herehavethusfarsonoblyadvanceditisratherforustobeherededicatedtothegreattaskremainingbeforeusthatfrom" +
												  "thesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastfullmeasureofdevotion" +
												  "thatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunderGodshallhaveanewbirth" +
												  "offreedomandthatgovernmentofthepeoplebythepeopleandforthepeopleshallnotperishfromtheearth");
			Assert.True(breakLocs.Length == 165); //we should have found 165 words
		}
Exemplo n.º 9
0
        public void DontDieOnLongData()
        {
            WordBreakGuesserTester tester = new WordBreakGuesserTester();

            tester.Init(new List <string> {
                "the", "a", "is", "rest", "easy", "that", "for", "there", "on"
            });
            int[] breakLocs = tester.BreakResults("fourscoreandsevenyearsagoourforefathersbroughtforthonthiscontinentanewnationconcievedinliberty" +
                                                  "anddedicatedtothepropsitionthatallmenarecreatedequalnowweareengagedinagreatcivilwartestingwhether" +
                                                  "thatnationoranynationsoconceivedandsodedicatedcanlongendourewearemetonagreatbattlefieldofthatwar" +
                                                  "wehavecometodedicateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthat" +
                                                  "nationmightliveitisaltogetherfittingandproperthatweshoulddothisbutinalargersensewecannotdedicate" +
                                                  "wecannotconsecratewecannothallowthisgroundthebravemenlivinganddeadwhostruggledherehaveconsecrated" +
                                                  "itfaraboveourpoorpowertoaddordetracttheworldwilllittlenotenorlongrememberwhatwesayherebutitcannever" +
                                                  "forgetwhattheydidhereitisforusthelivingrathertobededicatedheeretotheunfinishedworkwhichtheywhofought" +
                                                  "herehavethusfarsonoblyadvanceditisratherforustobeherededicatedtothegreattaskremainingbeforeusthatfrom" +
                                                  "thesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastfullmeasureofdevotion" +
                                                  "thatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunderGodshallhaveanewbirth" +
                                                  "offreedomandthatgovernmentofthepeoplebythepeopleandforthepeopleshallnotperishfromtheearth");
            Assert.True(breakLocs.Length == 165);             //we should have found 165 words
        }
Exemplo n.º 10
0
		public void SkipFalseWholeSentenceWord()
		{
			WordBreakGuesserTester tester = new WordBreakGuesserTester();
			tester.Init(new List<string> { "thisisnotaword" });
			int[] breakLocs = tester.BreakResults("thisisnotaword");
			Assert.True(breakLocs.Length == 0);
		}