corpuspath
This file contains classes to handle corpus filenames.
CorpusPath
dataclass
Map filenames in a corpus.
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
analysed
property
Return the path to analysed file.
converted
property
Return the path to the converted file.
korp_mono
property
Return the path to analysed file.
log
property
Return the path of the log file.
orig
property
Return the path of the original file.
tca2_input
property
Compute the name of the tca2 input file.
Returns:
Type | Description |
---|---|
pathlib.Path
|
the name of the tca2 input file |
tca2_output
property
Compute the name of the tca2 output file.
Returns:
Type | Description |
---|---|
pathlib.Path
|
the name of the tca2 output file |
xsl
property
Return the path of the metadata file.
__post_init__()
Initialise the metadata attribute.
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
93 94 95 |
|
crop_to_bytes(name, max_bytes)
staticmethod
Ensure name
is less than max_bytes
bytes.
Do not split name in the middle of a wide byte.
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
257 258 259 260 261 262 263 264 265 |
|
korp_tmx(target_language)
Return the path to korp processed tmx file.
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
180 181 182 183 184 185 186 |
|
name(module=None, corpus_lang=None, target_lang=None, filepath=None, suffix=None)
Returns a path based on the module and extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module |
str
|
string containing some corpus module |
None
|
corpus_lang |
str
|
corpus language, as a three letter language code |
None
|
target_lang |
str
|
string containing the target language of a tmx file |
None
|
filepath |
str
|
path to the file |
None
|
suffix |
str
|
file suffix |
None
|
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
parallel(language)
Check if there is a parallel for language.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
language |
str
|
language of the parallel file. |
required |
Returns:
Type | Description |
---|---|
pathlib.Path
|
path to the parallel file if it exist, else None |
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
parallels()
Return paths to all parallel files.
Yields:
Type | Description |
---|---|
str
|
path to the orig path of a parallel file. |
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
205 206 207 208 209 210 211 212 213 |
|
tmx(target_language)
Name of the tmx file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_language |
str
|
language of the parallel |
required |
Returns:
Type | Description |
---|---|
str
|
path to the tmx file |
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|
collect_files(entities, suffix)
Collect files with the specified suffix.
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
268 269 270 271 272 273 274 275 276 |
|
make_corpus_path(path)
Returns a CorpusPath from a given path
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
a path to a corpus file |
required |
Raises:
Type | Description |
---|---|
ValueError
|
the path is not part of a corpus. |
Source code in /home/anders/projects/CorpusTools/corpustools/corpuspath.py
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 |
|