|
@@ -83,20 +83,11 @@ class OcrManage:
|
|
|
asset = self.caculateAsset(list,'总资产')
|
|
asset = self.caculateAsset(list,'总资产')
|
|
|
|
|
|
|
|
|
|
|
|
|
- if self.floatValue(asset) >= 0:
|
|
|
|
|
- today = 0
|
|
|
|
|
- if '万' in asset:
|
|
|
|
|
- today = self.floatValue(asset)
|
|
|
|
|
- else:
|
|
|
|
|
- today = self.floatValue(asset)/10000.0
|
|
|
|
|
-
|
|
|
|
|
- dic['today'] = round(today,2)
|
|
|
|
|
- else:
|
|
|
|
|
- dic['today'] = 0
|
|
|
|
|
|
|
|
|
|
- dic['list'] = self.lookMarket(list)
|
|
|
|
|
|
|
+ dic['today'] = self.wangWord(asset)
|
|
|
|
|
+ dic['list'] = self.lookMarket(list)
|
|
|
|
|
|
|
|
- print(dic)
|
|
|
|
|
|
|
+ # print(dic)
|
|
|
return dic
|
|
return dic
|
|
|
@classmethod
|
|
@classmethod
|
|
|
def lookMarket(self,list):
|
|
def lookMarket(self,list):
|
|
@@ -115,17 +106,15 @@ class OcrManage:
|
|
|
mloc = mdic['location']
|
|
mloc = mdic['location']
|
|
|
loc = dic['location']
|
|
loc = dic['location']
|
|
|
nstr = mdic['words']
|
|
nstr = mdic['words']
|
|
|
- if len(nstr) == 6 and ((',' not in nstr) or ('.' not in nstr)):
|
|
|
|
|
|
|
+ if len(nstr) == 6 and ((',' not in nstr) or ('.' not in nstr)) and self.isNumber(nstr):
|
|
|
continue
|
|
continue
|
|
|
if float(mloc['left']) < (float(loc['left']) + float(loc['width'])):
|
|
if float(mloc['left']) < (float(loc['left']) + float(loc['width'])):
|
|
|
market = mdic['words']
|
|
market = mdic['words']
|
|
|
break
|
|
break
|
|
|
|
|
|
|
|
- if '万' in market:
|
|
|
|
|
- fund = self.floatValue(market)
|
|
|
|
|
- else:
|
|
|
|
|
- fund = self.floatValue(market)/10000.0
|
|
|
|
|
|
|
|
|
|
|
|
+ fund = self.wangWord(market)
|
|
|
|
|
+
|
|
|
if fund > 0:
|
|
if fund > 0:
|
|
|
ndic = {}
|
|
ndic = {}
|
|
|
ndic['name'] = codeName['name']
|
|
ndic['name'] = codeName['name']
|
|
@@ -195,10 +184,7 @@ class OcrManage:
|
|
|
# print('market:' + str(mdic))
|
|
# print('market:' + str(mdic))
|
|
|
break
|
|
break
|
|
|
|
|
|
|
|
- if '万' in market:
|
|
|
|
|
- fund = self.floatValue(market)
|
|
|
|
|
- else:
|
|
|
|
|
- fund = self.floatValue(market)/10000.0
|
|
|
|
|
|
|
+ fund = self.wangWord(market)
|
|
|
|
|
|
|
|
if fund > 0:
|
|
if fund > 0:
|
|
|
ndic = {}
|
|
ndic = {}
|
|
@@ -228,6 +214,11 @@ class OcrManage:
|
|
|
if jx < ix and ix < (jx + width):
|
|
if jx < ix and ix < (jx + width):
|
|
|
strAsset = ndic['words']
|
|
strAsset = ndic['words']
|
|
|
break
|
|
break
|
|
|
|
|
+
|
|
|
|
|
+ if self.wangWord(strAsset) == 0:
|
|
|
|
|
+ if i+1 < len(list):
|
|
|
|
|
+ ndic = list[i+1]
|
|
|
|
|
+ strAsset = ndic['words']
|
|
|
|
|
|
|
|
return strAsset
|
|
return strAsset
|
|
|
|
|
|
|
@@ -525,6 +516,28 @@ class OcrManage:
|
|
|
|
|
|
|
|
return float(word)
|
|
return float(word)
|
|
|
|
|
|
|
|
|
|
+ @classmethod
|
|
|
|
|
+ def wangWord(self,word):
|
|
|
|
|
+ print(word)
|
|
|
|
|
+
|
|
|
|
|
+ isWang = 0
|
|
|
|
|
+ if '万' in word:
|
|
|
|
|
+ wlist = self.seperateChinense(word)
|
|
|
|
|
+ if len(wlist) > 0:
|
|
|
|
|
+ word = wlist[0]
|
|
|
|
|
+ isWang = 1
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if self.floatValue(word) >= 0:
|
|
|
|
|
+ if isWang == 1:
|
|
|
|
|
+ nvalue = self.floatValue(word)
|
|
|
|
|
+ else:
|
|
|
|
|
+ nvalue = self.floatValue(word)/10000.0
|
|
|
|
|
+ word = round(nvalue,2)
|
|
|
|
|
+ else:
|
|
|
|
|
+ word = 0
|
|
|
|
|
+
|
|
|
|
|
+ return word
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
|
print('ocr')
|
|
print('ocr')
|