Instead of going through each hints in the hints XML, and searching for the word in a text, go through each word of the text, and find the hint in the hints XML. This will fix the cases discussed in #21. Also, this is reduce the runtime if there are significantly greater number of hints in the hints XML than the words in a text.
Current implementation (pseudocode):
for (word, hint) in hintsXML {
let location = text.find(word)
text.add(hint, in: location)
}
Intended implementation:
for (locationOfWord, word) in text {
let hint = hintsXML[word]
text.add(hint, in: locationOfWord)
}
Instead of going through each hints in the hints XML, and searching for the word in a text, go through each word of the text, and find the hint in the hints XML. This will fix the cases discussed in #21. Also, this is reduce the runtime if there are significantly greater number of hints in the hints XML than the words in a text.
Current implementation (pseudocode):
Intended implementation: