.NET中是否有任何庫處理確定名詞的Indefinite Article?圖書館確定名詞的不定冠詞?
我的粗略嘗試是低於,這可能會用於我的使用(這是可以接受的)的99%,只是想知道是否有任何確定的替代品?
public static string GetIndefinateArticle(string noun)
{
if(string.IsNullOrEmpty(noun))
return noun;
var first = noun[0];
if(first == 'a' ||
first == 'e' ||
first == 'i' ||
first == 'o')
return "an " + noun;
return "a " + noun;
}
更新:埃蒙指出重複問題的意見:How can I correctly prefix a word with "a" and "an"?我會在這裏和開放的離開這個問答不過,因爲我還沒有真正有一個答案。
根據語法女孩,使用不定冠詞是基於名詞的聲音,值得在這裏注意,我想。 http://grammar.quickanddirtytips.com/ – 2010-04-06 13:23:01
是的,我意識到這一點,但確定從ascii的聲音是相當困難的!因此,想知道是否有任何庫大概檢查基於它們的聲音分組的常用起始字母組合? – 2010-04-06 13:24:52
你應該切換「a」和「an」。 – lugte098 2010-04-06 13:34:45