Solving a Romantic Problem: Portmanteau’ed Prepositions
The problem:
In many [[romance languages]], prepositions and articles often form [[portmanteau | portmanteau morphs]], combining to form a single word.1 Some examples include (French) à + le > au, de + le > du, (Catalan) a + el > al, de + les > dels, per + el > pel. Italian has a particularly productive system of portmanteau’ed prepositions and articles… I refer you to the [[Contraction (grammar)#Italian | contraction]] article on Wikipedia. |
As I noted a couple weeks ago, however, some combinations do not form portmanteaus.2
French:
- à + le > au
- à + la > à la
The problem with this is that if we use both à and au as delimiters, we may end up passing the definite article to the verb as part of the argument in some cases, but not in other cases.
- “à la table” = “to the table”
- “au chat” = “to the cat”
The solution:
The solution is a new step in the Parser 2 process which normalizes the form of arguments. Each language’s parser can now optionally define a normalizeArgument()
method which takes an argument and returns a list of normalized alternates. Normalized arguments are returned in the form of {prefix: '', newInput: '', suffix: ''}
. For example, if you feed “la table” to the French normalizeArgument()
, it ought to return
[{prefix: 'la ', newInput: 'table', suffix: ''}]
If there are no possible normalizations, normalizeArgument()
should simply return []
. Each alternative returned by normalizeArgument()
is substituted into a copy of the possible parses just before nountype detection. The prefixes and suffixes are stored in the argument (as inactivePrefix
and inactiveSuffix
) so they can be incorporated into the suggestion display.
Here, for example, is how the inactive prefix “l’” is displayed in the parser demo. This way the user is told that the “l’” prefix is being ignored, and the nountype detection and verb action can act on the argument “English”.3 (In the future, of course, we could teach this nountype to accept the Catalan “anglès”.)
The easiest way to produce this output is to use the String.match()
method. For example normalizeArgument()
code, I refer you to the Catalan and French parser files.
I hope that this solution will help make Ubiquity with Parser 2 feel more natural for many romance languages.
-
Thanks to Jeremy O’Brien for helping me figure out how to refer to this phenomenon. ↩
-
This also relates to the issue of parsing multi-word delimiters, though the argument normalization strategy covered here should reduce the necessity of multi-word delimiters. ↩
-
Thank you to contributor Toni Hermoso Pulido for our first attempt at a Catalan parser! ↩