Compare commits

..

No commits in common. "master" and "Bug565-Hui" have entirely different histories.

7 changed files with 8 additions and 11 deletions

View File

@ -18,7 +18,7 @@ picked from articles selected for him to read according his vocabulary level. E
`python3 main.py` `python3 main.py`
Make sure you have put the SQLite database file in the path `app/db` (see below). Make sure you have put the SQLite database file in the path `app/static` (see below).
## Run it as a Docker container ## Run it as a Docker container
@ -214,5 +214,5 @@ Bug report: http://118.25.96.118/bugzilla/show_bug.cgi?id=215
Bug report: http://118.25.96.118/bugzilla/show_bug.cgi?id=489 Bug report: http://118.25.96.118/bugzilla/show_bug.cgi?id=489
*Last modified on 2026-03-12* *Last modified on 2023-01-30*

View File

@ -106,7 +106,7 @@ def get_today_article(user_word_list, visited_articles):
text_level = text_difficulty_level(d['text'], d3) text_level = text_difficulty_level(d['text'], d3)
result_of_generate_article = "found" result_of_generate_article = "found"
today_article = {} today_article = None
if d: if d:
oxford_words = load_oxford_words(oxford_words_path) oxford_words = load_oxford_words(oxford_words_path)
oxford_word_count, total_words = count_oxford_words(d['text'],oxford_words) oxford_word_count, total_words = count_oxford_words(d['text'],oxford_words)

View File

@ -144,8 +144,8 @@ if __name__ == '__main__':
运行程序 运行程序
''' '''
# app.secret_key = os.urandom(16) # app.secret_key = os.urandom(16)
app.run(debug=True, port=5000) # app.run(debug=False, port='6000')
# app.run(debug=True) app.run(debug=True)
# app.run(debug=True, port='6000') # app.run(debug=True, port='6000')
# app.run(host='0.0.0.0', debug=True, port='6000') # app.run(host='0.0.0.0', debug=True, port='6000')
# print(mod5('123')) # print(mod5('123'))

View File

@ -93,9 +93,7 @@ function parseWord(element) {
const word = element const word = element
.querySelector("a.btn.btn-light[role=button]") // 获取当前词频元素的词汇元素 .querySelector("a.btn.btn-light[role=button]") // 获取当前词频元素的词汇元素
.innerText // 获取词汇值; .innerText // 获取词汇值;
let freqId = `freq_${word}`; const freq = Number.parseInt(element.querySelector(`#freq_${word}`).innerText); // 获取词汇的数量
freqId = CSS.escape(freqId); // for fixing bug 580, escape the apostrophe in the word
const freq = Number.parseInt(element.querySelector("#"+freqId).innerText); // 获取词汇的数量
return { return {
word, word,
freq freq

View File

@ -31,7 +31,7 @@
<p><a href="/login">登录</a> <a href="/signup">注册</a> <a href="/static/usr/instructions.html">使用说明</a></p > <p><a href="/login">登录</a> <a href="/signup">注册</a> <a href="/static/usr/instructions.html">使用说明</a></p >
<p><b> {{ random_ads }}。 <a href="/signup">试试</a>吧!</b></p> <p><b> {{ random_ads }}。 <a href="/signup">试试</a>吧!</b></p>
{% endif %} {% endif %}
<div class="alert alert-success" role="alert">共有文章 <span class="badge bg-success"> {{ number_of_essays }} </span> 篇,Oxford 5000 单词占比 <span class="badge bg-success"> {{ (ratio * 100) | int }}% </span> </div> <div class="alert alert-success" role="alert">共有文章 <span class="badge bg-success"> {{ number_of_essays }} </span> 篇,覆盖 <span class="badge bg-success"> {{ (ratio * 100) | int }}% </span> 的 Oxford5000 单词</div>
<p>粘贴1篇文章 (English only)</p> <p>粘贴1篇文章 (English only)</p>
<form method="post" action="/"> <form method="post" action="/">
<textarea name="content" id="article" rows="10" cols="120"></textarea><br/> <textarea name="content" id="article" rows="10" cols="120"></textarea><br/>

View File

@ -87,7 +87,7 @@
<div id="text-content"> <div id="text-content">
<div id="found"> <div id="found">
<div class="alert alert-success" role="alert">According to your word list, your level is <span class="text-decoration-underline" id="user_level">{{ today_article["user_level"] }}</span> and we have chosen an article with a difficulty level of <span class="text-decoration-underline" id="text_level">{{ today_article["text_level"] }}</span> for you. <span class="text-decoration-underline" id="ratio">{{ (today_article["ratio"] * 100) | int }}%</span> of the words in this article are in Oxford Word 5000.</div> <div class="alert alert-success" role="alert">According to your word list, your level is <span class="text-decoration-underline" id="user_level">{{ today_article["user_level"] }}</span> and we have chosen an article with a difficulty level of <span class="text-decoration-underline" id="text_level">{{ today_article["text_level"] }}</span> for you. The Oxford word coverage is <span class="text-decoration-underline" id="ratio">{{ (today_article["ratio"] * 100) | int }}%.</span></div>
<p class="text-muted" id="date">Article added on: {{ today_article["date"] }}</p><br/> <p class="text-muted" id="date">Article added on: {{ today_article["date"] }}</p><br/>
<button onclick="saveArticle()" >标记文章</button> <button onclick="saveArticle()" >标记文章</button>

View File

@ -6,4 +6,3 @@ snowballstemmer==2.2.0
Werkzeug==2.2.2 Werkzeug==2.2.2
requests requests
pytest~=8.1.1 pytest~=8.1.1
Flask-HTTPAuth==4.4.0