From 59311690edab092658202b852a4b58bf8047049b Mon Sep 17 00:00:00 2001 From: amir-zeldes Date: Fri, 20 Jan 2023 17:05:14 -0500 Subject: [PATCH] V3.0.0.2 fix relative module import issue * Fixes #31 --- hebpipe/lib/__init__.py | 13 +++++++++++++ hebpipe/lib/_version.py | 4 ++-- hebpipe/lib/mtlmodel.py | 17 ++++++++++++----- setup.py | 4 ++-- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/hebpipe/lib/__init__.py b/hebpipe/lib/__init__.py index e69de29..b3b2d8f 100644 --- a/hebpipe/lib/__init__.py +++ b/hebpipe/lib/__init__.py @@ -0,0 +1,13 @@ +try: + from .tt2conll import conllize + from .reorder_sgml import reorder + from .dropout import WordDropout,LockedDropout + from .crfutils.crf import CRF + from .crfutils.viterbi import ViterbiDecoder,ViterbiLoss +except ModuleNotFoundError: + from lib.tt2conll import conllize + from lib.reorder_sgml import reorder + from lib.dropout import WordDropout,LockedDropout + from lib.crfutils.crf import CRF + from lib.crfutils.viterbi import ViterbiDecoder,ViterbiLoss + diff --git a/hebpipe/lib/_version.py b/hebpipe/lib/_version.py index 5aa84fd..a47215e 100644 --- a/hebpipe/lib/_version.py +++ b/hebpipe/lib/_version.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -__version__ = "3.0.0.1" +__version__ = "3.0.0.2" __author__ = "Amir Zeldes" -__copyright__ = "Copyright 2018-2022, Amir Zeldes" +__copyright__ = "Copyright 2018-2023, Amir Zeldes" __license__ = "Apache 2.0 License" diff --git a/hebpipe/lib/mtlmodel.py b/hebpipe/lib/mtlmodel.py index 3997f3f..f460e33 100644 --- a/hebpipe/lib/mtlmodel.py +++ b/hebpipe/lib/mtlmodel.py @@ -9,14 +9,21 @@ from flair.data import Dictionary, Sentence -from lib.dropout import WordDropout,LockedDropout from transformers import BertModel,BertTokenizerFast,BertConfig from random import sample from collections import defaultdict -from lib.crfutils.crf import CRF -from lib.crfutils.viterbi import ViterbiDecoder,ViterbiLoss -from lib.reorder_sgml import reorder -from lib.tt2conll import conllize +try: + from lib.dropout import WordDropout,LockedDropout + from lib.crfutils.crf import CRF + from lib.crfutils.viterbi import ViterbiDecoder,ViterbiLoss + from lib.reorder_sgml import reorder + from lib.tt2conll import conllize +except ModuleNotFoundError: + from .dropout import WordDropout, LockedDropout + from .crfutils.crf import CRF + from .crfutils.viterbi import ViterbiDecoder, ViterbiLoss + from .reorder_sgml import reorder + from .tt2conll import conllize from time import time diff --git a/setup.py b/setup.py index e0940d6..782a08c 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name = 'hebpipe', packages = find_packages(), - version = '3.0.0.1', + version = '3.0.0.2', description = 'A pipeline for Hebrew NLP', author = 'Amir Zeldes', author_email = 'amir.zeldes@georgetown.edu', @@ -11,7 +11,7 @@ install_requires=['requests','numpy','transformers==3.5.1','torch==1.7.1','pandas','scipy','joblib','xgboost==0.81','rftokenizer','depedit','xmltodict', 'diaparser==1.1.2','flair==0.6.1','stanza','conllu','protobuf==3.20.*'], url = 'https://github.com/amir-zeldes/HebPipe', license='Apache License, Version 2.0', - download_url = 'https://github.com/amir-zeldes/HebPipe/releases/tag/v3.0.0.1', + download_url = 'https://github.com/amir-zeldes/HebPipe/releases/tag/v3.0.0.2', keywords = ['NLP', 'Hebrew', 'segmentation', 'tokenization', 'tagging', 'parsing','morphology','POS','lemmatization'], classifiers = ['Programming Language :: Python', 'Programming Language :: Python :: 2',