Ejemplo n.º 1
0
 public RawWord[] parseSourceIntoRawWords(string source)
 {
     StringBuilder strippedSource = stripAndCleanSource(source);
     string[] wordStrings = parseCleanedSourceIntoWordStrings(strippedSource);
     //	Convert to RawWord objects.
     RawWord[] outRawWords = new RawWord[wordStrings.Length];
     int i=0;
     foreach (string wordString in wordStrings)
     {
         outRawWords[i] = RawWord.new_FromString(wordString);
         i++;
     }
     return outRawWords;
 }
Ejemplo n.º 2
0
 //    Return an object depending only on the contents of the words.
 public Word new_WordFromWords(RawWord[] words)
 {
     //	Look for the word in the trie
     Word foundWord = wordTrie.getValue(words);
     //	If it isn't there, add it
     if (foundWord == null)
     {
         Word newWord = new Word(words);				//	Create the word
         wordTrie.putObjectString(words, newWord);	//	Put the word into the Trie with address = words
         return newWord;
     }
     else
         return foundWord;
 }
Ejemplo n.º 3
0
        public RawWord[] parseSourceIntoRawWords(string source)
        {
            StringBuilder strippedSource = stripAndCleanSource(source);

            string[] wordStrings = parseCleanedSourceIntoWordStrings(strippedSource);
            //	Convert to RawWord objects.
            RawWord[] outRawWords = new RawWord[wordStrings.Length];
            int       i           = 0;

            foreach (string wordString in wordStrings)
            {
                outRawWords[i] = RawWord.new_FromString(wordString);
                i++;
            }
            return(outRawWords);
        }
Ejemplo n.º 4
0
        public bool addWordFromStrings(string[] rawStrings)
        {
            //	Convert to RawWord objects.
            List<RawWord[]> rawWordList = new List<RawWord[]>();

            RawWord[] rawWords = new RawWord[rawStrings.Length];
            int i=0;
            foreach(string s in rawStrings)
            {
                rawWords[i] = RawWord.new_FromString(s);
                i++;
            }
            rawWordList.Add(rawWords);

            //	Add the
            return wordTrie.putObjectString(rawWords, new_WordFromWords(rawWords));
        }
Ejemplo n.º 5
0
        public bool addWordFromStrings(string[] rawStrings)
        {
            //	Convert to RawWord objects.
            List <RawWord[]> rawWordList = new List <RawWord[]>();

            RawWord[] rawWords = new RawWord[rawStrings.Length];
            int       i        = 0;

            foreach (string s in rawStrings)
            {
                rawWords[i] = RawWord.new_FromString(s);
                i++;
            }
            rawWordList.Add(rawWords);

            //	Add the
            return(wordTrie.putObjectString(rawWords, new_WordFromWords(rawWords)));
        }
Ejemplo n.º 6
0
 public Word lookupWordFromRawWords(RawWord[] words)
 {
     return wordTrie.getValue(words);
 }
Ejemplo n.º 7
0
 private void failBecauseWordNotFound(RawWord[] rawWords)
 {
     throw new WordNotFoundException(rawWords, "");
 }