CamDict
剑桥英语字典的抓取程序, 用 python3 实现, 命令行直接可跑.
工程: https://gitee.com/xiaofeipapa/cam-dict
剑桥英语字典介绍
剑桥英语字典是我很喜欢的一个网上字典, 它能够返回英文注释和中文注释, 还有一系列例句. 想查找地道的单词翻译, 用它准没错.
网址: https://dictionary.cambridge.org/dictionary/english-chinese-simplified/record?q=recorded
格式重整
由于剑桥英语返回的信息太过丰富, 一番折腾之后, 我重整了单词的结构, 画图如下:
image.png- 每个单词有多个pos (part of speech 词性). 例如 record 有动词形式, 名词形式. 两种词性的读音和翻译/例句都不同.
- 每个pos 包括音标, 读音, 其中读音有英音和美音.
- pos 下有多个 tran(translation, 解释). 解释有中文和英文.
- 每个tran 有多个例句, 例句有中文/英文.
用json 表达如下:
{
'word': 'record',
'pos_list': [{
'pronUk': '/rɪˈkɔːd/',
'pronUkUrl': 'https://dictionary.cambridge.org/media/english-chinese-simplified/uk_pron/u/ukr/ukrec/ukrecor002.mp3',
'pronUs': '/rɪˈkɔːrd/',
'pronUsUrl': 'https://dictionary.cambridge.org/media/english-chinese-simplified/us_pron/r/rec/recor/record_01_00.mp3',
'pos': 'verb',
'trans': [{
'en': 'to store sounds or moving pictures using electronic equipment so that they can be heard or seen later',
'ch': '录制;录(音);录(像)',
'samples': [{
'en': 'Cliff Richard has recorded more number one hit songs than any other British pop star.',
'ch': '在英国流行乐歌星中,克利夫.理查德录制的歌曲荣登排行榜榜首的数量最多。'
}, {
'en': 'We recorded their wedding on video.',
'ch': '我们给他们的婚礼录了像。'
}, {
'en': 'I tried to call her, but all I got was a recorded message saying that she was away for the weekend.',
'ch': '我每次给她打电话听到的都是电话答录机中说她外出度周末的录音。'
}, {
'en': 'Was the concert live or was it recorded (= made before being broadcast)?',
'ch': '音乐会是直播还是录播的?'
}]
}, {
'en': 'to keep information for the future, by writing it down or storing it on a computer',
'ch': '记录;记载;记下…备案',
'samples': [{
'en': 'She records everything that happens to her in her diary.',
'ch': '她把发生在自己身上的一切事情都记在了日记里。'
}, {
'en': 'Unemployment is likely to reach the highest total that has ever been recorded.',
'ch': '失业总人数很可能会创下有史以来的最高纪录。'
}, {
'en': 'In his journal, Captain Scott recorded that he and his companions were weakened by lack of food.',
'ch': '在日志中,斯科特船长写道,因缺少食物他和同伴们身体虚弱不堪。'
}, {
'en': 'The coroner recorded (= decided) a verdict of accidental death.',
'ch': '验尸官判定是意外死亡。'
}]
}, {
'en': 'If a device records a measurement, it shows that measurement.',
'ch': '(仪器)显示,记录,标明',
'samples': [{
'en': 'The thermometer recorded a temperature of 30 degrees Celsius.',
'ch': '温度计显示温度是30摄氏度。'
}]
}]
}, {
'pronUk': '/ˈrek.ɔːd/',
'pronUkUrl': 'https://dictionary.cambridge.org/media/english-chinese-simplified/uk_pron/u/ukr/ukrec/ukrecor001.mp3',
'pronUs': '/ˈrek.ɚd/',
'pronUsUrl': 'https://dictionary.cambridge.org/media/english-chinese-simplified/us_pron/r/rec/recor/record_01_01.mp3',
'pos': 'noun',
'trans': [{
'en': 'a piece of information or a description of an event that is written on paper or stored on a computer',
'ch': '记录;记载',
'samples': [{
'en': 'The weather centre keeps a record of the weather.',
'ch': '气象中心对天气情况都备有记录。'
}, {
'en': 'This summer has been the hottest on record (= the hottest summer known about).',
'ch': '今年夏天是有史以来最热的。'
}]
}, {
'en': 'information about someone or something that is stored by the police or by a doctor',
'ch': '前科;病历',
'samples': [{
'en': "A person's medical records are confidential.",
'ch': '一个人的病历是保密的。'
}, {
'en': 'He is well known to the police and has a long criminal record (= a list kept by the police of his previous crimes).',
'ch': '他是警察局的常客,有一大堆的犯罪前科。'
}]
}, {
'en': 'the facts that are known about a person or a company and the actions they have done in the past',
'ch': '履历;历史;经历',
'samples': [{
'en': "I won't fly with an airline that has a bad safety record (= whose aircraft have often had accidents).",
'ch': '我可不愿意搭乘安全纪录很差的航空公司的航班。'
}]
}, {
'en': 'something that you say before you tell someone something important that you want them to remember',
'ch': '(用于对听话人强调所说之话的重要性)为记录在案目的',
'samples': [{
'en': 'And, just for the record, we were never any more than good friends.',
'ch': '而且,我郑重声明,我们一直是好朋友,仅此而已。'
}]
}, {
'en': 'a flat plastic disc on which music is recorded',
'ch': '唱片',
'samples': [{
'en': 'Would you like to listen to some records?',
'ch': '你想听些唱片吗?'
}]
}, {
'en': 'a song or music that has been recorded and is available for the public to buy',
'ch': '(录制的)歌曲,单曲,乐曲',
'samples': [{
'en': 'The Beatles\' first hit record was "Love Me Do".',
'ch': '甲壳虫乐队的第一首走红歌曲是《请爱我》。'
}]
}, {
'en': 'the best or fastest ever done',
'ch': '最高纪录;最佳成绩',
'samples': [{
'en': 'He ran the 100 metres in 9.79 seconds and broke/smashed the world record.',
'ch': '他以9.79秒的成绩跑完了100米,打破了世界纪录。'
}, {
'en': 'She set/established a new European record in the high jump.',
'ch': '她创造了欧洲跳高的新纪录。'
}]
}]
}, {
'pronUk': '/ˈrek.ɔːd/',
'pronUkUrl': 'https://dictionary.cambridge.org/media/english-chinese-simplified/uk_pron/u/ukr/ukrec/ukrecor001.mp3',
'pronUs': '/ˈrek.ɚd/',
'pronUsUrl': 'https://dictionary.cambridge.org/media/english-chinese-simplified/us_pron/r/rec/recor/record_01_01.mp3',
'pos': 'adjective',
'trans': [{
'en': 'at a higher level than ever achieved before',
'ch': '创纪录的;空前的',
'samples': [{
'en': 'The long hot summer has led to a record harvest this year.',
'ch': '这个夏天漫长而又炎热,使得今年成为一个创纪录的丰收年。'
}, {
'en': 'Inflation has reached record levels.',
'ch': '通货膨胀已创历史最高。'
}, {
'en': 'We finished the work in record time (= faster than had ever been done before).',
'ch': '我们以最短的时间完成了工作,这是以前从没有过的。'
}]
}]
}]
}
将之复制到某个json在线格式化的网站, 仔细看看就明白了.
安装运行
sudo pip3 install requests bs4
git clone https://gitee.com/xiaofeipapa/cam-dict
cd cam-dict
python3 cam_dict.py -w hello
结果:
单词: hello
词性: exclamation 英音: /heˈləʊ/ 美音: /heˈloʊ/
used when meeting or greeting someone
喂,你好(用于问候或打招呼)
* Hello, Paul. I haven't seen you for ages.
* “你好,保罗。好久不见了。”
* I know her vaguely - we've exchanged hellos a few times.
* 我对她不太熟悉——我们只是打过几次招呼。
* I just thought I'd call by and say hello.
* 我刚想要去顺道拜访问候一下。
* And a big hello (= welcome) to all the parents who've come to see the show.
* 非常欢迎所有来看演出的家长们。
something that is said at the beginning of a phone conversation
(打电话时的招呼语)你好,喂
最后
您可以自由使用此程序, 记得把原作者(也就是我了)转发一下. 觉得此程序好玩就加个星, 谢谢了.
网友评论