Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 318409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:34:00+00:00 2026-05-12T08:34:00+00:00

I have a .NET application where, given a noun, I want it to correctly

  • 0

I have a .NET application where, given a noun, I want it to correctly prefix that word with “a” or “an”. How would I do that?

Before you think the answer is to simply check if the first letter is a vowel, consider phrases like:

  • an honest mistake
  • a used car
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:34:01+00:00Added an answer on May 12, 2026 at 8:34 am
    1. Download Wikipedia
    2. Unzip it and write a quick filter program that spits out only article text (the download is generally in XML format, along with non-article metadata too).
    3. Find all instances of a(n)…. and make an index on the following word and all of its prefixes (you can use a simple suffixtrie for this). This should be case sensitive, and you’ll need a maximum word-length – 15 letters?
    4. (optional) Discard all those prefixes which occur less than 5 times or where "a" vs. "an" achieves less than 2/3 majority (or some other threshholds – tweak here). Preferably keep the empty prefix to avoid corner-cases.
    5. You can optimize your prefix database by discarding all those prefixes whose parent shares the same "a" or "an" annotation.
    6. When determining whether to use "A" or "AN" find the longest matching prefix, and follow its lead. If you didn’t discard the empty prefix in step 4, then there will always be a matching prefix (namely the empty prefix), otherwise you may need a special case for a completely-non matching string (such input should be very rare).

    You probably can’t get much better than this – and it’ll certainly beat most rule-based systems.

    Edit: I’ve implemented this in JS/C#. You can try it in your browser, or download the small, reusable javascript implementation it uses. The .NET implementation is package AvsAn on nuget. The implementations are trivial, so it should be easy to port to any other language if necessary.

    Turns out the "rules" are quite a bit more complex than I thought:

    • it’s an unanticipated result but it’s a unanimous vote
    • it’s an honest decision but a honeysuckle shrub
    • Symbols: It’s an 0800 number, or an ∞ of oregano.
    • Acronyms: It’s a NASA scientist, but an NSA analyst; a FIAT car but an FAA policy.

    …which just goes to underline that a rule based system would be tricky to build!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET application that I want to use as a client to
I have a .net video processing application, that, when given a large streaming image
I have a .NET application that is meant to be run on a local
I have a .NET application that processes around 300,000 records in a batch import,
We have a .net application that we didn't develop, but use. I can tell
I have a .NET application that contains a checkbox (System.Windows.Forms.Checkbox). This component (WindowsForms10.BUTTON.app.0.378734a1) is
I have a .NET application running on windows. I want clicking on some page
I have a .Net application that dynamically creates a small HTML page and pops
I have a .NET Wndows application in C#. It's a simple Windows application that
I have an ASP.NET application that renders multiple questions with the option to provide

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.