← 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:
This is my final version of the checking code incase it helps anyone
else struggling with the OCR

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

def is_number(s):
    try:
        float(s)
        return True
    except ValueError:
        return False

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:])) or (is_number(lword[:n]) and isWord(lword[n:])):
			return word[:n]+' '+word[n:]

print splitWord("1.04fluid")

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