soshial / xdxf_makedict

XDXF — an open and free dictionary format, that stores word articles in a structural and semantic way. The most convertible format
223 stars 54 forks source link

Structure of definitions [move to wiki] #37

Open soshial opened 5 years ago

soshial commented 5 years ago

@k-sl wrote that:

<def>/<deftext>: The usage of the elements <def> and <deftext> is confusing.

I would like to bring more clarity into usage of those. I encountered a problem while working with nested meaning groups and complex meanings that have some specific properties. Before rev. 33 there was only 1 tag for text of word meaning, which was <def>.

Let's look at different possible cases of word article structures. <entry> and <sense> are pseudocode tags and are used for easy understanding.

soshial commented 5 years ago

A noun ("river") has only 2 meanings.

river (noun)

  1. a large natural stream of water flowing in a channel to the sea, a lake, or another river
  2. a large quantity of a flowing substance

this will be encoded in XDXF as following:

<ar>
    <k>river</k>
    <def>
        <def>
            <deftext>a large natural stream of water flowing in a channel to the sea, a lake, or another</deftext>
        </def>
        <def>
            <deftext>a large quantity of a flowing substance</deftext>
        </def>
    </def>
</ar>
soshial commented 5 years ago

A verb "marry" with two meaning groups:

marry (verb)

  1. To join in wedlock or matrimony (...) a. in pass. (with ref. either to the act and ceremony, or to the wedded state as a result). b. Said of the priest or other functionary who performs the rite. Also absol.

  2. a. To give in marriage, cause to be married. Said esp. of a parent or guardian. b. With off.

It will be encoded in XDXF like this:

<ar>
    <k>marry</k>
    <def>
        <def cmt="To join in wedlock or matrimony (...)">
            <def>
                <gr>in pass.</gr>
                <deftext>(with ref. either to the act and ceremony, or to the wedded state as a result).
                </deftext>
            </def>
            <def>
                <deftext>Said of the priest or other functionary who performs the rite. Also absol.</deftext>
            </def>
        </def>
        <def>
            <def>
                <deftext>To give in marriage, cause to be married. Said esp. of a parent or guardian.</deftext>
            </def>
            <def>
                <deftext>With off</deftext>
            </def>
        </def>
    </def>
</ar>

You may draw main conclusion from aforewritten code:

Since all properties (like pronunciation, grammar features, examples, phraseologisms) may be relevant both to a smallest sense and to sense groups, I decided to make <def> act as both sense group and smallest meaning. S

There cannot it multiple <deftext> children tags from 1 <def> parent. This is because.

soshial commented 5 years ago

Another example with Wiktionary word bet

Screen Shot 2019-06-04 at 13 19 35

<ar>
    <k xml:lang="en">bet</k>
    <def>
        <tr>pronunciation</tr>
        <gr>anagrams</gr>
        <def>
            <etm>Etymology 1</etm>
            <def>
                <gr>Noun</gr>
                <def>
                    <deftext>A wager, an agreement between two parties that a stake (usually money) will be paid by the loser to the winner (the winner being the one who correctly forecast the outcome of an event).
                    </deftext>
                    <ex><ex_orig>Dylan owes Fletcher $30 from an unsuccessful bet.</ex_orig></ex>
                </def>
                <def>
                    <deftext>A degree of certainty.</deftext>
                    <ex><ex_orig>It’s a safe bet that it will rain tomorrow.</ex_orig></ex>
                </def>
            </def>
            <def>
                <gr>Verb</gr>
                <deftext>To stake or pledge upon the outcome of an event; to wager.</deftext>
                <ex><ex_orig>example 1</ex_orig></ex>
            </def>
            <def>
                <deftext>To be sure of something; to be able to count on something</deftext>
                <ex><ex_orig>example 2</ex_orig></ex>
            </def>
            <def>
                <deftext>(poker) To place money into the pot in order to require others do the same, usually only used for the first person to place money in the pot on each round.
                </deftext>
                <ex><ex_orig>example 3</ex_orig></ex>
            </def>
        </def>
        <def>
            <etm>Etymology 2</etm>
            <def>
                <gr>Noun</gr>
                <deftext>The letter in Semitic languages</deftext>
            </def>
        </def>
        <def>
            <etm>Etymology 3</etm>
            <def>
                <gr>Abbreviation</gr>
                <deftext>(knitting) between</deftext>
            </def>
        </def>
    </def>
</ar>
nikita-moor commented 5 years ago

Offtopic Line <ex>example 1</ex> is incorrect according to the DTD. Are <ex_orig> tags necessary in this case?

soshial commented 5 years ago

Sorry, I was a bit sloppy. My IDE did not show error automatically when I miss an element :( Now it is fixed.