gpt4 book ai didi

javascript - 在 Javascript 中检查某个字符是否是任何书面语言中的元音的最佳方法

转载 作者:行者123 更新时间:2023-12-03 12:43:55 24 4
gpt4 key购买 nike

我检查了其他答案,它们只针对元音“aeiouy”,是否可以轻松检查任何和所有元音 - 也包括其他字母,例如“ü”德语中的元音?

var easy = 'a';
var hard = 'ü';
var etc = 'ö';
var andSoOn = 'あ';

如果只是创建一个循环并检查它的问题,就像这个问题的选定答案 How do I check for vowels in JavaScript?有可用的已知元音列表吗?

最佳答案

is there an easy of checking for any and all vowels?

is there a known list of possible vowels?

如果你想准确的话就不用了。看看the definition of a written vowel在维基百科中:

In writing systems based on the Latin alphabet, the letters A, E, I, O, U, and sometimes Y are all used to represent vowels. However, not all of these letters represent vowels in all languages, or even consistently within one language (some of them, especially W and Y, are also used to represent approximants). Moreover, a vowel might be represented by a letter usually reserved for consonants, or a combination of letters, particularly where one letter represents several sounds at once, or vice versa; examples from English include igh in "thigh" and x in "x-ray". In addition, extensions of the Latin alphabet have such independent vowel letters as Ä, Ö, Ü, Å, Æ, and Ø.

...

Other languages cope with the limitation in the number of Latin vowel letters in similar ways. Many languages make extensive use of combinations of letters to represent various sounds. Other languages use vowel letters with modifications, such as Ä in Scandinavian and Nordic languages, or add diacritical marks, like umlauts, to vowels to represent the variety of possible vowel sounds. Some languages have also constructed additional vowel letters by modifying the standard Latin vowels in other ways, such as æ or ø that are found in some of the Scandinavian languages.

...

The alphabets used to write the Semitic languages, such as the Hebrew alphabet and the Arabic alphabet, do not ordinarily mark all the vowels, since they are frequently unnecessary in identifying a word.

总之,您需要首先识别语言,然后需要该语言中元音的一组规则,然后需要规则的异常(exception)列表。

关于javascript - 在 Javascript 中检查某个字符是否是任何书面语言中的元音的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23410228/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com