Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ git clone --recursive https://github.com/parlance/ctcdecode.git
cd ctcdecode
pip install .
```
## Installation for Chinese users
The download-site of third-lib openfst and boost may not be reached easily in China, I suggest that you can replace the download-site by:


```bash
# get the code
git clone --recursive -b linrio-patch-1 https://github.com/linrio/ctcdecode.git
cd ctcdecode
pip install .
```
25 changes: 18 additions & 7 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,35 @@
import os
import tarfile

import wget
#import wget
from torch.utils.ffi import create_extension

#from urllib.request import urlretrieve
#from urllib import request

def download_extract(url, dl_path):
if not os.path.isfile(dl_path):
wget.download(url,
out=dl_path)
pass
#wget.download(url, out=dl_path)
#file, _ = request.urlretrieve(url, dl_path)
#print("downloaded: ", file)
tar = tarfile.open(dl_path)
tar.extractall('third_party/')
tar.close()


# Download/Extract openfst, boost
download_extract('https://sites.google.com/site/openfst/home/openfst-down/openfst-1.6.7.tar.gz',
'third_party/openfst-1.6.7.tar.gz')
download_extract('https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz',
'third_party/boost_1_63_0.tar.gz')
site_in_China = True
if not site_in_China:
download_extract('https://sites.google.com/site/openfst/home/openfst-down/openfst-1.6.7.tar.gz',
'third_party/openfst-1.6.7.tar.gz')
download_extract('https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz',
'third_party/boost_1_63_0.tar.gz')
else:
download_extract('http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.6.7.tar.gz',
'third_party/openfst-1.6.7.tar.gz')
download_extract('https://dl.bintray.com/boostorg/release/1.63.0/source/boost_1_63_0.tar.gz',
'third_party/boost_1_63_0.tar.gz')


# Does gcc compile with this header and library?
Expand Down