六级/考研单词(扩展)词表及过滤器

全部文件:https://files.cnblogs.com/files/blogs/714801/WordFilter.zip

abandon abandons abandoned abandoning abandonment
...
zoom zooms zooming zoomed

像abandon和zoom这样的词有3010个。新东方六级英语新大纲词汇表有5380个词。以它为蓝本,补充了考研单词(其实两者几乎一样),去掉了高频词(a, an都认识)。我下过个雅思背单词app,2~3000个词,头一个单词是so,so我马上卸了。

广泛地阅读,爱看啥看啥。不认识的查词典。要是每个不认识的背,嘿嘿,想太多了。

Ctrl-C复制全部,运行WordFilter.py,再Ctrl-V,粘贴出来的就是abandon和zoom这样的词,先把它们背住。最好能查下词典,看下完整释义,别煮夹生饭。能自如地用5380个单词写英文,没有想象中的那么容易。

代码上面那个.zip里有。

准备个文本文件,每次都贴在它里面,过段时间统计下次数(程序很好编),不会编程可用WPS Office里的表格,背自己领域内的高频词。这个也想多了,5000谈不到专业词汇,都是通用词。

 1 # 1. 到 https://npm.taobao.org/mirrors/python/3.9.9/python-3.9.9-amd64.exe 下载python, 有些下载网站给你装堆乱七八糟的stuff
 2 # 2. 新建快捷方式时,要指定起始位置,如D:\WordFilter,即在该目录下运行WordFilter.py, which在当前目录下找*.txt
 3 # 3. 先Ctrl-C 复制txt,再运行WordFilter.py过滤,然后再Ctrl-V粘贴
 4 # 4. 可以Win-R,cmd <回车>可打开命令提示符
 5 # -*- coding: utf-8 -*-
 6 import glob
 7 import re
 8 # pip install pywin32
 9 import win32clipboard as w
10 import win32con
11 
12 def get_text():
13     w.OpenClipboard()
14     s = w.GetClipboardData(win32con.CF_UNICODETEXT)
15     w.CloseClipboard()
16     return s
17     
18 def set_text(s):
19     w.OpenClipboard()
20     w.EmptyClipboard()
21     #w.SetClipboardData(win32con.CF_TEXT, s.encode('utf-16le'))
22     w.SetClipboardData(win32con.CF_UNICODETEXT, s)
23     w.CloseClipboard()
24 
25 dic = {}
26 for file_name in glob.glob('*.txt'):
27     print(file_name)
28     with open(file_name, 'r', encoding='utf-8') as f:
29         # abandon abandons abandoned abandoning abandonment
30         # ...
31         # zoom zooms zooming zoomed
32         for line in f:
33             words = line.split()
34             kw = words[0].lower()
35             for word in words:
36                 if len(word) > 13: print(word)
37                 dic[word.lower()] = kw
38 print('\n')
39 
40 out = '六级/考研单词: '
41 odic = {}
42 words = re.split('[^a-zA-z-]', get_text())
43 for word in words:
44     word = dic.get(word.lower())
45     if word != None and odic.get(word) == None:
46         odic[word] = True
47         out += word + ', '
48 
49 try:
50     out = out[:out.rindex(',')]
51     print(out)
52     set_text(out)
53 except Exception:
54     exit()
View Code

得 pip install pywin32 , 操作剪贴板用。国外的源慢。操作剪贴板还有更小的包:python与C互相调用微全 - Fun_with_Words - 博客园 (cnblogs.com)

 Python pip配置国内源 - 暮光微凉 - 博客园 (cnblogs.com)

没人想写个C++版,带 SetClipboardViewer 功能吗?

我写了个Edge Extension: 一个超简单的Microsoft Edge Extension - Fun_with_Words - 博客园 (cnblogs.com)

https://files.cnblogs.com/files/blogs/714801/wordfilter.html.zip

上面是HTML版。在任意浏览器里打开.html文件即可。bug fix: 请替换filter()为如下代码:

function filter() {
	words = txt.value.split(/[^a-zA-z-]/)
	ot = {}; outs = ''
	for (i = 0; i < words.length; i++) {
		w = d[words[i]]
		if (w in d && !(w in ot)) {
			ot[w] = 1;
			outs += w + ' '
		}
	}
	txt.value = outs
}
posted @ 2021-11-26 16:10  Fun_with_Words  阅读(248)  评论(0编辑  收藏  举报









 张牌。