|
Subject: [xsl] reversing dictionary in xml From: Robert Ee <eerobert24@xxxxxxxxx> Date: Mon, 16 Nov 2009 05:31:49 -0800 (PST) |
Dear experts,
I am working on a bilingual dictionary (language A- language B) file, which I need to reverse to a B-A file.
(Some people may recognise Dutch and English in this example.)
I found out how to make a rough conversion by means of xsl, by copying from replies to other questions.
However, I cannot implement my requests. For one thing, think I have to make two keys in order to put the exemplifying sentences in the right place.
Hope that you can help me out!
Robert
The xml file is as follows:
<dictionary>
<lem>
<LEMID>17688</LEMID>
<HEADW>obscuur</HEADW>
<GRAMT>adj</GRAMT>
<meaning id='BNT-19'>
<BETNR>1</BETNR>
<trn>
<mtrn>
<MTRANS>dark</MTRANS>
<GRAMV>-er</GRAMV>
<REVRK>dark</REVRK>
</mtrn>
<sytrn>
<SYNTR>obscure</SYNTR>
<GRAMV>-r</GRAMV>
<REVRS>obscure</REVRS>
</sytrn>
<sytrn>
<LABEL>formal</LABEL>
<SYNTR>awkward</SYNTR>
<GRAMV>-er</GRAMV>
<REVRS>awkward</REVRS>
</sytrn>
<sytrn>
<SYNHW>eng</SYNHW>
<SYNTR>spooky</SYNTR>
<GRAMV>-kier</GRAMV>
<REVRK>spooky</REVRK>
</sytrn>
</trn>
<exmpl>
<VOORB>een obscuur zaakje</VOORB>
<vve>
<VVERT>an awkward case</VVERT>
<REVRS>akward</REVRS>
</vve>
</exmpl>
</meaning>
</lem>
<lem>
<LEMID>000000</LEMID>
<HEADW>vreemd</HEADW>
<GRAMT>adj</GRAMT>
<meaning id='BNT-20'>
<BETNR>1</BETNR>
<trn>
<mtrn>
<MTRANS>strange</MTRANS>
<GRAMV>-er</GRAMV>
<REVRK>strange</REVRK>
</mtrn>
<sytrn>
<SYNTR>awkward</SYNTR>
<GRAMV>-er</GRAMV>
<REVRS>awkward</REVRS>
</sytrn>
</trn>
<exmpl>
<VOORB>een vreemde kerel</VOORB>
<vve>
<VVERT>an awkward fellow</VVERT>
<REVRS>awkward</REVRS>
</vve>
</exmpl>
</meaning>
</lem>
</wb>
</dictionary>
Result reversed dictionary
<dictionary>
<lem>
<HEADW>dark</HEADW>
<CAT>adj</CAT>
<GRAMH>-er</GRAMH>
<meaning id='1328'>
<RES>obscure</RES>
<trn>
<mtrn>
<orig id='BNT-20'/>
<MTRANS>obscuur</MTRANS>
</mtrn>
</trn>
</meaning>
</lem>
<lem>
<HEADW>awkward</HEADW>
<CAT>adj</CAT>
<GRAMH>-er</GRAMH>
<meaning id='1287'>
<orig id='BNT-19'/>
<RES>dark</RES>
<trn>
<mtrn>
<MTRANS>obscuur</MTRANS>
<LABEL>formal</LABEL>
<mtrn>
</trn>
<exmpl>
<VOORB>an awkward case</VOORB>
<vve><VVERT>een obscuur zaakje</VVERT></vve>
</exmpl>
</meaning>
<meaning id='1288'>
<orig id='BNT-21'/>
<RES>strange</RES>
<trn>
<mtrn>
<MTRANS>vreemd</MTRANS>
</mtrn>
</trn>
<exmpl>
<VOORB>an awkward fellow</VOORB>
<vve>
<VVERT>een vreemde kerel</VVERT>
</vve>
</exmpl>
<meaning >
</meaning>
</lem>
<lem>
<HEADW>spooky</HEADW>
<CAT>adj</CAT>
<GRAMV>-ier</GRAMV>
<meaning >
<trn>
<orig id='BNT-19'/>
<mtrn>
<MTRANS>eng</MTRANS>
</mtrn>
<sytrn>
<SYNTR>obscuur</SYNTR>
</sytrn>
</trn>
</meaning>
</lem>
</dictionary>
The rough reversion goes of course as follows:
1. MTRANS + GRAMV -> HEADW + GRAMH
The main translation + grammatical information become headword + grammatical info in the reversed dictionary (B-A), e.g.
vreemd: strange, awkward
The words that in B-A will serve as new main entrances and that collect as grouping keys for some reasons are in TWO different tags: REVRS and REVRK.
Further complications:
2. In the reversed dictionary B-A synonyms and main translations (in A-B) are used as explicative labels, e.g.
dark (obscure) obscuur
.....
....
obscure (dark) obscuur
This should only happen, though, if the SYNTR (synonym translation) in A-B does not have a SYNHW.
3. Examples are also reversed, in B-A they are grouped with the meaning they already belonged to in A-B, if there is another syntrn or mtrn. See the awkward case.
More could be said, but I hope the example speaks for itself.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Happy Birthday!, Vyacheslav Sedov | Thread | Re: [xsl] reversing dictionary in x, Martin Honnen |
| RE: [xsl] Display numeric string of, Surana, Swati | Date | RE: [xsl] Display numeric string of, Syd Bauman |
| Month |