2024-05-08 19:30:08 +08:00
|
|
|
|
|
|
|
from app.Article import load_text_list_from_db
|
|
|
|
from app.main import load_word_list, calculate_coverage
|
|
|
|
|
|
|
|
|
|
|
|
def test_coverage_percentage():
|
|
|
|
try:
|
2024-06-03 10:32:48 +08:00
|
|
|
db_file = "db\wordfreqapp.db"
|
|
|
|
csv_file = "db\The_Oxford.csv"
|
2024-05-08 19:30:08 +08:00
|
|
|
text_list = load_text_list_from_db(db_file)
|
|
|
|
word_set = load_word_list(csv_file)
|
|
|
|
coverage_percentage = "{:.2f}".format(calculate_coverage(text_list, word_set))
|
|
|
|
print("coverage_percentage:", coverage_percentage);
|
|
|
|
except Exception as e:
|
|
|
|
print(e)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test_coverage_percentage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|