This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
薛丞宏 edited this page Jul 17, 2018
·
20 revisions
sudo apt-get install -y python3 virtualenv g++ python3-dev libyaml-dev libxslt1-dev git subversion automake libtool zlib1g-dev libboost-all-dev libbz2-dev liblzma-dev libgoogle-perftools-dev libxmlrpc-c++.*-dev libpq-dev postgresql postgresql-contrib make # 安裝套件
sudo apt-get install -y libc6-dev-i386 linux-libc-dev gcc-multilib libx11-dev libx11-dev:i386 # HTK
sudo apt-get install -y csh # SPTK
sudo apt-get install -y sox rabbitmq-server # Kaldi
git clone https://github.com/sih4sing5hong5/hok8-bu7.git
cd hok8-bu7
virtualenv --python=python3 venv; source venv/bin/activate; pip install --upgrade pip # 設置環境檔
pip install --upgrade tai5-uan5_gian5-gi2_hok8-bu7 hue7jip8
python manage.py migrate
若是愛翻譯的服務才閣設定就好
sudo -u postgres createuser --superuser $USER
sudo -u postgres createdb $USER
psql
\password
佇hok8-bu7/setting.py
改使用者帳號和資料庫密碼
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '$USER', # Linux's username
'USER': '$USER', # Linux's username
'PASSWORD': 'Taiwanese', # 剛輸入的密碼
'HOST': 'localhost',
'PORT': '',
}
}
這樣接下來就可以匯入資料和使用服務了!!
若是面頂攏有做,就免閣設定矣~~
需要Unix,推薦Mint Linux佮Ubuntu Linux
Ubuntu/Mint 套件安裝指令
sudo apt-get install -y python3 python-virtualenv # python虛擬環境
sudo apt-get install -y g++ python3-dev libyaml-dev libxslt1-dev # 臺灣言語資料庫
sudo apt-get install -y git subversion automake libtool zlib1g-dev libboost-all-dev libbz2-dev liblzma-dev libgoogle-perftools-dev libxmlrpc-c++.*-dev # moses, libxmlrpc for mosesserver
sudo apt-get install -y libpq-dev postgresql postgresql-contrib # postgres
請先安裝python3佮virtualenv
virtualenv --python=python3 venv; . venv/bin/activate; pip install --upgrade pip # 設置環境檔
每次使用前都需要執行
. venv/bin/activate # 載入環境
hok8bu7
可隨意號名
pip install tai5-uan5_gian5-gi2_hok8-bu7
django-admin startproject hok8bu7
使用臺灣言語服務,時區和前端的cors設定。
在Django(hok8bu7
)的settings.py
設定檔最底下加上
INSTALLED_APPS += (
'corsheaders',
'臺灣言語資料庫',
'臺灣言語服務',
)
MIDDLEWARE_CLASSES += (
'corsheaders.middleware.CorsMiddleware',
)
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
TIME_ZONE = 'Asia/Taipei'
網址對應urls.py
加上對應路徑
urlpatterns = patterns(
...
url(r'^', include('臺灣言語服務.網址')),
...
)
建資料庫,請設定密碼
sudo -u postgres createuser --superuser $USER
sudo -u postgres createdb $USER
psql
\password
佇setting.py
改使用者帳號和資料庫密碼
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '$USER', # Linux's username
'USER': '$USER', # Linux's username
'PASSWORD': 'Taiwanese', # 剛輸入的密碼
'HOST': 'localhost',
'PORT': '',
}
}
有任何疑問可以看臺灣言語資料庫的使用Postgres的說明。
python manage.py migrate
攏有顯示0筆就代表安裝成功矣
python manage.py 顯示資料數量