Subject: Re: [xsl] reversing dictionary in xml From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Mon, 16 Nov 2009 10:15:32 -0800 |
Would you really expect any useful answers for a very ambigouos "problem"? -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play On Mon, Nov 16, 2009 at 5:31 AM, Robert Ee <eerobert24@xxxxxxxxx> wrote: > 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> > B <lem> > <LEMID>17688</LEMID> > <HEADW>obscuur</HEADW> > <GRAMT>adj</GRAMT> > B <meaning B id='BNT-19'> > B <BETNR>1</BETNR> > B B <trn> > B B <mtrn> > B B B B <MTRANS>dark</MTRANS> > B B B B <GRAMV>-er</GRAMV> > B B B B <REVRK>dark</REVRK> > B B </mtrn> > B B <sytrn> > B B B <SYNTR>obscure</SYNTR> > B B B <GRAMV>-r</GRAMV> > B B B <REVRS>obscure</REVRS> > B B </sytrn> > B B <sytrn> > B B B <LABEL>formal</LABEL> > B B B <SYNTR>awkward</SYNTR> > B B B <GRAMV>-er</GRAMV> > B B B <REVRS>awkward</REVRS> > B B </sytrn> > B B <sytrn> > B B B <SYNHW>eng</SYNHW> > B B B <SYNTR>spooky</SYNTR> > B B B <GRAMV>-kier</GRAMV> > B B B <REVRK>spooky</REVRK> > B B </sytrn> > B B </trn> > B B <exmpl> > B B <VOORB>een obscuur zaakje</VOORB> > B B <vve> > B B <VVERT>an awkward case</VVERT> > B B <REVRS>akward</REVRS> > B B </vve> > B </exmpl> > B </meaning> > B </lem> > > B <lem> > <LEMID>000000</LEMID> > <HEADW>vreemd</HEADW> > <GRAMT>adj</GRAMT> > B <meaning B id='BNT-20'> > B B <BETNR>1</BETNR> > B B <trn> > B B <mtrn> > B B B B <MTRANS>strange</MTRANS> > B B B B <GRAMV>-er</GRAMV> > B B B B <REVRK>strange</REVRK> > B B </mtrn> > B B <sytrn> > B B B <SYNTR>awkward</SYNTR> > B B B <GRAMV>-er</GRAMV> > B B B <REVRS>awkward</REVRS> > B B </sytrn> > B B </trn> > B B <exmpl> > B B <VOORB>een vreemde kerel</VOORB> > B B <vve> > B B <VVERT>an awkward fellow</VVERT> > B B <REVRS>awkward</REVRS> > B B </vve> > B </exmpl> > B </meaning> > B </lem> > </wb> > </dictionary> > > Result reversed dictionary > <dictionary> > <lem> > B <HEADW>dark</HEADW> > B <CAT>adj</CAT> > B <GRAMH>-er</GRAMH> > B <meaning id='1328'> > B <RES>obscure</RES> > B <trn> > B B <mtrn> > B B <orig id='BNT-20'/> > <MTRANS>obscuur</MTRANS> > B B </mtrn> > B </trn> > B </meaning> > </lem> > > <lem> > <HEADW>awkward</HEADW> > <CAT>adj</CAT> > <GRAMH>-er</GRAMH> > <meaning B id='1287'> > B <orig id='BNT-19'/> > B <RES>dark</RES> > B B <trn> > B B <mtrn> > B B <MTRANS>obscuur</MTRANS> > B B <LABEL>formal</LABEL> > B B <mtrn> > B B </trn> > B B <exmpl> > B B <VOORB>an awkward case</VOORB> > B B <vve><VVERT>een obscuur zaakje</VVERT></vve> > B B </exmpl> > B </meaning> > <meaning B id='1288'> > <orig id='BNT-21'/> > B B <RES>strange</RES> > B B <trn> > B B <mtrn> > B B <MTRANS>vreemd</MTRANS> > B B </mtrn> > B B </trn> > <exmpl> > B B <VOORB>an awkward fellow</VOORB> > B B <vve> > B B <VVERT>een vreemde kerel</VVERT> > B B </vve> > </exmpl> > <meaning > > </meaning> > </lem> > > <lem> > <HEADW>spooky</HEADW> > <CAT>adj</CAT> > <GRAMV>-ier</GRAMV> > <meaning > > <trn> > B <orig id='BNT-19'/> > B B <mtrn> > B B B <MTRANS>eng</MTRANS> > B B </mtrn> > B B <sytrn> > B B B <SYNTR>obscuur</SYNTR> > B B </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] reversing dictionary in x, Robert Ee | Thread | [xsl] measuring performance of XSLT, a kusa |
Re: [xsl] reversing dictionary in x, Robert Ee | Date | Re: [xsl] measuring performance of , Tony Graham |
Month |