Code Monkey home page Code Monkey logo

Comments (7)

wta2001 avatar wta2001 commented on July 27, 2024 2

有个相对容易的做法,直接用espeak-ng作为音源,安装先espeak-ng
然后在.bashrc或.zshrc中添加以下函数:
wds() {
wd $*
espeak-ng "$*"
}
这样相当于对wd命令进行了装饰,如果需要发音,只需要用wds命令代替wd命令即可

from wudao-dict.

ChestnutHeng avatar ChestnutHeng commented on July 27, 2024 1

可以参考这个同学修改的wdd:

  1. 在usr下建立mp3目录
  2. 安装ffplay
#!/bin/bash
function playaudio(){
    if [ -n $1 ];then
        mp3=./usr/mp3/$1.mp3 
        if [ ! -f $mp3 ];then
            file=`wget -qO- https://cn.bing.com/dict/search\?q\=$1 | grep -Eoi "(https://dictionary.blob.core.chinacloudapi.cn/media/audio/tom/.{0,50}mp3)" | grep -m 1 ".*"`
            wget -O $mp3 $file > /dev/null 2>&1 
        fi 
        nohup ffplay -autoexit -nodisp -i -loglevel quiet $mp3 > /dev/null 2>&1  
    fi
}

playaudio $1 &
count=`ps -ef | grep "python3 WudaoServer.py" | grep -v "grep" | wc -l`

if [ $count == 0 ]; then
    nohup python3 WudaoServer.py > ./usr/server.log 2>&1 &
    git pull origin master > ./usr/pull.log 2>&1 &
fi

python3 WudaoCommand.py $*

from wudao-dict.

Jackiexiao avatar Jackiexiao commented on July 27, 2024 1

做个补充,usr文件夹指的是源代码中./wudao-dict/usr
ffplay的安装方式是安装ffmpeg,sudo apt install ffmpeg

from wudao-dict.

Bugatti100Peagle avatar Bugatti100Peagle commented on July 27, 2024

command line dictionary(命令行词典)
找到一个可以发音的

from wudao-dict.

ChestnutHeng avatar ChestnutHeng commented on July 27, 2024

我也看到一些小伙伴的各种发音脚本,感谢大家提供的方案!发音需要额外装包,查询速度也会降低,所以主版本就不支持了,大家自己套个脚本就可以了~

from wudao-dict.

Bugatti100Peagle avatar Bugatti100Peagle commented on July 27, 2024

嗯嗯,一开始我想套入发音模块的,不过出现了好多bug,直到我看到wdd居然是Shell⊙ω⊙

from wudao-dict.

Oyyko avatar Oyyko commented on July 27, 2024

如果不喜欢wds,而是想继续使用wd作为命令。那么可以改为这样:

wd() {
       /usr/bin/wd $*
       espeak-ng "$*"
}

from wudao-dict.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.