Skip to content

Conversation

@lucas-jo
Copy link
Contributor

added install_morfessor.sh and its symbolic link

echo "#### installing morfessor"
dirname=morfessor
if [ ! -d ./$dirname ]; then
mkdir -p ./$dirname
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please change the tabs to spaces (each tab = two spaces)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied retab with size 2

@@ -0,0 +1 @@
extras/install_morfessor.sh No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't have to add this symlink (that is done only for historical reasons for some packages)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay got it. I deleted the symlink

fi

# local installation
site_packages_dir=$(python -m site --user-site | grep -oE "lib.*")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typically we try to not to install the packages system-wise (user-wise) -- we keep the libs in kaldi/tools/ and just set up the shell variables in env.sh (PYTHONPATH). Otherwise, you could just use pip install morfessor.

Also, in that case, the uninstallation is not needed -- you just delete the directory.

Copy link
Contributor Author

@lucas-jo lucas-jo Mar 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtrmal
That line is not intended to install morfessor in user-wise way.
It is just to grep the name of site-package name and use the name for PYTHONPATH variable before installation started,
otherwise, sometimes installation process could get an error.

Anyway after installation process, the morfessor libs will be located inside kaldi/tools/

@danpovey
Copy link
Contributor

@jtrmal, please merge when you think it's OK.

@jtrmal
Copy link
Contributor

jtrmal commented Mar 26, 2018 via email

mkdir -p ./$dirname
git clone https://github.com/aalto-speech/morfessor.git morfessor ||
{
if [ $? -ne 0 ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is confusing -- why you are testing the return code if you have the guarantee done by ||

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be removed

wd=`pwd`
wd=`readlink -f $wd || pwd`
export MORFESSOR="$wd/morfessor"
export PYTHONPATH="${PYTHONPATH:-}:$MORFESSOR/${site_packages_dir}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this is too complex for no clear reason (reason clear to me) -- you could just install into $MORFESSOR/local/ (or whatever) and this would greatly simplify the script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtrmal yep I agree on it.
Anyway it seems like @psmit shows us more clear way.
After scripts in scripts/ has been changed to executables, I'll update this code in more simpler way.


echo >&2 "installation of MORFESSOR finished successfully"
echo >&2 "please source tools/env.sh in your path.sh to enable it"
echo >&2 'when uninstall it, try: sudo rm $(cat ./morfessor/files.txt)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and when uninstalling -- you should delete the whole $MORFESSOR fir (and sudo shouldn't be needed to be used?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was intended to inform where exist the real files. Will be removed either

@psmit
Copy link
Contributor

psmit commented Mar 26, 2018

Morfessor author here. We normally recommend installing through pip or conda, but in this case there is a much simpler way:

  • Clone the github
  • Set PYTHONPATH to include the repo
  • Set PATH to include the scripts directory

Running setup.py has no benefit here in my opinion.

Uninstalling is as simple as removing the repo (and cleaning up the variables if so desired)

@jtrmal
Copy link
Contributor

jtrmal commented Mar 26, 2018 via email

@psmit
Copy link
Contributor

psmit commented Mar 26, 2018

One issue, I noticed that the scripts in scripts/ are actually not having the executable bit set when cloning, I can fix that upstream (in a couple hours)

@psmit
Copy link
Contributor

psmit commented Mar 27, 2018

Script have executable bit set now: aalto-speech/morfessor@6c5ad6d

Changing the gist of the script to:

git clone https://github.com/aalto-speech/morfessor.git morfessor
(
    echo 'export MORFESSOR="$(pwd)/morfessor"'
    echo 'export PATH="$(pwd)/morfessor/scripts:$PATH"'
    echo 'export PYTHONPATH="$(pwd)/morfessor:$PYTHONPATH"'
) >> env.sh

should be enough.

@psmit
Copy link
Contributor

psmit commented Mar 27, 2018

I just tested this script and it works for me (Ubuntu 16.04)

@jtrmal
Copy link
Contributor

jtrmal commented Mar 28, 2018

Thanks to both of you! Merging.

@jtrmal jtrmal merged commit 5e6bd39 into kaldi-asr:master Mar 28, 2018
@lucas-jo lucas-jo deleted the install_morfessor branch March 28, 2018 23:34
LvHang pushed a commit to LvHang/kaldi that referenced this pull request Apr 14, 2018
* added install_morfessor.sh and its symbolic link

* deleted symbolic link

* retab with size 2

* simplified installation process acc. to psmit's advice
Skaiste pushed a commit to Skaiste/idlak that referenced this pull request Sep 26, 2018
* added install_morfessor.sh and its symbolic link

* deleted symbolic link

* retab with size 2

* simplified installation process acc. to psmit's advice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants