2
2 Comments

Dictated text now inserts with correct surrounding spacing

Let's imaging you have some text in the dictate-button powered text filed already, for example "I have some text" and you put cursor after "text". If you'd run dictation, the transcription would be put right after "text" without separation "I have some textdictated".

Good news is from now on the default integration scripts intelligently determine the need for blank spaces around the transcription, so your final text now would be "I have some text dictated".

Try demo to see how better the insertion is now https://dictate-button.io/

And the updated docs are here https://www.npmjs.com/package/dictate-button

posted toAvatar for product Dictate Button
Dictate Button
  1. 2

    Nice improvement. Does the spacing logic also handle punctuation and sentence case, for example inserting after a comma or at the start of a sentence? How does it behave with selected text and with languages that have different spacing rules? Is this check in the client library or available through an API as well?

    1. 1

      Thanks! Those are great question.

      Current version of the frontend code handles start and end of the string. It treats punctuation signs as any other non-whitespace symbols. It doesn't take into account languages with other spacing rules. Could you provide an example of such a language?

      The selection is replaced with the transcription.

      The API takes care of the transcription itself, and the integration including insertion rules are implemented through frontend (dictate-button web component and two inject scripts).

      If curious to see the insertion code, check out one of the inject scripts https://github.com/kkomelin/dictate-button/blob/main/src/inject-exclusive.js#L86