Comments (2)
首先sample usage下面这段要删掉
// Example usage:
const dictionary = new finnZhDictionary({ maxExample: 2 });
dictionary.findTerm("mies").then(translations => {
translations.forEach(translation => {
console.log(`Word: ${translation.word}`);
console.log(`POS: ${translation.pos}`);
console.log(`Translation: ${translation.translationText}`);
console.log(`IPA: ${translation.ipa}`);
console.log(`Audio URL: ${translation.audioUrl}`);
console.log(); // 分隔翻译
});
}).catch(error => {
console.error(error);
});
其次constructor 里那个options不可用,因为loadscript的时候并没有传进去,这是为什么后来又搞了个setOptions来额外传options
所以下面这句应该注释掉
this.maxexample = options.maxexample || 2;
改完后,词典列表里就可以看到了。比如你试试我这个
https://gist.githubusercontent.com/ninja33/18c271c7192444a784e06717a86ce59f/raw/428807d6808898be705c90ec948816e1c16801a5/fizh_GlosbeDictionary.js
但是这个脚本依然不可以用, 因为他会报错说 axios 这个object找不到,所以不知道你自定义脚本里axios 那里来的,又没有定义。你自己再调试一下吧。
from odh.
谢谢!加载进去了,确实无法正确运行,问题应该处在最后的AI改写上,很抱歉还得麻烦您再帮我确定一下怎么调试?(看看方向有没有错?)
问题:我确保了抓取脚本(两个版本)都可以正常运行,所以应该是进一步的AI改写出了问题(不能直接转换?)。而这个抓取代码如果我没有想错,我的抓取版本脚本已经完成了您开发指南上第一,第二点,之后我应该开始完善第三点(元素选择器之类的),最后再把转成开发指南里模板的格式?
背景:
由于我基本上不会代码,只看得懂一点python,所以我的代码是用AI写了了python的抓取脚本,再让它转成JavaScript的,最后在让AI把JavaScript版的抓取代码补完您开发指南上的要求,也让他模仿一个英汉词典的插件中内置脚本(也就是您看到的版本)。
python版的抓取代码:https://gist.githubusercontent.com/leuas/3b8d0466d03de428d4293e1210bfc7a9/raw/f61caf902dbc3790ac539609a6bddef9a81ecded/python%25E6%258A%2593%25E5%258F%2596.py
JavaScript版本的抓取代码:https://gist.githubusercontent.com/leuas/618763bb8e205c595dc96f4ec72c8d9e/raw/5f234d9367647dd9e9e54a892a7fd03075851ffa/JavaScript%25E6%258A%2593%25E5%258F%2596.js
抓取的网站:
https://www.sanakirja.fi/
值得注意的是,这个抓取的网站的token(即在脚本里面的Authorization部分),似乎每隔几小时就得重新再改(需要登录后去原网站f12页面的network里找token,再复制上去),不然运行不了。(目前网站api似乎暂时还拿不到)
所以以下输出供您参考:(可能有用?两个版本的输出几乎一样,所以只粘贴了python的)
抓取的词汇:kiitos
输出:
Word: kiitos
Part of Speech: noun
Sentence ID: motkiina-k-fizh-3841-s-1
Created: 2021-10-25T12:09:54.321893
Example: Kiitos!
Example Created: 2021-10-25T12:09:54.322192
Translation: 谢谢
IPA: xièxie!
Audio URL:
Example: Kiitoksia!
Example Created: 2021-10-25T12:09:54.322811
Translation: 太谢谢了
IPA: tài xièxie le!
Audio URL:
Example: Suurkiitos!
Example Created: 2021-10-25T12:09:54.323456
Translation: 大大感谢
IPA: dàdà gǎnxiè!
Audio URL:
Word: kiitos
Part of Speech: noun
Sentence ID: motkiina-k-fizh-3841-s-2
Created: 2021-10-25T12:09:54.324619
Example: Kiitoksen kipeä
Example Created: 2021-10-25T12:09:54.324915
Translation: 急切要(别人)赞扬
IPA: jíqiè yào (biérén) zànyáng
Audio URL:
Example: Tavoitella kiitosta
Example Created: 2021-10-25T12:09:54.325612
Translation: 追求赞扬
IPA: zhuīqiú zànyáng
Audio URL:
Example: Hän ansaitsee työstä täyden,kaiken kiitoksen
Example Created: 2021-10-25T12:09:54.326261
Translation: 由于他的工作应当给予他一切赞扬
IPA: Yóuyú tā de gōngzuò yīngdāng jǐyǔ tā yíqiè zànyáng
Audio URL:
Word: kiitos
Part of Speech: noun
Sentence ID: motkiina-k-fizh-3841-s-3
Created: 2021-10-25T12:09:54.328304
Example: Pääsi pulasta kiitos ystävien
Example Created: 2021-10-25T12:09:54.32866
Translation: 多亏了朋友才摆脱困境
IPA: duōkuīle péngyou cái bǎituō kùnjìng
Audio URL:
Example: Kiitos nopean toiminnan vahingoilta vältyttiin
Example Created: 2021-10-25T12:09:54.329483
Translation: 由于行动迅速才避免了损失
IPA: yóuyú xíngdòng xùnsù cái bìmiǎn le sǔnshī
Audio URL:
Example: Potilas on nyt huonompi kiitos huolimattoman hoidon
Example Created: 2021-10-25T12:09:54.333144
Translation: 由于治疗马虎病人病情加重
IPA: yóuyú zhìliáo mǎhu bìngrén bìngqíng jiāzhòng
Audio URL:
from odh.
Related Issues (20)
- 牛津英语双解导入anki后无法发音
- 请问是否可以考虑增加韩语词典?
- 牛津词典不能用 HOT 5
- [BUG]开启音频文件后在anki中会阻挡单词的显示
- 浏览器插件希望能有夜间模式版本的 HOT 1
- 划词的时候选择其它词库时无弹窗 HOT 3
- chrome的rss阅读插件feedbro无法划词
- Creat more field ? HOT 1
- 选中词组、短语和句子后,没有弹窗。只能够选中单独的单词 HOT 1
- Can't create new card (Anki version 24.06.3 (Windows))
- 請問停止支援之後還能用嗎? HOT 2
- 仅释义的显示 HOT 3
- Youtube网站改版后提取不到句子 HOT 2
- 在网页上显示制卡成功,但在anki里没有新增卡片(未重复)
- 请问如何调试自定义的脚本呢?
- 朗文双解找不到,朗文英英词典不显示窗口
- 剑桥词典的部分词条解释变成了例句的翻译
- 自动发音
- 请求适配 Koodo Reader 网页版
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odh.