Skip to content

Commit 147498e

Browse files
committed
Improve installation instructions
1 parent 1c193d4 commit 147498e

File tree

4 files changed

+162
-22
lines changed

4 files changed

+162
-22
lines changed

COPYING

-18
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@
2929
standard Apache 2.0 license text.
3030

3131

32-
33-
Licensed under the Apache License, Version 2.0 (the "License");
34-
you may not use these files except in compliance with the License.
35-
You may obtain a copy of the License at
36-
37-
http://www.apache.org/licenses/LICENSE-2.0
38-
39-
Unless required by applicable law or agreed to in writing, software
40-
distributed under the License is distributed on an "AS IS" BASIS,
41-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42-
See the License for the specific language governing permissions and
43-
limitations under the License.
44-
45-
Copyright 2005-2010 Google, Inc.
46-
47-
[OpenFst COPYING file ends here]
48-
49-
5032
-------------------------------------------------------------------------
5133

5234
Apache License

INSTALL.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
To install this toolkit:
3+
4+
run
5+
```
6+
scripts/check_dependencies.sh
7+
```
8+
to make sure all the prerequisites are installed (and try to follow its
9+
instructions on how to install those prerequisites).
10+
11+
Next, do
12+
```
13+
cd src
14+
make
15+
```
16+
to compile the C++ binaries.
17+

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# pocolm
22
Small language toolkit for creation, interpolation and pruning of ARPA language models
33

4-
To use this toolkit: go to src/ and type "make". Then look at the example
5-
scripts for how to run it. egs/swbd/ and egs/swbd_fisher/ will show you how to
6-
run it on real data.
4+
See [INSTALL.md](INSTALL.md) for installation instructions.
75

6+
To use this toolkit: after installing, look at the example scripts for how to
7+
run it. egs/swbd/ and egs/swbd_fisher/ will show you how to run it on real
8+
data.
89

910
[Motivation for this project](docs/motivation.md)
1011

11-
[TODO: remove sum-count-derivs.cc?]

scripts/check_dependencies.sh

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
#!/bin/bash
2+
3+
# Apache 2.0. Copyright 2011-2016 Johns Hopkins University (author: Daniel
4+
# Povey)
5+
6+
# this script is based on the check_dependencies.sh script in Kaldi.
7+
8+
# at some point we could try to add packages for Cywgin or macports(?) to this
9+
# script.
10+
redhat_packages=
11+
debian_packages=
12+
opensuse_packages=
13+
14+
function add_packages {
15+
redhat_packages="$redhat_packages $1";
16+
debian_packages="$debian_packages $2";
17+
opensuse_packages="$opensuse_packages $3";
18+
}
19+
20+
if ! which g++ >&/dev/null; then
21+
echo "$0: g++ is not installed."
22+
add_packages gcc-c++ g++ gcc-c++
23+
fi
24+
25+
for f in make gcc grep gzip git; do
26+
if ! which $f >&/dev/null; then
27+
echo "$0: $f is not installed."
28+
add_packages $f $f $f
29+
fi
30+
done
31+
32+
if ! which svn >&/dev/null; then
33+
echo "$0: subversion is not installed"
34+
add_packages subversion subversion subversion
35+
fi
36+
37+
if ! which awk >&/dev/null; then
38+
echo "$0: awk is not installed"
39+
add_packages gawk gawk gawk
40+
fi
41+
42+
if which python >&/dev/null ; then
43+
version=`python 2>&1 --version | awk '{print $2}' `
44+
if [[ $version != "2."* ]] ; then
45+
if which python2.7 >&/dev/null || which python2 >&/dev/null ; then
46+
echo "$0: python 2.x is not the default python. You should either make it"
47+
echo "$0: default or create an bash alias for kaldi scripts to run correctly"
48+
else
49+
echo "$0: python 2.x is not installed"
50+
add_packages python2.7 python2.7 python2.7
51+
fi
52+
fi
53+
else
54+
echo "$0: python 2.7 is not installed"
55+
add_packages python2.7 python2.7 python2.7
56+
fi
57+
58+
if ! python -c 'import numpy' >&/dev/null; then
59+
echo "$0: python-numpy is not installed"
60+
# I'm not sure if this package name is OK for all distributions, this is what
61+
# it seems to be called on Debian. We'll have to investigate this.
62+
add_packages python-numpy python-numpy python-numpy
63+
fi
64+
65+
printed=false
66+
status=0
67+
68+
if which apt-get >&/dev/null && ! which zypper >/dev/null; then
69+
# if we're using apt-get [but we're not OpenSuse, which uses zypper as the
70+
# primary installer, but sometimes installs apt-get for some compatibility
71+
# reason without it really working]...
72+
if [ ! -z "$debian_packages" ]; then
73+
echo "$0: we recommend that you run (our best guess):"
74+
echo " sudo apt-get install $debian_packages"
75+
printed=true
76+
status=1
77+
fi
78+
if ! dpkg -l | grep -E 'libatlas3gf|libatlas3-base' >/dev/null; then
79+
echo "You should probably do: "
80+
echo " sudo apt-get install libatlas3-base"
81+
printed=true
82+
fi
83+
# Debian systems generally link /bin/sh to dash, which doesn't work
84+
# with some scripts as it doesn't expand x.{1,2}.y to x.1.y x.2.y
85+
if [ $(readlink /bin/sh) == "dash" ]; then
86+
echo "/bin/sh is linked to dash, and currently some of the scripts will not run"
87+
echo "properly. We recommend to run:"
88+
echo " sudo ln -s -f bash /bin/sh"
89+
printed=true
90+
fi
91+
fi
92+
93+
if which yum >&/dev/null; then
94+
if [ ! -z "$redhat_packages" ]; then
95+
echo "$0: we recommend that you run (our best guess):"
96+
echo " sudo yum install $redhat_packages"
97+
printed=true
98+
status=1
99+
fi
100+
if ! rpm -qa| grep atlas >/dev/null; then
101+
echo "You should probably do something like: "
102+
echo "sudo yum install atlas.x86_64"
103+
printed=true
104+
fi
105+
fi
106+
107+
if which zypper >&/dev/null; then
108+
if [ ! -z "$opensuse_packages" ]; then
109+
echo "$0: we recommend that you run (our best guess):"
110+
echo " sudo zypper install $opensuse_packages"
111+
printed=true
112+
status=1
113+
fi
114+
if ! zypper search -i | grep -E 'libatlas3|libatlas3-devel' >/dev/null; then
115+
echo "You should probably do: "
116+
echo "sudo zypper install libatlas3-devel"
117+
printed=true
118+
fi
119+
fi
120+
121+
if [ ! -z "$debian_packages" ]; then
122+
# If the list of packages to be installed is nonempty,
123+
# we'll exit with error status. Check this outside of
124+
# hecking for yum or apt-get, as we want it to exit with
125+
# error even if we're not on Debian or red hat.
126+
status=1
127+
fi
128+
129+
130+
if [ $(pwd | wc -w) -gt 1 ]; then
131+
echo "*** $0: Warning: pocolm scripts may fail if the directory name contains a space."
132+
echo "*** (it's OK if you just want to compile a few tools -> disable this check)."
133+
status=1;
134+
fi
135+
136+
if ! $printed && [ $status -eq 0 ]; then
137+
echo "$0: all OK."
138+
fi
139+
140+
141+
exit $status

0 commit comments

Comments
 (0)