-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetIF.py
More file actions
31 lines (28 loc) · 896 Bytes
/
Copy pathgetIF.py
File metadata and controls
31 lines (28 loc) · 896 Bytes
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
import csv,os,sys,pyperclip,time,re
searchWord = sys.argv[1]
print(searchWord)
fuzzyWord = re.compile(searchWord+'.*')
dataFile = open('journalscore.csv')
abbrevFile = open('abbrev.csv')
dataReader = csv.reader(dataFile)
abbrevReader = csv.reader(abbrevFile)
dictData = {}
dictAbbrev = {}
for row in dataReader:
dictData[row[0]]=row[1]
for row in abbrevReader:
dictAbbrev[row[0]]=row[1]
if searchWord in dictData:
pyperclip.copy(dictData[searchWord])
elif searchWord in dictAbbrev:
pyperclip.copy(dictData[dictAbbrev[searchWord]])
else:
swSuggestion = []
for e in dictData:
if fuzzyWord.search(e)!=None:
swSuggestion.append('journal:%s,IF:%s'%(e,dictData[e]))
for e in dictAbbrev:
if fuzzyWord.search(e) != None:
swSuggestion.append('abbrev:%s,full%s'%(e,dictAbbrev[e]))
print('\n'.join(swSuggestion))
time.sleep(60)