Syllables pronunciation extension or service needed

This might give you some ideas....

it doesn't have to be about Google Sheets or SQLite, the processes are similar for most requirements....

1 Like

With javascript and AppInventor it can be done quite easily.
Just use a regez inside a script.

blocks (56)

Syllables_Divide.aia (2.1 KB)

The power of Javascript

4 Likes

Hmmm, not working here in companion?

I tested in companion on Android 11 and Android 10 works fine

Image Is screenshot of companion

Works OK (companion) on real device, Android 12, but not on my genymotion Android 10. Don't know why, javascript usually runs OK, I'll keep digging...

[EDIT] Doesn't work with customWebView either, so there must be a glitch in the emulator somewhere for regex.

[EDIT 2] Fixed it :wink: It wasn't the regex, but the .replaceAll javascript function:
image
replaced it (excuse the pun) with
image
and it works :slight_smile:
image

1 Like

@Kevinkun

Is it possible to apply the regex to your regex extension, so one could build a procedure using just blocks?

const syllableRegex = /[^aeiouy]*[aeiouy]+(?:[^aeiouy]*$|[^aeiouy](?=[^aeiouy]))?/gi;

You are right.
Android webview doesn't support not standard
ECMA script and replace all function Is a prototype function

.replaceAll works in modern browsers and in Android 10,11,12 on real devices, it just may not be backwards compatible with older devices...

In Spanish, syllabic separation is a bit more complicated, since many words have vowels with accent marks.

I have used this JavaScript code to get the Spanish syllables:
https://github.com/nicofrem/silabajs/blob/master/silabajs.js

Syllables_Divide_v2.aia (8.6 KB)

BTW, what is the hyphenation of the word ridiculous, ri-di-cu-lous or ri-dic-u-lous?

https://www.silabas.net/index-en.php?lang=%2Findex-en.php&p=ridiculous&button=Hyphenation

I would say this one (which Marco's algorithm returns)

Try rhythm or righteous:wink:

https://www.wordreference.com/definition/ridiculous

sorry I don't understand, do you want a block with this pattern? the MATCH or REPLACE function not working ?
edit: it's working:

4 Likes

I couldn't get it to work at first, but realised some editing of the regex was required:

[^aeiouy]*[aeiouy]+(?:[^aeiouy]*$|[^aeiouy](?=[^aeiouy]))?

worked for me :)

2 Likes

wo0ow thank you so much nice workaround , just doing visible false for webviewer and works perfect ,

Some more interesting results.....

ma-ry -had- a -lit-tle -lam-b it-s flee-ce -was- whi-te- as- snow
the -quic-k brow-n fox- jum-ped- o-ver- the -la-zy -dog

It ain't no better than rhy-thm :smiley:

Thanks

I tested the script with a list of 100 words with a result of 90 correct results.
however each language has its own rules (for example in Italian we have diphthongs with groups of three vowels) which make a 100% reliable algorithm impossible

The code for Spanish that I linked in #14 works fine for Spanish, the same code makes some mistakes in Italian: mo-stra, na-sco, se-gno, pe-sca, pe-sce, guèr-ra... maybe you are interested in modifying it.

I saw your code that with some corrections works well also in Italian.however each language has its exceptions which make it impossible to develop a 100% secure algorithm.without a database support.

I am not knocking it, I think for general use and 95% of situations, this is an excellent solution :+1:

3 Likes