file_processing
autocorpus.file_processing
¤
Module providing functions for processing files with Auto-CORPus.
Attributes¤
Classes¤
Functions¤
process_directory(config, dir_path)
¤
Process all files in a directory and its subdirectories.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
dict[str, Any]
|
Configuration dictionary for the input HTML journal articles |
required |
dir_path
|
Path
|
Path to the directory containing files to be processed. |
required |
Returns:
Type | Description |
---|---|
Iterable[Autocorpus]
|
A generator yielding Autocorpus objects for each processed file. |
Source code in autocorpus/file_processing.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
process_file(config, file_path, linked_tables=[])
¤
Process the input file based on its type.
This method checks the file type and processes the file accordingly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
dict[str, Any]
|
Configuration dictionary for the input journal articles |
required |
file_path
|
Path
|
Path to the article file to be processed |
required |
linked_tables
|
list[Path]
|
list of linked table file paths to be included in this run (HTML files only) |
[]
|
Raises:
Type | Description |
---|---|
NotImplementedError
|
For files types with no implemented processing. |
ModuleNotFoundError
|
For PDF processing if required packages are not found. |
Source code in autocorpus/file_processing.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
process_files(config, files)
¤
Process all files in a list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
dict[str, Any]
|
Configuration dictionary for the input HTML journal articles |
required |
files
|
list[Path]
|
list of Paths to the files to be processed. |
required |
Returns:
Type | Description |
---|---|
Iterable[Autocorpus]
|
A generator yielding Autocorpus objects for each processed file. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the list of files is invalid. |
Source code in autocorpus/file_processing.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|