We recently received the following question from a user and wanted to share our answer with the rest of the ClauseBase Community:
Is there a possibility to automatically insert the correct version of the undefined article (“a” or “an”) in English, if that word is not known in advance?
ClauseBase’s regular conjugation mechanism automatically switches “a” to “an” depending on the defined term (conceptlabel) that follows it. For example, if you have a concept (defined term) “contract”, then the output of “#-contract” would be “a contract” or “an agreement”, depending on the conceptlabel that was chosen.
However, in your case I suspect that this conjugation mechanism will not be useful, because you want the “a”/”an” to switch depending on the content of some text-based datafield that gets filled in by the end-user. For such situations, However, you can use a special function called @a-or-an.
For example, if you use
.... @a-or-an(#issuer^company-domicile) company ...
then the contents of the datafield #issuer^company-domicile will be preceded by “a” or “an”, depending on the content. E.g., if the end-user would happen to have entered “Illinois”, then the output would be “an Illinois company”, while if he/she would have entered “New York” it would be “a New York company”. The algorithm is actually quite clever and accounts for many different exceptions.