()
return entity_id
与data_util 里面得到大致entity_id相同，区别是 为了更全的匹配mention，将实体名字全部变成小写
    :return:
与data_util 里面得到大致entity_id相同，区别是 为了更全的匹配mention，将实体名字全部变成小写
    :return:
与data_util 里面得到大致entity_id相同，区别是 为了更全的匹配mention，将实体名字全部变成小写 : return :
def get_entity_id():
    '''
    与data_util 里面得到大致entity_id相同，区别是 为了更全的匹配mention，将实体名字全部变成小写
    :return:
    '''
    new_entity_alias=new_alias()
    entity_id={}
    with open('original_data/kb_data', 'r') as f:
        for line in f:
            temDict = json.loads(line)
            subject=temDict['subject']
            subject_id=temDict['subject_id']
            alias = set()
            for a in temDict['alias']:
                alias.add(a.lower())
            alias.add(entity_clear(subject))
            if subject in new_entity_alias:
                alias=alias|new_entity_alias[subject]
            alias.add(subject.lower())
            entity_set=set()
            for en in alias:
                entity_set.add(en.lower())
            for n in entity_set:
                n=del_bookname(n)
                if n in entity_id:
                    entity_id[n].append(subject_id)
                else:
                    entity_id[n]=[]
                    entity_id[n].append(subject_id)
    return entity_id
def get_entity_id ( ) : new_entity_alias = new_alias ( ) entity_id = { } with open ( 'original_data/kb_data' , 'r' ) as f : for line in f : temDict = json . loads ( line ) subject = temDict [ 'subject' ] subject_id = temDict [ 'subject_id' ] alias = set ( ) for a in temDict [ 'alias' ] : alias . add ( a . lower ( ) ) alias . add ( entity_clear ( subject ) ) if subject in new_entity_alias : alias = alias | new_entity_alias [ subject ] alias . add ( subject . lower ( ) ) entity_set = set ( ) for en in alias : entity_set . add ( en . lower ( ) ) for n in entity_set : n = del_bookname ( n ) if n in entity_id : entity_id [ n ] . append ( subject_id ) else : entity_id [ n ] = [ ] entity_id [ n ] . append ( subject_id ) return entity_id