Skip to content

Commit

Permalink
Moved extra init code to a .py file
Browse files Browse the repository at this point in the history
  • Loading branch information
aajanki committed Aug 28, 2020
1 parent a261fa5 commit d9e4824
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 8 additions & 0 deletions python_packaging/init_extra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@



from spacy.util import set_lang_class
from .fi import FinnishEx, FinnishExDefaults
from .lemmatizer import FinnishLemmatizer

set_lang_class('fi', FinnishEx)
12 changes: 1 addition & 11 deletions tools/package_model.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,7 @@ mkdir -p models/python-package/"$PACKAGE_DIR/$MODEL_NAME"
cp -r fi/[^_]*.py fi/lookups/ models/python-package/"$PACKAGE_DIR/$MODEL_NAME"/

echo "Adding import to __init__.py"
cat - >> models/python-package/"$PACKAGE_DIR/$MODEL_NAME"/__init__.py <<EOF
from spacy.util import set_lang_class
from .fi import FinnishEx, FinnishExDefaults
from .lemmatizer import FinnishLemmatizer
set_lang_class('fi', FinnishEx)
EOF

cat python_packaging/init_extra.py >> models/python-package/"$PACKAGE_DIR/$MODEL_NAME"/__init__.py

echo "Updating requirements in meta.json"
jq '.requirements = ["voikko>=0.5"]' \
Expand Down

0 comments on commit d9e4824

Please sign in to comment.