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; }
// 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; }
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); }
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)); }
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))); }
public Word lookupWordFromRawWords(RawWord[] words) { return wordTrie.getValue(words); }
private void failBecauseWordNotFound(RawWord[] rawWords) { throw new WordNotFoundException(rawWords, ""); }