[CWB] Question re: parallel corpora set up
Stephanie Evert
stefanML at collocations.de
Sun Jul 12 14:04:23 CEST 2026
Hi again!
>> Which means that you can "simply" generate your own alignment in this text format and then run cwb-align-encode. You can also preview your alignment with cwb-align-show first to check that you've got the format right.
> So as I understand this, given that my s tags are one-to-one correspondancse, it would be enough for me to upload an .align file reading 1 <TAB> 1, 2 <TAB> 2, etc.?
No, the input file has to list the start and end corpus positions of the corresponding regions.
If your pre-alignment is encoded in s-attribute "s" in both SOURCE and TARGET corpus, and if there's indeed a perfect correspondence between the reasons, these unix command-line steps will give you most of the .align file (you just need to add a header line as described in "man cwb-align").
cwb-s-decode SOURCE s > tmp1.txt
cwb-s-decode TARGET s > tmp2.txt
paste tmp1.txt tmp2.txt > source_target.align
But it's even easier to use "cwb-align" to generate the file, by using "s" both as the alignment grid and as pre-alignment.
cwb-align -o source_target.align -S s SOURCE TARGET s -C:1
"cwb-align" has no choice but to generate all 1:1 alignments because there's only a single source and target region in each pre-alignment block. (Theoretically it could split them into 1:0 and 0:1 beads, but that should always get a worse score than the 1:1 alignment.) You could also just use the default feature set, but using only sentence length (-C:1) is avoids unnecessary work.
>> If you have a pre-alignment (which might be at a different level than sentences), you can indicate this to cwb-align, which will force the aligner to only consider sentence correspondences that are consistent with the pre-alignment. A trick I've sometimes used is to specify the same s-attribute that encodes the pre-alignment (keep in mind that there must be a single region for each pre-alignment block) as alignment grid, which keeps cwb-align from making any changes.
> Does this mean that, since I specify alignment on s tags in cwb-align, I should be getting what I want to achieve anyway?
If you do it as I've shown above, this should just pass through the pre-alignment.
> My pre-alignement is tagged <s> ... </s> which generally, but not always, correspond to sentences. As I understand it, I'd need to tag it <s id="1"> ... </s>, etc. Is that right? If so, could it just, trivially, be a question of added the "id" attribute incrementally to the already present "s" tags in order to run cwb-align-import with my pre-aligned material?
Yes, that would be the cleanest solution, combined with an input file that lists the trivially corresponding IDs
1 TAB 1
2 TAB 2
...
Best,
Stephanie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20260712/dbeb7067/attachment-0001.html>
More information about the CWB
mailing list