Compounds

From Apertium
Jump to: navigation, search

Contents

Some languages in Indo-European, particularly Germanic languages and Proto-Indo-Iranian languages like Sanskrit, make long compound words with low frequency that are unlikely to be found in dictionaries. Typically for any "normal" noun, there can be around 10—100 compound nouns which inflect in exactly the same way (at least for Afrikaans).

  • Afrikaans: infrastruktuurontwikkelingsplan, infrastruktuur+ontwikkelings+plan ("infrastructure development plan"), (cf. personeelverminderingsprosedure, "personnel protection procedure")
  • Dutch : "hulpagina" (help page), "woordbetekenis" (meaning of a word), "inwonertal" (number of inhabitants)
  • German: Kontaktlinsenverträglichkeitstest, Kontakt+linsen+verträglichkeits+test ("contact-lens compatibility test")
  • Danish: Kontaktlinsevæske, Kontaktlinse+væske ("contact-lens liquid")
  • Sanskrit: विद्या + आतुर = विद्यातुर , vidyā + ātur = vidyātur ("eager to gain knowledge")
  • Esperanto: Vikitraduko, Vikio+traduko (Wiki translation). Tradukoservo (==tradukservo), traduko+servo (translation service). Poŝtelefono, poŝa+telefono (pocket phone). Bonkvalita, bona+kvalita (good quality). Diaro, dio+aro (god collection),


Both lttoolbox and HFST have methods for dynamically analysing unknown compound words into their constituent parts. See below for how it's done in lttoolbox.


[edit] Differences in left-parts and right-parts of compounds

In Germanic languages at least (possibly most others too?), compounds typically only inflect in the last part:

  • mobiltelefon = cell phone
  • mobiltelefonar = cell phones
  • NOT: *mobilartelefon ("cells phone")

The way this is solved in the current compound implementation in lttoolbox and lttoolbox-java is to have one symbol for word forms that may be a non-final part of a compund, compound-only-L, and one for forms that may end a compound, compound-R:

<pardef n="ep__n">
  <e>       <p><l>ane</l>       <r><s n="n"/><s n="m"/><s n="pl"/><s n="def"/><s n="compound-R"/></r></p></e>
  <e>       <p><l>ar</l>        <r><s n="n"/><s n="m"/><s n="pl"/><s n="ind"/><s n="compound-R"/></r></p></e>
  <e>       <p><l>en</l>        <r><s n="n"/><s n="m"/><s n="sg"/><s n="def"/><s n="compound-R"/></r></p></e>
  <e>       <p><l></l>          <r><s n="n"/><s n="m"/><s n="sg"/><s n="ind"/><s n="compound-R"/></r></p></e>
  <e r="LR"><p><l></l>          <r><s n="n"/><s n="m"/><s n="sg"/><s n="ind"/><s n="compound-only-L"/></r></p></e>
</pardef>
...
<e lm="mobil"><i>mobil</i><par n="ep__n"/></e>
<e lm="telefon"><i>telefon</i><par n="ep__n"/></e>

The "only" in here compound-only-L means that this form may only appear as part of a compound, not alone. The reason for this is explained below.

Note: the compound symbols do not appear in the output, they only signal to lt-proc-j that this form may appear in compounds.

[edit] Epenthetics

Many compounds have epenthetics, letters which connect the two words but perhaps only occur in compounds:

  • kransekake => krans+e+kake ≈ 'ring cake'
  • ungdomsfyll => ungdom+s+fyll = 'youth drunkenness'

The epenthetics do not have a meaning in themselves, and can typically only appear between compound parts (not when the word is by itself). (Their existance is purely phonological, "because nobody wants awkward morphemes"[1].)

[edit] Epenthetic analysis

We solve the analysis in lttoolbox and lttoolbox-java by the following type of paradigm:

<pardef n="krans__n">
  <e>       <p><l>ane</l>       <r><s n="n"/><s n="m"/><s n="pl"/><s n="def"/><s n="compound-R"/></r></p></e>
  <e>       <p><l>ar</l>        <r><s n="n"/><s n="m"/><s n="pl"/><s n="ind"/><s n="compound-R"/></r></p></e>
  <e>       <p><l>en</l>        <r><s n="n"/><s n="m"/><s n="sg"/><s n="def"/><s n="compound-R"/></r></p></e>
  <e>       <p><l></l>          <r><s n="n"/><s n="m"/><s n="sg"/><s n="ind"/><s n="compound-R"/></r></p></e>
  <e r="LR"><p><l>e</l>         <r><s n="n"/><s n="m"/><s n="sg"/><s n="ind"/><s n="compound-only-L"/></r></p></e>
</pardef>

As noted above, we have a difference between

  • compound-R meaning "this might be the right part of a compound, but might also stand alone", and
  • compound-only-L meaning "this might be the left part of a compound, but can't stand alone".

The above paradigm specifies that "kranse" may only appear as a left-part of a compound, it can't stand alone.

Objection 1: why not have just compound-L and compound-R, meaning "might be the left/right part or might stand alone"? Because you're never going to see "kakee" on its own, right?
Answer: True, we won't see "kakee" on its own, but "kranse" is a verb with another meaning, and tagging the noun as "compound-L" and allowing it to be analysed on its own would lead to unnecessary ambiguity.
Objection 2: Hey, you've got compound-only-L but not compound-L and not compund-only-R. You can't analyse Klingon!
Answer: This isn't even implemented yet. Once two symbols are implemented and working, we can think about adding the rest of the possibilites.
Objection 3: You really should have some sort of compound-both symbol for your <l/> entry instead of one with compound-only-L and one with compound-R, it'll mess up your tagger.
Answer: These symbols are removed in the output.

[edit] Epenthetic generation

When generating a compound, apertium-nn-nb at least simply adds the tag <cmp> to the left-part. The generator can then tell whether the left-part should have an epenthetic or not.

Example: after transfer we might have ^krans<n><m><sg><ind><cmp>$^kake<n><f><sg><ind>$. Then the generator just needs a pardef for krans that has the line

  <e r="RL"><p><l>e</l>         <r><s n="n"/><s n="m"/><s n="sg"/><s n="ind"/><s n="cmp"/></r></p></e>

in order to output the correct kransekake (epenthetic e).

If the output from transfer is ^gulrot<n><m><sg><ind><cmp>$^kake<n><f><sg><ind>$ ("carrot cake"), and the generator has

  <e r="RL"><p><l></l>         <r><s n="n"/><s n="m"/><s n="sg"/><s n="ind"/><s n="cmp"/></r></p></e>

in the pardef for gulrot, we get the correct gulrotkake (no epenthetic).

[edit] Meaning of epenthetics

The epenthetic has no meaning in itself, but if you can have the same word with or without an epenthetic, it might signal a difference. Compare:

  • sjefsekretær = 'chief of secretaries' (Norwegian)
  • sjefssekretær = 'the boss's secretary'
  • gjestfri = 'hospitable'
  • gjestefri = 'guest free' (as in "guest free zone")

(gjestfri would typically be listed in the dictionary, gjestefri being compositional.)

An epenthetic can also determine the meaning of an already ambiguous word-part:

  • tredørsvarianten = 'the three-door model'
  • tredørvarianten = 'the type of the wooden door'

Solution: add these to your dictionaries :-)

[edit] Outstanding questions

[edit] Stream symbol

We could use ~ instead of +, this would allow pretransfer to output '^$' instead of '^ $' for compounds (so transfer would no longer have to delete spaces)

This would need a small change in the tagger too. Can anyone think of a situation where it would need to be treated differently to normal def-mults?

[edit] Dix format

Currently we use

<s n="compound-only-L"/>
<s n="compound-R"/>

this could be changed to

<c r="L"/>
<c r="R"/>
We could also change "R" to only mark compound paths (so it would mean "compound-only-R"), since having a path that's both a compound part and usable as a full word is easily done with a pardef
Changes to dix format should be coordinated with unifying the metadix format

[edit] German/Capitalised compounds vs (proper noun) regexes

Some pairs use a regex to catch proper nouns, acronyms etc. Since regexes are no different from other entries in the FST, these will match before we get a chance to test for compounding. This means German nouns or capitalised compounds in other languages will never get a decompounding analysis.

[edit] When to compound

You shouldn't allow compounding on all words. In particular, if you allow compounding on all short words, you will get horrible results:

$ echo bildreportagen |apertium -d . swe-dan
billede #rids mugmide tagene

In Scandinavian dixen, it's common to have two versions of pardefs, one with and one without compounding:

<pardef n="ep__n">
  <e>       <p><l>ane</l>   <r><s n="n"/><s n="m"/><s n="pl"/><s n="def"/></r></p><par n="cp-R"/></e>
  <e>       <p><l>ar</l>    <r><s n="n"/><s n="m"/><s n="pl"/><s n="ind"/></r></p><par n="cp-R"/></e>
  <e>       <p><l>en</l>    <r><s n="n"/><s n="m"/><s n="sg"/><s n="def"/></r></p><par n="cp-R"/></e>
  <e>       <p><l></l>      <r><s n="n"/><s n="m"/><s n="sg"/><s n="ind"/></r></p><par n="cp-both\Ø_LR_s"/></e>
</pardef>
<pardef n="ep_no-cp__n">
  <e>       <p><l>ane</l>   <r><s n="n"/><s n="m"/><s n="pl"/><s n="def"/></r></p></e>
  <e>       <p><l>ar</l>    <r><s n="n"/><s n="m"/><s n="pl"/><s n="ind"/></r></p></e>
  <e>       <p><l>en</l>    <r><s n="n"/><s n="m"/><s n="sg"/><s n="def"/></r></p></e>
  <e>       <p><l></l>      <r><s n="n"/><s n="m"/><s n="sg"/><s n="ind"/></r></p><par n="no-cp\Ø"/></e>
</pardef>

(where cp-R adds compound-R, cp-both\Ø_LR_s adds compound-only-L with no epenthetic, LR with s epenthetic, and compound-R)

[edit] Further reading

Personal tools