Skip to content

Commit

Permalink
feat: check jar file
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Apr 25, 2019
1 parent 3988f4f commit 6e29d4f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cophi/__version__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION = (1, 3, 1)
VERSION = (1, 3, 2)

__version__ = ".".join(map(str, VERSION))
9 changes: 9 additions & 0 deletions src/cophi/dkpro/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class DKPro:
def __init__(self, jar, xms="4g"):
self.jar = jar
self.xms = xms
self._check()

def process(self, **parameters):
"""Process a single text file or a whole directory.
Expand All @@ -35,6 +36,14 @@ def process(self, **parameters):
"""
return dkpro.core.call(self.jar, self.xms, **parameters)

def _check(self):
jar = Path(self.jar)
configs = Path(jar.parent, "configs")
if not jar.exists() or jar.suffix != ".jar":
raise OSError("DARIAH-DKPro-Wrapper JAR file not found.")
if not configs.exists():
raise OSError("DARIAH-DKPro-Wrapper configs folder not found.")


class Document:
def __init__(self, filepath):
Expand Down

0 comments on commit 6e29d4f

Please sign in to comment.