Difference between revisions of "Compounds"

From Apertium
Jump to navigation Jump to search
 
(29 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{TOCD}}
 
{{TOCD}}
Some languages in Indo-European, particularly Germanic languages and Proto-Indo-Iranian languages like [http://wiki.apertium.org/wiki/Sanskrit 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).
+
Some languages in Indo-European, particularly [[Germanic language]]s and Proto-Indo-Iranian languages like [http://wiki.apertium.org/wiki/Sanskrit 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")
+
* [[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)
+
* [[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")
+
* [[German]]: Kontaktlinsenverträglichkeitstest, Kontakt+linsen+verträglichkeits+test ("contact-lens compatibility test")
* Danish: Kontaktlinsevæske, Kontaktlinse+væske ("contact-lens liquid")
+
* [[Danish]]: Kontaktlinsevæske, Kontaktlinse+væske ("contact-lens liquid")
* Sanskrit: विद्या + आतुर = विद्यातुर , vidyā + ātur = vidyātur ("eager to gain knowledge")
+
* [[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),
+
* [[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),
   
   
There should be some method of attempting to resolve unknown compound words into their constituent parts.
+
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.
   
See also [http://bugs.apertium.org/cgi-bin/bugzilla/show_bug.cgi?id=13 the bug report]
 
   
 
==Differences in left-parts and right-parts of compounds==
 
==Differences in left-parts and right-parts of compounds==
Line 20: Line 19:
 
* NOT: *mobilartelefon ("cells phone")
 
* NOT: *mobilartelefon ("cells phone")
   
The way this is solved in the current compound implementation in [[lttoolbox-java]] is to have one symbol for word forms that may be a non-final part of a compund, <code>compound-only-L</code>, and one for forms that may end a compound, <code>compound-R</code>:
+
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, <code>compound-only-L</code>, and one for forms that may end a compound, <code>compound-R</code>:
   
 
<pre>
 
<pre>
Line 37: Line 36:
 
The "only" in here <code>compound-only-L</code> means that this form may '''only''' appear as part of a compound, not alone. The reason for this is explained [[Compounds#Epenthetics|below]].
 
The "only" in here <code>compound-only-L</code> means that this form may '''only''' appear as part of a compound, not alone. The reason for this is explained [[Compounds#Epenthetics|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.
+
Note: the compound symbols do '''not''' appear in the output, they only signal to lt-proc that this form may appear in compounds.
  +
  +
==Limitations of lttoolbox compounding==
  +
  +
The lttoolbox method is to first try analyzing a token without compounding, and only do compounding if the other methods would give an unknown word. Unknown words are made up of strings of characters from &lt;alphabet&gt;, separated by non-alphabetics or inconditional analyses.
  +
  +
So if the dictionary contains
  +
<pre>
  +
<alphabet>abcdefghijklmnopqrstuvwxyz01-</alphabet>
  +
  +
<section id="main" type="standard">
  +
<e> <p><l>oste</l> <r>ost<s n="n"/><s n="m"/><s n="sg"/><s n="ind"/><s n="compound-only-L"/></r></p></e>
  +
<e> <p><l>kaker</l> <r>kake<s n="n"/><s n="m"/><s n="pl"/><s n="ind"/><s n="compound-R"/></r></p></e>
  +
<e> <p><l>100-</l> <r>100<s n="det"/><s n="compound-only-L"/></r></p></e>
  +
<e> <p><l>200-</l> <r>200<s n="det"/><s n="compound-only-L"/></r></p></e>
  +
</section>
  +
</pre>
  +
Then you'll get compound analyses of "ostekake" and "100-kake" but not "200-kake" ("2" is missing from alphabet).
  +
  +
But if you have an inconditional analysis of numbers and dashes like
  +
<pre>
  +
<section id="main" type="inconditional">
  +
<e> <re>[0-9]+</re><p><l></l> <r><s n="det"/><s n="qnt"/><s n="pl"/></r></p></e>
  +
<e> <p><l>-</l> <r>-<s n="guio"/></r></p></e>
  +
</section>
  +
</pre>
  +
then you won't even get "100-kake", it'll become <pre>^100<det>$^-<guio>$^kake<n>$</pre>
   
 
==Epenthetics==
 
==Epenthetics==
Many compounds have ([http://en.wikipedia.org/wiki/Epenthetic epenthetics]), letters which connect the two words but perhaps only occur in compounds:
+
Many compounds have [http://en.wikipedia.org/wiki/Epenthetic epenthetics], letters which connect the two words but perhaps only occur in compounds:
 
* ''kransekake'' => ''krans+e+kake'' ≈ 'ring cake'
 
* ''kransekake'' => ''krans+e+kake'' ≈ 'ring cake'
 
* ''ungdomsfyll'' => ''ungdom+s+fyll'' = 'youth drunkenness'
 
* ''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"[http://linguisticmystic.com/2011/04/09/phonology-is-a-lot-like-high-school-really/].)
We solve the analysis in [[lttoolbox-java]] by the following type of paradigm:
 
  +
  +
===Epenthetic analysis===
  +
We solve the analysis in [[lttoolbox]] and [[lttoolbox-java]] by the following type of paradigm:
 
<pre>
 
<pre>
 
<pardef n="krans__n">
 
<pardef n="krans__n">
Line 69: Line 97:
   
 
===Epenthetic generation===
 
===Epenthetic generation===
When generating a compound, apertium-nn-nb simply adds the tag <code><cmp></code> to the left-part. The generator can then tell whether the left-part should have an epenthetic or not. After transfer we might have <code>^krans<n><m><sg><ind><cmp>$^kake<n><f><sg><ind>$</code>. Then the generator just needs a pardef for <code>krans</code> that has the line
+
When generating a compound, [[apertium-nn-nb]] at least simply adds the tag <code><cmp></code> 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 <code>^krans<n><m><sg><ind><cmp>$^kake<n><f><sg><ind>$</code>. Then the generator just needs a pardef for <code>krans</code> that has the line
 
<pre>
 
<pre>
 
<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>
 
<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>
Line 75: Line 105:
 
in order to output the correct <code>kransekake</code> (epenthetic e).
 
in order to output the correct <code>kransekake</code> (epenthetic e).
   
If the output from transfer was <code>^bløt<n><m><sg><ind><cmp>$^krans<n><f><sg><ind>$</code>, and the generator had
+
If the output from transfer is <code>^gulrot<n><m><sg><ind><cmp>$^kake<n><f><sg><ind>$</code> ("carrot cake"), and the generator has
 
<pre>
 
<pre>
 
<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>
 
<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>
 
</pre>
 
</pre>
in the pardef for <code>bløt</code>, we would get the correct <code>bløtkake</code> (no epenthetic).
+
in the pardef for <code>gulrot</code>, we get the correct <code>gulrotkake</code> (no epenthetic).
   
 
===Meaning of epenthetics===
 
===Meaning of epenthetics===
Line 89: Line 119:
 
(''gjestfri'' would typically be listed in the dictionary, ''gjest'''e'''fri'' being compositional.)
 
(''gjestfri'' would typically be listed in the dictionary, ''gjest'''e'''fri'' being compositional.)
   
  +
An epenthetic can also determine the meaning of an already ambiguous word-part:
==Outstanding questions==
 
  +
* ''tredørsvarianten'' = 'the three-door model'
  +
* ''tredørvarianten'' = 'the type of the wooden door'
   
  +
Solution: add these to your dictionaries :-)
* Where would compound processing go in the pipeline? Presumably after initial analysis? e.g. in between <code>lt-proc</code> and <code>apertium-tagger</code>.
 
   
  +
==Outstanding questions==
==Proposed algorithms==
 
  +
===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)
===Analysis===
 
 
;Baseline
 
   
  +
: 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-mult|def-mults]]?
input: ^*infrastruktuurontwikkelingsplan$
 
   
  +
===Dix format===
# Read word from left to right.
 
  +
Currently we use
# Take the shortest match first from the dictionaries, e.g. infrastruktuurontwikkelingsplan,
 
  +
<pre>
## Read i-n-f-r-a-s-t-r-u-k-u-u-r (add, because no words have +o)
 
  +
<s n="compound-only-L"/>
## Read o-n-t-w-i-k-k-e-l-i-n-g-s (add, because no words have +p)
 
  +
<s n="compound-R"/>
## Read p-l-a-n
 
  +
</pre>
# Output in order.
 
  +
this could be changed to
 
output: ^infrastruktuur<n><sg>$ ^ontwikkeling<n><pl>$ ^plan<n><sg>$
 
 
 
: This won't work for Esperanto and other languages where the root without word ending is never seen (correct in Esperanto is infrastruktur+evolu+plano, not infrastrukturo+evoluo+plano)
 
:: This means these entries have to be in the dictionaries, we could treat it the same way as epenthetics. Say that we have a marker on (or inside) <code><e></code> that says that this is <code><e></code> may be the left side of a compound. Then for Esperanto, you'd have to add, to your pardef or whatever:
 
 
<pre>
 
<pre>
  +
<c r="L"/>
<e (left-compoundable)> <p><l>evolu</l> <r>evoluo</r></p></e>
 
  +
<c r="R"/>
<e (non-compoundable, regular entry)><p><l>evoluo</l><r>evoluo</r></p></e>
 
 
</pre>
 
</pre>
   
  +
: 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 [http://apertium.codepad.org/yZnlY6M8 easily done with a pardef]
   
  +
: Changes to dix format should be coordinated with [[Unification of metadix and parametrized dictionaries|unifying the metadix format]]
   
  +
===German/Capitalised compounds vs (proper noun) regexes===
;Left-to-right longest-match
 
  +
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.
   
  +
==When to compound==
input: ^*infrastruktuurontwikkelingsplan$
 
   
  +
You shouldn't allow compounding on all words. In particular, if you allow compounding on all short words, you will get horrible results:
# Read word from left to right.
 
  +
<pre>$ echo bildreportagen |apertium -d . swe-dan
# Take the longest match first from the dictionaries, e.g. infrastruktuurontwikkelingsplan,
 
  +
billede #rids mugmide tagene</pre>
# While not found:
 
## Read infrastruktuurontwikkelingsplan
 
## Read infrastruktuurontwikkelingspla
 
## Read infrastruktuurontwikkelingspl
 
## ...
 
# When a word is found, e.g. "infrastruktuur", remove it from the string, put it in the output queue, and start the process again with ontwikkelingsplan.
 
# Output each item from the output queue in order.
 
   
  +
In Scandinavian dixen, it's common to have two versions of pardefs, one with and one without compounding:
output: ^infrastruktuur<n><sg>$ ^ontwikkeling<n><pl>$ ^plan<n><sg>$
 
  +
<pre>
 
  +
<pardef n="ep__n">
===Generation===
 
  +
<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>
If we have translated a string of input words from English to Afrikaans and now want to compound the ones that can be compounded, we have a problem that instead of:
 
  +
<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>
:infrastruktuurontwikkelingsplan
 
  +
</pardef>
 
  +
<pardef n="ep_no-cp__n">
we have:
 
  +
<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>
:infrastruktuur ontwikkeling plan
 
  +
<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>
One way of resolving this would be to compile a wordlist (without morphological info) into a tree, and then scan the tree as we scan the output, concatenating words where they appear in the wordlist. Wordlists are substantially more numerous than morphological resources so it would be quite cheap. In order to avoid false-positives, we could just set a length requirement of something like 9 characters or more.
 
  +
</pardef>
  +
</pre>
  +
(where cp-R adds compound-R, cp-both\Ø_LR_s adds compound-only-L with no epenthetic, LR with s epenthetic, and compound-R)
   
 
==Further reading==
 
==Further reading==
Line 157: Line 182:
   
 
[[Category:Development]]
 
[[Category:Development]]
  +
[[Category:Documentation in English]]

Latest revision as of 09:29, 15 February 2019

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.


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

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 that this form may appear in compounds.

Limitations of lttoolbox compounding[edit]

The lttoolbox method is to first try analyzing a token without compounding, and only do compounding if the other methods would give an unknown word. Unknown words are made up of strings of characters from <alphabet>, separated by non-alphabetics or inconditional analyses.

So if the dictionary contains

<alphabet>abcdefghijklmnopqrstuvwxyz01-</alphabet>
…
<section id="main" type="standard">
  <e>       <p><l>oste</l>      <r>ost<s n="n"/><s n="m"/><s n="sg"/><s n="ind"/><s n="compound-only-L"/></r></p></e>
  <e>       <p><l>kaker</l>      <r>kake<s n="n"/><s n="m"/><s n="pl"/><s n="ind"/><s n="compound-R"/></r></p></e>
  <e>       <p><l>100-</l>      <r>100<s n="det"/><s n="compound-only-L"/></r></p></e>
  <e>       <p><l>200-</l>      <r>200<s n="det"/><s n="compound-only-L"/></r></p></e>
</section>

Then you'll get compound analyses of "ostekake" and "100-kake" but not "200-kake" ("2" is missing from alphabet).

But if you have an inconditional analysis of numbers and dashes like

<section id="main" type="inconditional">
  <e>       <re>[0-9]+</re><p><l></l>      <r><s n="det"/><s n="qnt"/><s n="pl"/></r></p></e>
  <e>       <p><l>-</l>      <r>-<s n="guio"/></r></p></e>
</section>

then you won't even get "100-kake", it'll become

^100<det>$^-<guio>$^kake<n>$

Epenthetics[edit]

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].)

Epenthetic analysis[edit]

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.

Epenthetic generation[edit]

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).

Meaning of epenthetics[edit]

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 :-)

Outstanding questions[edit]

Stream symbol[edit]

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?

Dix format[edit]

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

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

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.

When to compound[edit]

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)

Further reading[edit]