-
Notifications
You must be signed in to change notification settings - Fork 13
/
search_terms.py
44 lines (32 loc) · 1.41 KB
/
search_terms.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
search_in = '[Text Words]' # needed as otherwise we were getting articles with {'Affiliation': 'Panomics, Inc., 2003 East Bayshore Road, Redwood City, CA 94063, USA}
def gernerate_term_variations(prefix: str, suffix: str):
return ' OR '.join([
'("' + prefix + separator + suffix + ('s' if plural else '') + f'"{search_in})'
for plural in [False, True]
for separator in ['-', '', ' ']
])
def generate_compound_terms(prefix: str, suffix: str, context: str):
return ' OR '.join([
'(("' + prefix + separator + suffix + ('s' if plural else '') + f'"{search_in}) AND (' + context + ('s' if plural_context else '') + f'{search_in}))'
for plural in [False, True]
for separator in ['-', '', ' ']
for plural_context in [False, True]
])
primary_terms = {
f'{term}-omics': gernerate_term_variations(term, 'omic')
for term in ['multi', 'pan', 'trans', 'poly', 'cross']
}
secondary_terms = {
f'multi-{term} omics': generate_compound_terms('multi', term, 'omic')
for term in ['table', 'source', 'view', 'modal', 'block']
}
def pluralize(simple_term: str):
return ' OR '.join([
f'"{simple_term}{plural_suffix}"{search_in}'
for plural_suffix in ['', 's']
])
descriptive_terms = {
'integrative omics': pluralize('integrative omic'),
'integrated omics': pluralize('integrated omic'),
'integromics': pluralize('integromic')
}