← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #203262]: Iterating through a tree

 

Question #203262 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/203262

Dave Marsden posted a new comment:
Found an even simpler solution to the missing first space. Again playing
with python I wrote the following code

word_set = set(line.strip().lower() for line in open('words'))

def isWord(word):
	return word.lower() in word_set


def splitWord(word):
	l = len(word)
	lword = word.lower()
	for n in range(0,l):
		if isWord(lword[:n]) and isWord(lword[n:]):
			return word[:n]+' '+word[n:]

print splitWord("Brakefluid")

My wordlist came from my Linux box that I use day to day, when the wife
has finished playing with facebook on the XP machine I'll try using the
code in sikuli see how it fares. I need to add something to the code to
cope with leading numbers as is fairly common in my situation i.e. "10
Brake System" like a section number would be "10Brake System" from the
OCR and not recognised by my word splitter.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.