34 lines
974 B
Python
34 lines
974 B
Python
import pickle
|
|
import os
|
|
|
|
# Sample vocabulary data - simulating a user's word history
|
|
# Format: word -> list of dates when the word was studied
|
|
test_data = {
|
|
"hello": ["20240101"],
|
|
"world": ["20240101", "20240102"],
|
|
"computer": ["20240101", "20240103"],
|
|
"programming": ["20240102"],
|
|
"python": ["20240102", "20240103"],
|
|
"algorithm": ["20240103"],
|
|
"database": ["20240103"],
|
|
"interface": ["20240104"],
|
|
"vocabulary": ["20240104"],
|
|
"sophisticated": ["20240104"]
|
|
}
|
|
|
|
# Ensure frequency directory exists
|
|
base_path = r'C:\Users\ANNA\Desktop\app\static\frequency'
|
|
os.makedirs(base_path, exist_ok=True)
|
|
|
|
# Save the test data
|
|
file_path = os.path.join(base_path, 'mr1an85.pickle')
|
|
with open(file_path, 'wb') as f:
|
|
pickle.dump(test_data, f)
|
|
|
|
print(f"Test file created at: {file_path}")
|
|
|
|
# Verify the file was created and can be read
|
|
with open(file_path, 'rb') as f:
|
|
loaded_data = pickle.load(f)
|
|
print("\nVerifying data:")
|
|
print(loaded_data) |