5 @author scorp <developers.hce@gmail.com> 6 @link http://hierarchical-cluster-engine.com/ 7 @copyright Copyright © 2013 IOIX Ukraine 8 @license http://hierarchical-cluster-engine.com/license/ 9 @package HCE project node API 20 from BaseMetric
import BaseMetric
31 CHAR_CATEGORIES_LIST = [
'Lu',
'Ll',
'Lt',
'Lm',
'Lo',
'Nd',
'Nl',
'No']
32 CHAR_NOT_LATIN_LIST = [
'Lt',
'Lm',
'Lo']
34 MIN_LATIN_WORD_LEN = 3
46 super(MetricWCount, self).
__init__(names)
54 if type(buf)
is types.StringType:
56 words = re.split(self.
RE_SPLITTER, buf, flags=re.LOCALE)
60 chCategory = unicodedata.category(ch)
70 dataDict[
"validWordsCount"] += 1
71 dataDict[
"count"] += 1
79 ret = {
"count": 0,
"percent": 0,
"validWordsCount": 0}
80 for key
in result.tags:
81 if type(result.tags[key])
is types.DictType
and "data" in result.tags[key]:
82 if type(result.tags[key][
"data"])
in types.StringTypes:
84 elif type(result.tags[key][
"data"])
is types.ListType:
85 for buf
in result.tags[key][
"data"]:
88 ret[
"percent"] = ret[
"validWordsCount"] * 100 / ret[
"count"]
list CHAR_CATEGORIES_LIST
def __init__(self, names)
def internalCalculating(self, dataDict, buf)
def precalculate(self, result, metricName)
def retForMultiNames(self, retDict, metricName)