-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_entitycount.py
57 lines (40 loc) · 1.14 KB
/
run_entitycount.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import sys
import json
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search, Q
from collections import Counter
from caseolap.entitycount import *
'''
Input data directory
'''
input_file_textcube_pmid2cell = "./data/textcube_pmid2cell.json"
input_file_user_entity_list = "./input/entities.txt"
'''
output data directory
'''
output_file_entity_count = "./data/entitycount.txt"
output_file_entityfound_pmid2cell = "./data/entityfound_pmid2cell.txt"
logFilePath = "./log/entitycount_log.txt"
'''
Run the Entity Count Operation
'''
if __name__ == '__main__':
logfile = open(logFilePath, 'w')
EC = EntityCount()
'''
Prepare the intity dictionary
'''
EC.entity_dictionary(input_file_user_entity_list,logfile)
'''
Prepare documents in text-cube cell and entity_count bucket
'''
EC.entity_count_dictionary(input_file_textcube_pmid2cell,logfile)
'''
count the entity
'''
EC.entity_search(logfile)
'''
Save the entity count output
'''
EC.entity_count_output(output_file_entity_count,output_file_entityfound_pmid2cell,logfile)
logfile.close()