def screenwords(imgdata):
 if (config.TESSERACT_CMD is not None):
  proc = subprocess.Popen([config.TESSERACT_CMD, 'stdin', 'stdout'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  proc.stdin.write(imgdata)
  proc.stdin.close()
  words = set()
  result = []
  size = MAXVALLEN
  for line in proc.stdout:
   if (size == 0):
    break
   for word in line.split():
    if (word not in words):
     if (len(word) <= size):
      words.add(word)
      result.append(word)
      size -= len(word)
     else:
      size = 0
      break
  if result:
   return result

def screenwords ( imgdata ) : if ( config . TESSERACT_CMD is not None ) : proc = subprocess . Popen ( [ config . TESSERACT_CMD , 'stdin' , 'stdout' ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE ) proc . stdin . write ( imgdata ) proc . stdin . close ( ) words = set ( ) result = [ ] size = MAXVALLEN for line in proc . stdout : if ( size == 0 ) : break for word in line . split ( ) : if ( word not in words ) : if ( len ( word ) <= size ) : words . add ( word ) result . append ( word ) size -= len ( word ) else : size = 0 break if result : return result
takes an image and returns a list of the words seen by the ocr .