Skip to content

Commit

Permalink
release v1.5 (#4)
Browse files Browse the repository at this point in the history
* docs: readme for v2

* update

* prepare for v1.5
  • Loading branch information
awxiaoxian2020 authored Feb 28, 2023
1 parent da454c4 commit 4ded224
Show file tree
Hide file tree
Showing 6 changed files with 2,094 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

排序使用了词形还原策略,所以与实际试卷呈现略有差异。

单词释义来自百度翻译 API
单词释义未经人工校对,略有瑕疵

前 2444 个单词出现 40 次以上,即平均每做 5 套试卷就能遇到一次的这些单词的词义经过了人工的粗略校对。其余单词的词义校对工作尚未有计划进行
前 2444 个单词出现 40 次以上,即平均每做 5 套试卷就能遇到一次的这些单词即为真正的**高频词汇**

异形词(即对考纲当中有多种写法的单词)由于数量庞大,尚未有意愿更新。

[vocabulary.json](https://github.com/awxiaoxian2020/NETEMVocabulary/blob/master/vocabulary.json) 中的词义未经人工校对
[vocabulary.json](https://github.com/awxiaoxian2020/NETEMVocabulary/blob/master/vocabulary.json) 中的词义来自百度翻译 API

本仓库数据基于 [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) 共享,程序基于 [MIT License](https://github.com/awxiaoxian2020/NETEMVocabulary/blob/master/LICENSE).

[Release 页面](https://github.com/awxiaoxian2020/NETEMVocabulary/releases)下载 PDF 版本。

使用 generate_doc.py 生成文档初版。
62 changes: 62 additions & 0 deletions new_translator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import openpyxl

wb = openpyxl.load_workbook("1.xlsx")
ws = wb.active


def combine_strings(text: str) -> str:
result = ""
lines = text.split('、')
used_lines = set() # 用于存储已经使用过的字符串
for i, line in enumerate(lines):
if line in used_lines:
continue
if i == 0:
result += line
used_lines.add(line)
elif len(result) + len(line) + 1 <= 11 and line not in used_lines:
result += '、' + line
used_lines.add(line)
else:
break
return result


def combine_two_strings(text: str) -> str:
result = ""
lines = text.split("、")
used_lines = set()
for line in lines:
if len(used_lines) == 2:
break
if line in used_lines or len(line) > 5:
continue
if result and len(result) + len(line) + 1 > 6:
result += "、\n"
else:
result += "、"
result += line
used_lines.add(line)
return result.lstrip("、\n").rstrip("、")


def translate(word):
for row in ws.iter_rows():
# 遍历当前行的所有单元格
for cell in row:
# 检查单元格的值是否等于要查找的值
if cell.value == word:
# 获取该单元格右边的单元格
right_cell = cell.offset(row=0, column=1)
# wb.close()
# 输出查找结果
return right_cell.value


def check(word):
# 遍历第一列,查找指定单词
for cell in ws['A']:
if cell.value == word:
return True
else:
return False
Loading

0 comments on commit 4ded224

Please sign in to comment.