xsl-list
[Top] [All Lists]

Re: [xsl] reversing dictionary in xml

2009-11-16 13:15:59
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(_at_)yahoo(_dot_)com> 
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>
 <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.




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>