本文整理汇总了Python中analyzer.Analyzer.load方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.load方法的具体用法?Python Analyzer.load怎么用?Python Analyzer.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pickup
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import load [as 别名]
def pickup(self):
# создаем браузер, которым будем ходить по wmtake.ru
b = Browser()
# сщздаем анализатор, которым будем распознавать капчу
a = Analyzer(self.site, self.symsize, self.charset)
a.load()
b.show()
log.debug('LOADING PAGE WITH WM BONUS')
b.get('http://wmtake.ru/m.base/bonus.php')
while(True):
log.debug('SAVING CAPTCHA')
captcha = b.js('$("#scode-pic img")[0].src')
#b.save(captcha, '/home/polzuka/inspirado/captcha/wmtake/%02d.gif' % i)
log.debug('CAPTCHA TRANSFORMING')
try:
t = Transformer('orig', b.image(captcha))
t.resizeby('resize', t['orig'], 2, 2)
t.grayscale('grayscale', t['resize'], 2)
t.binarize('binarize', t['grayscale'], 150, CV_THRESH_BINARY_INV)
t.contourSplit('breaksplit', t['binarize'], 0.001)
if len(t.symbols) != self.symqty:
raise Exception
except Exception, e:
log.debug(e)
log.debug(colorize('INCORRECT SYMBOL NUMBER', RED))
log.debug('LOADING PAGE WITH WM BONUS')
b.get('http://wmtake.ru/m.base/bonus.php')
continue
t.normolize('origsplit', 'breaksplit', self.symsize)
symbols = t.slice('origsplit')
log.debug('RECOGNITION CAPTCHA')
code = a.captcha(symbols)
log.debug('ANALYZE RESULT: %s' % colorize(code))
del t
print code
log.debug('FILLING FIELDS')
b.js("$('#scode').val('%s')" % code)
b.js("$('#purse').val('R%s')" % self.purse)
b.js("$('div.news_box div.bn p').click()")
b.sleep(10)
if not b.js("$('#mess-exec:visible').length"):
log.debug('FINISH')
break
log.debug('INCORRECT CAPCTHA RECOGNITION')
log.debug('LOADING PAGE WITH WM BONUS')
b.js("$('#mess-exec p').click()")
示例2: picup
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import load [as 别名]
def picup(self):
browser.show()
browser.get('http://wmstream.ru/')
print 'GET PAGE'
browser.sleep(1000)
print 'GET CAPTCHA'
captcha = browser.js('$("#wmbonus_form_captcha img")[0].src')
browser.sleep(1000)
t.load('orig', browser.image(captcha))
t.show()
browser.save(captcha, '/home/polzuka/inspirado/symbols/first')
t.resizeby('resize', t['orig'], 4, 4)
t.grayscale('grayscale', t['resize'], 2)
t.binarize('binarize', t['grayscale'], 200, CV_THRESH_BINARY)
radius = 3
kernel = cvCreateStructuringElementEx(radius * 2 + 1, radius * 2 + 1, radius, radius, CV_SHAPE_ELLIPSE)
t.morphology('morphology', t['binarize'], 1, 1, kernel)
try:
t.breakSplit('breaksplit', t['morphology'], 0.2)
except TransformError:
print 'ololo'
t.normolize('origsplit', 'breaksplit', 20, 30)
sl = t.slice('origsplit')
a = Analyzer(20, 30, '0123456789')
a.load('/home/polzuka/inspirado/fann.data')
code = a.captcha(sl)
print code
print 'GET CLICK'
browser.js('$("#frm_vallet").mousedown()')
browser.js('$("#frm_vallet").mouseup()')
browser.js('$("#frm_vallet").click()')
browser.sleep(1000)
browser.js('$("#frm_vallet").val("%s")' % data['purse'])
browser.js('$("#frm_captcha").mousedown()')
browser.js('$("#frm_captcha").mouseup()')
browser.js('$("#frm_captcha").click()')
for i in xrange(5):
browser.js('$("#frm_captcha").keydown()')
browser.js('$("#frm_captcha").keyup()')
browser.js('$("#frm_captcha").keypress()')
browser.js('$("#frm_captcha").val("%s")' % code)
print 2
browser.js('$("#btn_bonus").click()')
print 3
示例3: pickup
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import load [as 别名]
def pickup(self):
# создаем браузер, которым будем ходить по wmtake.ru
b = Browser()
# создаем анализатор, которым будем распознавать капчу
a = Analyzer(self.site, self.symsize, self.charset)
a.load()
b.show()
while(True):
log.debug('LOADING PAGE WITH WM BONUS')
b.get('http://exchangecity.ru/?cmd=bonus')
log.debug('SAVING CAPTCHA')
captcha = 'http://exchangecity.ru/include/anti_robot.php'
#b.save(captcha, '/home/polzuka/inspirado/captcha/wmtake/%02d.gif' % i)
log.debug('CAPTCHA TRANSFORMING')
t = Transformer('orig', b.image(captcha))
t.resizeby('resize', t['orig'], 2, 2)
t.grayscale('grayscale', t['resize'], 2)
t.binarize('binarize', t['grayscale'], 200, CV_THRESH_BINARY_INV)
t.contourSplit('breaksplit', t['binarize'], 0.001)
if len(t.symbols) != self.symqty:
log.debug(colorize('INCORRECT SYMBOL NUMBER', RED))
continue
t.normolize('origsplit', 'breaksplit', self.symsize)
symbols = t.slice('origsplit')
log.debug('RECOGNITION CAPTCHA')
code = a.captcha(symbols)
log.debug('ANALYZE RESULT: %s' % colorize(code))
del t
print code
log.debug('FILLING FIELDS')
b.js("$('input[name = img]').val('%s')" % code)
b.js("$('input[name = WALLET_BONUS]').val('R%s')" % self.purse)
b.js("$('input[name = get_bonus]').click()")
b.sleep(1)
if not b.js("$('font.textbl:contains(Вы получили бонус в размере)').length"):
log.debug('FINISH')
break
log.debug('INCORRECT CAPCTHA RECOGNITION')
self.quit()
示例4: __init__
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import load [as 别名]
def __init__(self, config: dict):
self._index_name = config.get('inverted-index')
self._analyzer = Analyzer.load(config)
self._total_corpus_terms = 0