diff --git a/README.md b/README.md index 817f888..3be0726 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,10 @@ Either install from PyPI using pip: `pip install hebpipe` +And run as a module: + +`python -m hebpipe example_in.txt` + Or install manually: * Clone this repository into the directory that the script should run in (git clone https://github.com/amir-zeldes/HebPipe) diff --git a/hebpipe/heb_pipe.py b/hebpipe/heb_pipe.py index 4c5a547..34f00f7 100644 --- a/hebpipe/heb_pipe.py +++ b/hebpipe/heb_pipe.py @@ -7,12 +7,21 @@ from glob import glob from rftokenizer import RFTokenizer -from lib.xrenner import Xrenner -from lib._version import __version__ -from lib.tt2conll import conllize -from lib.append_column import inject_col -from lib.sent_split import toks_to_sents -from lib.whitespace_tokenize import tokenize as whitespace_tokenize +try: # Module usage + from .lib.xrenner import Xrenner + from .lib._version import __version__ + from .lib.tt2conll import conllize + from .lib.append_column import inject_col + from .lib.sent_split import toks_to_sents + from .lib.whitespace_tokenize import tokenize as whitespace_tokenize +except ImportError: # direct script usage + from lib.xrenner import Xrenner + from lib._version import __version__ + from lib.tt2conll import conllize + from lib.append_column import inject_col + from lib.sent_split import toks_to_sents + from lib.whitespace_tokenize import tokenize as whitespace_tokenize + PY3 = sys.version_info[0] > 2 @@ -617,7 +626,10 @@ def run_hebpipe(): dotok = opts.tokenize if not opts.quiet: - from lib import timing + try: + from .lib import timing + except ImportError: # direct script usage + from lib import timing files = glob(opts.files) diff --git a/hebpipe/lib/_version.py b/hebpipe/lib/_version.py index dd711c7..daaf383 100644 --- a/hebpipe/lib/_version.py +++ b/hebpipe/lib/_version.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -__version__ = "1.0.0.1" +__version__ = "1.0.0.2" __author__ = "Amir Zeldes" __copyright__ = "Copyright 2018-2020, Amir Zeldes" __license__ = "Apache 2.0 License" diff --git a/setup.py b/setup.py index b1194b5..70d0045 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name = 'hebpipe', packages = find_packages(), - version = '1.0.0.1', + version = '1.0.0.2', description = 'A pipeline for Hebrew NLP', author = 'Amir Zeldes', author_email = 'amir.zeldes@georgetown.edu', @@ -11,7 +11,7 @@ install_requires=['numpy','pandas','scipy','joblib','xgboost==0.81','rftokenizer','depedit','xmltodict'], url = 'https://github.com/amir-zeldes/HebPipe', license='Apache License, Version 2.0', - download_url = 'https://github.com/amir-zeldes/HebPipe/releases/tag/v1.0.0.1', + download_url = 'https://github.com/amir-zeldes/HebPipe/releases/tag/v1.0.0.2', keywords = ['NLP', 'Hebrew', 'segmentation', 'tokenization', 'tagging', 'parsing','morphology','POS'], classifiers = ['Programming Language :: Python', 'Programming Language :: Python :: 2',