Jump to content
Sign in to follow this  
Limbic_Response

Custom Function for an article A or An

Recommended Posts

As part of a much larger text calculation (in the style of a merge letter style solution) , I am trying to create a custom function that will substitute a tag/placeholder such as <<a or an>> with either "a" or "an" in the final calculation, which I think will need to based on a pre-defined list of words that would require one or the other.  From a grammar perspective, the use of the articles "a" or "an" is irregular, as it is based on if the subsequent word (most of the time at least) has a vowel sound (e.g., both "university" and "undone" start with the letter "u", but each requires a different article because one has a vowel sound when said aloud and the other doesn't.  So, I would expect to have to supply 2 lists of words within the custom function that (which I would update regularly), unless someone happens to know another way to do this.

Given a text calculation that might read something like: "The client's reading performance was found to be at <<a or an>> eighth grade level, while his math calculation skills were found to be at <<a or an>> first grade level. "  The first placeholder would be "an" and the second would be "a".  

Thank you.

 

Share this post


Link to post
Share on other sites

I think you are looking at this the wrong way. In your example it makes no sense to substitute only <<a or an>> as they would never change based on the text. The substitution would always be the same. So, for your example to make sense, the words following <<a or an>> (ie, eight and fifth) would also have to be substituted. In which case it makes much more sense to do something like this:

"The client's reading performance was found to be at <<subst1>> grade level, while his math calculation skills were found to be at <<subst2>> first grade level. "

And substitute <<subst1>> with "an eight" and <<subst2>> with "a fifth". Whilst you are substituting you could check whether the word starts with a vowel or not and include "a " or "an " depending on whatever rule you define.

Share this post


Link to post
Share on other sites

OlgerDiekstra,

You raise a good point, but this is just one part of a much larger calculation that does already have <<subst1>>  and <<subst2>>, which is determined by test scores and different descriptive terms that the end user decides.  So the reality is that the same sentence looked something like this originally: <<First Name>> <<Last Name>>'s reading performance was found to be at <<a or an>> <<subst1>>, while <<his or her>> math calculation skills were found to be at <<subst2>>.  

Since the end user can define what labels are being used for <<subst1>>, <<a or an>> cannot be calculated until the other text calculations have been completed first.  

Edited by Limbic_Response

Share this post


Link to post
Share on other sites

You're making it more difficult than it needs to be. When you substitute <<subst1>> or <<subst2>> in your sentence:

"<<First Name>> <<Last Name>>'s reading performance was found to be at <<a or an>> <<subst1>>, while <<his or her>> math calculation skills were found to be at <<subst2>> "

you can determine <<a or an>> when you substitute. In which case you don't have <<a or an>> in your text, just <<subst1>>. So your user selects "eight" from a dropdown list, and right before you substitute in your CF you determine whether eight requires "a" or "an". The text then becomes:

"<<First Name>> <<Last Name>>'s reading performance was found to be at <<subst1>>, while <<his or her>> math calculation skills were found to be at <<subst2>> "

Something like: Substitute( $text; "<<subst1>>"; If( left( $term; 1 ) = "e"; "an "; "a " ) & $term )

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.