[Corpora-List] LaTeX for alignment visualization

Adam Lopez alopez at inf.ed.ac.uk
Wed Sep 29 13:46:14 UTC 2010


Stuff like this is really easy to do in PGF/TikZ, which is a powerful
LaTeX package for producing figures.  Here's the code for a crossing
alignment:

% begin LaTeX code =================
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
	\matrix(m)[matrix of nodes,row sep=1cm]{
	a & b & c & d\\
	B & D & A & C\\
	};
	\draw (m-1-1) -- (m-2-3);
	\draw (m-1-2) -- (m-2-1);
	\draw (m-1-3) -- (m-2-4);
	\draw (m-1-4) -- (m-2-2);
\end{tikzpicture}
\end{document}
% end LaTeX code ===================

Drawing the alignment links between the words is as simple as
enumerating their indexes in the source and target sentence.  It would
be straightforward to turn this into a LaTeX macro, or write a simple
script to generate this code from data.  PGF is standard in many newer
LaTeX distributions, is platform-independent, and, IMO, generates much
more attractive graphics than external drawing packages (which use
different fonts and often aren't good at sub/ superscripts, Greek
letters, etc.)

Cheers
Adam

On Wed, Sep 29, 2010 at 2:17 PM, Nitin Madnani <nmadnani at gmail.com> wrote:
> Hi Joerg,
>
> I have always used Omnigraffle (on the mac) for manually building my
> alignment matrices (see my Computational Linguistics paper for
> examples). They look really nice but, of course, you can't do this for
> a large number of sentences. if you want an alignment matrix directly
> in LaTeX format, check out PostCAT
> (http://www.seas.upenn.edu/~strctlrn/CAT/CAT.html) which has a LaTeX
> mode. If you are okay with writing your own code to convert an
> alignment printed to the screen, you can check out the cdec decoder
> (http://cdec-decoder.org/index.php?title=Main_Page) or even Moses
> (www.statmt.org/moses). I also remember Chris Callison-Burch had
> developed a very nice alignment matrix visualization tool that you
> could screen grab once you load the alignments into it. However, I
> can't see it on his webpage right now. I am pretty sure he would be
> happy to share it with you if he still has it lying around somewhere.
>
> Hope this helps,
> Nitin
>
> On Wed, Sep 29, 2010 at 8:53 AM, Joerg Tiedemann
> <jorg.tiedemann at lingfil.uu.se> wrote:
>> Dear all,
>>
>> I was wondering what kind of LaTeX packages/macros people use in their
>> papers for visualizing word & phrase alignments. I'm looking for
>> simple ways of producing nice-looking pictures for several types of
>> alignments and alignment problems. I need both types, links as lines
>> between words in parallel sentences and matrix-based alignment
>> visualization (with boxes for aligned phrases).
>>
>> So far I used eclbip for the line-based style but I just realized that
>> the package is obsolete (and the pictures are not very clean either)
>> and I don't know if there is a replacement with a similar simple
>> interface for bipartite graphs somewhere. I know that there are
>> several packages for graphs but I liked the simplistic way of
>> specifying links with the eclbip package. For the matrix-based style I
>> don't know at all especially when including phrase alignment boxes.
>> Anything that does not force me to draw pictures by hand or to mess
>> around with pstricks or something similar would help me a lot.
>>
>> Thanks in advance for any links!
>>
>> Jörg
>>
>>
>> --
>> **********************************************************************************
>>  Jörg Tiedemann                                     jorg.tiedemann at lingfil.uu.se
>>  Dep. of Linguistics and Philology
>> http://stp.lingfil.uu.se/~joerg/
>>  Uppsala University                                  tel:  +46 (0)18 - 471 1412
>>  Box 635, SE-751 26 Uppsala/SWEDEN   fax: +46 (0)18 - 471 1094
>>
>> _______________________________________________
>> Corpora mailing list
>> Corpora at uib.no
>> http://mailman.uib.no/listinfo/corpora
>>
>
>
>
> --
> Got Blog?
> http://greenideas.blogspot.com
>
> _______________________________________________
> Corpora mailing list
> Corpora at uib.no
> http://mailman.uib.no/listinfo/corpora
>

_______________________________________________
Corpora mailing list
Corpora at uib.no
http://mailman.uib.no/listinfo/corpora



More information about the Corpora mailing list