Compare commits
No commits in common. "370a215d0811d580e41189398c33c33594bbc581" and "38206271c6c01f64e1024e11de6af3660005a212" have entirely different histories.
370a215d08
...
38206271c6
|
@ -6,7 +6,6 @@
|
||||||
# Purpose: dictionary & pickle as a simple means of database.
|
# Purpose: dictionary & pickle as a simple means of database.
|
||||||
# Task: incorporate the functions into wordfreqCMD.py such that it will also show cumulative frequency.
|
# Task: incorporate the functions into wordfreqCMD.py such that it will also show cumulative frequency.
|
||||||
|
|
||||||
import os
|
|
||||||
import pickle
|
import pickle
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
@ -56,12 +55,10 @@ def save_frequency_to_pickle(d, pickle_fname):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def unfamiliar(path,word):
|
def unfamiliar(path,word):
|
||||||
if not os.path.exists(path):
|
f = open(path,"rb")
|
||||||
return None
|
|
||||||
with open(path,"rb") as f:
|
|
||||||
dic = pickle.load(f)
|
dic = pickle.load(f)
|
||||||
dic[word] += [datetime.now().strftime('%Y%m%d%H%M')]
|
dic[word] += [datetime.now().strftime('%Y%m%d%H%M')]
|
||||||
with open(path,"wb") as fp:
|
fp = open(path,"wb")
|
||||||
pickle.dump(dic,fp)
|
pickle.dump(dic,fp)
|
||||||
|
|
||||||
def familiar(path,word):
|
def familiar(path,word):
|
||||||
|
|
Loading…
Reference in New Issue