jeffhj / deer Goto Github PK
View Code? Open in Web Editor NEWThe implementation for "DEER: Descriptive Knowledge Graph for Explaining Entity Relationships" (EMNLP '22)
License: Apache License 2.0
The implementation for "DEER: Descriptive Knowledge Graph for Explaining Entity Relationships" (EMNLP '22)
License: Apache License 2.0
I am figuring out how the digraph.pickle file is created because I need to create mine in my research on a subset of Wikipedia. So I downloaded a small subset of Wikipedia and extracted the plain text using WikiExtractor.
I am getting this error while running the following command:
python extract_wiki.py preprocess_wikipedia [Wikipedia/folder]
File "DEER/extract_wiki.py", line 1073, in
cal_freq = CalFreq(path_pattern_count_file)
File "DEER/extract_wiki.py", line 389, in init
c, log_max_cnt = load_pattern_freq(path_freq_file)
File "DEER/extract_wiki.py", line 382, in load_pattern_freq
One problem is that "save_pair_files" are empty! In the following code, the "len(ents) <= 1:" is always less than or equal to the 1, so data is always empty. Therefore, the path_pattern.pickle and the sub_path_pattern.pickle contain just counter()!
print('cal_cooccur_similarity')
for f_id, save_cooccur__file in enumerate(tqdm.tqdm(save_cooccur__files)):
with open(save_cooccur__file) as f_in:
cooccurs = f_in.read().split('\n')
print("cooccurs is: ", cooccurs)
data = []
for line in cooccurs:
ents = line.split('\t')
certain_len = len(ents)
**if len(ents) <= 1:
data.append('')**
else:
temp_data = []
# valid_entities = []
matrix = []
for ent in ents:
try:
vec = w2vec.get_entity_vector(ent)
except:
vec = np.zeros(100, dtype=np.float32)
matrix.append(vec)
# Collect pairs between certain entities
matrix = np.array(matrix)
result = cosine_similarity(matrix, matrix)
for i in range(certain_len):
for j in range(i+1, certain_len):
tup = (float(result[i, j]), ents[i], ents[j])
temp_data.append(str(tup))
data.append('\t'.join(temp_data))
my_write(save_pair_files[f_id], data)
Can you please help me to realize where the problem is?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.