nlppln.utils module

NLP pipeline utility functionality

nlppln.utils.create_dirs(fname, is_file=False)

Create (output) directories if they don’t exist

Removes the file name part if is_file is set to True.

nlppln.utils.cwl_file(fname)
nlppln.utils.get_files(directory, recursive=False)

Return a list of all files in the directory.

nlppln.utils.out_file_name(out_dir, fname, ext=None)

Return path of output file, given a directory, file name and extension.

If fname is a path, it is converted to its basename.

Parameters:
  • out_dir (str) – path to the directory where output should be written.
  • fname (str) – path to the input file.
  • ext (str) – file extension of the output file (defaults to None).
Returns:

out_dir + fname with extension replaced. If ext is None, the

original extension is kept.

Return type:

str

nlppln.utils.read_xml(fname)
nlppln.utils.remove_ext(fname)

Removes the extension from a filename

nlppln.utils.split(s)
nlppln.utils.write_xml(soup, fname)