diff --git a/src/algorithms/uast_to_bag_paths.py b/src/algorithms/uast_to_bag_paths.py index 0900be7..cc41cd6 100644 --- a/src/algorithms/uast_to_bag_paths.py +++ b/src/algorithms/uast_to_bag_paths.py @@ -27,7 +27,7 @@ def __call__(self, uast): """ path_contexts = get_paths(uast, self._max_length, self._max_width) - dict_of_paths = Counter(path_contexts) + dict_of_paths = {str(path): val for path, val in Counter(path_contexts).items()} self._log.info("Extracted paths successfully") from pprint import pprint diff --git a/src/extractors/paths.py b/src/extractors/paths.py index 8fee063..56bf826 100644 --- a/src/extractors/paths.py +++ b/src/extractors/paths.py @@ -12,4 +12,4 @@ def __init__(self, max_length=5, max_width=5, **kwargs): self.uast2paths = Uast2BagOfPaths(max_length, max_width) def uast_to_bag(self, uast): - return {str(path): 1 for path in self.uast2paths(uast)} + return self.uast2paths(uast)