parallelize
Classes and functions to sentence align two files.
divide_p_into_sentences(filepair)
Tokenize the text in the given file and reassemble it again.
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
68 69 70 71 72 73 74 75 76 77 78 79 |
|
is_translated_from_lang2(path, lang2)
Find out if the given doc is translated from lang2.
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
198 199 200 201 202 203 204 205 |
|
main()
Parallelise files.
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|
make_tca2_input(xmlfile)
Make sentence xml that tca2 can use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xmlfile |
str
|
name of the xmlfile |
required |
Returns:
Type | Description |
---|---|
lxml.etree.Element
|
an xml element containing all sentences. |
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
parallelise_file(source_lang_file, para_lang_file, dictionary)
Align sentences of two parallel files.
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
parse_options()
Parse the commandline options.
Returns:
Type | Description |
---|---|
argparse.Namespace
|
the parsed commandline arguments |
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
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 |
|
remove_s_tag(line)
Remove the s tags that tca2 has added.
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
90 91 92 93 94 |
|
run_command(command)
Run a parallelize command and return its output.
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
82 83 84 85 86 87 |
|
setup_anchors(lang1, lang2)
Setup anchor file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lang1 |
str
|
language 1 |
required |
lang2 |
str
|
language 2 |
required |
Returns:
Type | Description |
---|---|
generate_anchor_list.GenerateAnchorList
|
The anchor list |
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
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 |
|
tca2_align(file1, file2, anchor_filename)
Parallelize two files using tca2.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file1 |
CorpusPath
|
file1 |
required |
file2 |
CorpusPath
|
file2 |
required |
anchor_filename |
str
|
filename |
required |
Returns:
Type | Description |
---|---|
list[str]
|
the sentence aligned output of tca2 |
Source code in /home/anders/projects/CorpusTools/corpustools/parallelize.py
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 |
|