HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
algorithms.MetricContentSize.MetricContentSize Class Reference
Inheritance diagram for algorithms.MetricContentSize.MetricContentSize:
Collaboration diagram for algorithms.MetricContentSize.MetricContentSize:

Public Member Functions

def __init__ (self, name)
 
def internalCalculating (self, dataDict, buf)
 
def precalculate (self, result, metricName)
 
- Public Member Functions inherited from algorithms.BaseMetric.BaseMetric
def __init__ (self, names)
 
def retForMultiNames (self, retDict, metricName)
 
def sortElementsByMetric (self, elements, metricName)
 
def selectElementsByMetric (self, elements, metricName, metricLimitMax, metricLimitMin)
 

Static Public Attributes

list CHAR_CATEGORIES_LIST = ['Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nd', 'Nl', 'No']
 

Additional Inherited Members

- Public Attributes inherited from algorithms.BaseMetric.BaseMetric
 names
 

Detailed Description

Definition at line 27 of file MetricContentSize.py.

Constructor & Destructor Documentation

◆ __init__()

def algorithms.MetricContentSize.MetricContentSize.__init__ (   self,
  name 
)

Definition at line 34 of file MetricContentSize.py.

34  def __init__(self, name):
35  super(MetricContentSize, self).__init__(name)
36 
37 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ internalCalculating()

def algorithms.MetricContentSize.MetricContentSize.internalCalculating (   self,
  dataDict,
  buf 
)

Definition at line 42 of file MetricContentSize.py.

42  def internalCalculating(self, dataDict, buf):
43  if type(buf) is types.StringType:
44  buf = unicode(buf)
45  if type(buf) is types.UnicodeType:
46  for ch in buf:
47  if unicodedata.category(ch) in self.CHAR_CATEGORIES_LIST:
48  dataDict["validCharsCount"] += 1
49  dataDict["count"] += 1
50 
51 
Here is the caller graph for this function:

◆ precalculate()

def algorithms.MetricContentSize.MetricContentSize.precalculate (   self,
  result,
  metricName 
)

Definition at line 56 of file MetricContentSize.py.

56  def precalculate(self, result, metricName):
57  ret = {"count": 0, "percent": 0, "validCharsCount": 0}
58  for key in result.tags:
59  if type(result.tags[key]) is types.DictType and "data" in result.tags[key]:
60  if type(result.tags[key]["data"]) in types.StringTypes:
61  self.internalCalculating(ret, result.tags[key]["data"])
62  elif type(result.tags[key]["data"]) is types.ListType:
63  for buf in result.tags[key]["data"]:
64  self.internalCalculating(ret, buf)
65  if ret["count"] > 0:
66  ret["percent"] = ret["validCharsCount"] * 100 / ret["count"]
67  ret = self.retForMultiNames(ret, metricName)
68  return ret
Here is the call graph for this function:

Member Data Documentation

◆ CHAR_CATEGORIES_LIST

list algorithms.MetricContentSize.MetricContentSize.CHAR_CATEGORIES_LIST = ['Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nd', 'Nl', 'No']
static

Definition at line 29 of file MetricContentSize.py.


The documentation for this class was generated from the following file: