def get_object(self, name):
        fields_file = "%s_fields.json" % name
        fields_path = os.path.join(self.path, fields_file)

        name = name + self.extension
        path = os.path.join(self.path, name)

        args = dict(self.kwargs)
        if os.path.exists(fields_path):
            with open(fields_path) as f:
                metadata = json.load(f)
            args["fields"] = FieldList(*metadata)

        if self.role in ["s", "src", "source"]:
            return CSVSource(path, **args)
        elif self.role in ["t", "target"]:
            return CSVTarget(path, **args)
        else:
            raise ArgumentError("Unknown CSV object role '%s'" % role)
Crops text after whole words.
dataset/ETHPy150Open Stiivi/bubbles/bubbles/backends/text/objects.py/CSVStore.get_object--crossover with--dataset/ETHPy150Open ofri/Open-Knesset/auxiliary/templatetags/common_text_handling.py/pretty_crop