示例#1
0
def _process_proportion_of_language_added(parent_entity, revision_entity):
    parent_entity_doc = parent_entity if parent_entity is not None else {}
    revision_entity_res = len(re.findall(LANGUAGE_RE,
                                         mwbase.json_dumps(revision_entity)))
    parent_entity_res = len(re.findall(LANGUAGE_RE,
                                       mwbase.json_dumps(parent_entity_doc)))
    return float(revision_entity_res - parent_entity_res) / \
        float(revision_entity_res + 1)
示例#2
0
def _process_proportion_of_language_added(parent_entity, revision_entity):
    parent_entity_doc = parent_entity if parent_entity is not None else {}
    revision_entity_res = len(
        re.findall(LANGUAGE_RE, mwbase.json_dumps(revision_entity)))
    parent_entity_res = len(
        re.findall(LANGUAGE_RE, mwbase.json_dumps(parent_entity_doc)))
    return float(revision_entity_res - parent_entity_res) / \
        float(revision_entity_res + 1)
示例#3
0
def _process_proportion_of_links_added(parent_entity, revision_entity):
    parent_entity_doc = parent_entity if parent_entity is not None else {}
    re_qid = re.compile(r'https?\://|wwww\.')
    revision_entity_res = len(re.findall(re_qid,
                                         mwbase.json_dumps(revision_entity)))
    parent_entity_res = len(re.findall(re_qid,
                                       mwbase.json_dumps(parent_entity_doc)))
    return float(revision_entity_res - parent_entity_res) / \
        float(revision_entity_res + 1)
示例#4
0
def _process_proportion_of_qid_added(parent_entity, revision_entity):
    parent_entity_doc = parent_entity if parent_entity is not None else {}
    re_qid = re.compile(r'Q\d{1,8}')
    revision_entity_qids = len(re.findall(
        re_qid, mwbase.json_dumps(revision_entity)))
    parent_entity_qids = len(re.findall(
        re_qid, mwbase.json_dumps(parent_entity_doc)))
    return float(revision_entity_qids - parent_entity_qids) / \
        float(revision_entity_qids + 1)
示例#5
0
def _process_proportion_of_links_added(parent_entity, revision_entity):
    parent_entity_doc = parent_entity if parent_entity is not None else {}
    re_qid = re.compile(r'https?\://|wwww\.')
    revision_entity_res = len(
        re.findall(re_qid, mwbase.json_dumps(revision_entity)))
    parent_entity_res = len(
        re.findall(re_qid, mwbase.json_dumps(parent_entity_doc)))
    return float(revision_entity_res - parent_entity_res) / \
        float(revision_entity_res + 1)
示例#6
0
def _process_proportion_of_qid_added(parent_entity, revision_entity):
    parent_entity_doc = parent_entity if parent_entity is not None else {}
    re_qid = re.compile(r'Q\d{1,8}')
    revision_entity_qids = len(
        re.findall(re_qid, mwbase.json_dumps(revision_entity)))
    parent_entity_qids = len(
        re.findall(re_qid, mwbase.json_dumps(parent_entity_doc)))
    return float(revision_entity_qids - parent_entity_qids) / \
        float(revision_entity_qids + 1)