diff --git a/umbra/statistics.py b/umbra/statistics.py index 9317414ecee83b9fcdb64895ba0d0b55c85bf93a..f2027ded814a360193bf04ac5b606e9c601bc2ff 100644 --- a/umbra/statistics.py +++ b/umbra/statistics.py @@ -5,6 +5,7 @@ from anchor_algorithm import AnchorAlgorithm from mistake_finder import MistakeFinder from OpenDutchWordnet.wn_grid_parser import Wn_grid_parser from semantic_checker import SemanticChecker +from utils import Utils as ut class Statistics: @@ -18,8 +19,9 @@ class Statistics: # currently the case, so the two operate seperately in this class. # _parser and _seman_checker should be moved to MistakeFinder when # possible. - self._parser = Wn_grid_parser( - "OpenDutchWordnet/resources/odwn/odwn_orbn_gwg-LMF_1.3.xml.gz") + self.path = "OpenDutchWordnet/resources/odwn/odwn_orbn_gwg-LMF_1.3.xml.gz" + self._parser = Wn_grid_parser(ut.get_path(self.path) + ) self._parser.load_synonyms_dicts() self._seman_checker = SemanticChecker(self._parser) self._mistake_finder = MistakeFinder(self._seman_checker) @@ -68,4 +70,3 @@ class Statistics: self._mistake_finder.start(source_align_em, shadow_align_em) return source_align_em, shadow_align_em, correctness - diff --git a/umbra/utils.py b/umbra/utils.py index b8937f3f96906f6b4d50342c60b27653a98e64c8..e3b8c0cc72b1b519aa778e095e46b354ab17c1e5 100644 --- a/umbra/utils.py +++ b/umbra/utils.py @@ -1,3 +1,4 @@ +import sys class Utils: @staticmethod @@ -32,3 +33,9 @@ class Utils: m, s = divmod(s, 60) h, m = divmod(m, 60) return "%02i:%02i:%02i.%03i" % (h, m, s, ms) + + def get_path(path): + if sys.platform.startswith('freebsd'): + return path + elif sys.platform.startswith('linux'): + return"./umbra/"+path