C-Nedelcu / talk-to-chatgpt

Talk to ChatGPT AI using your voice and listen to its answers through a voice
GNU Affero General Public License v3.0
1.96k stars 335 forks source link

Fix sentence breaking issue #153

Closed decfrr closed 11 months ago

decfrr commented 12 months ago

What

This PR solves #118 and the problem of extra sentence breaks for words like i.e. in the relevant function.

Preview

Several cases were tested.

Before

console.log(CN_SplitIntoSentences("The expenses came up to 1,550,309.56 TRY."));
/*
[
    "The expenses came up to 1,",
    "550,",
    "309.",
    "56 TRY."
]
*/

console.log(CN_SplitIntoSentences("Harcamalar 1.550.309,56 TL tuttu.");
/*
[
    "Harcamalar 1.",
    "550.",
    "309,",
    "56 TL tuttu."
]
*/

console.log(CN_SplitIntoSentences("The amount, i.e., 1,234,567.89, is significant.");
/*
[
    "The amount,",
    "i.",
    "e.",
    ",",
    "1,",
    "234,",
    "567.",
    "89,",
    "is significant."
]
*/

After

console.log(CN_SplitIntoSentences("The expenses came up to 1,550,309.56 TRY."));
/*
[
    "The expenses came up to 1,550,309.56 TRY."
]
*/ 

console.log(CN_SplitIntoSentences("Harcamalar 1.550.309,56 TL tuttu.");
/*
[
    "Harcamalar 1.550.309,56 TL tuttu."
]
*/

console.log(CN_SplitIntoSentences("The amount, i.e., 1,234,567.89, is significant.");
/*
[
    "The amount,",
    "i.e,",
    "1,234,567.89,",
    "is significant."
]
*/
decfrr commented 12 months ago

In addition to the ones mentioned above, I tried several other test cases. Those cases are as follows.

const testCases = [
    "The expenses came up to 1,550,309.56 TRY.",
    "Harcamalar 1.550.309,56 TL tuttu.",
    "he expenses came up to 1,550,309.56 TRY, however, I'm so happy to hear that.",
    "代金は1,550,309.56 TRYにまでのぼった。しかし、私はそれを聞いてハッピーだった。",
    "The expenses came up to 1,550,309.56, however, I'm so happy to hear that.",
    "1,234.56, however, is a magical number.",
    "The amount, i.e., 1,234,567.89, is significant.",
    "Is 1,234.5678 or 1,234,567.89 bigger?",
    "Harcamalar 1.550.309,56 TL tuttu.",
    "Miktar, yani 1,234,567.89, önemlidir.",
    "1,234.5678 mi yoksa 1,234,567.89 mu daha büyük?",
    "Karmaşık bir durum: 1,234.5678 mi yoksa 1,234,567.89 mu?",
    "Not al; 1,234,567.89 büyük bir numaradır."
];
decfrr commented 12 months ago

Hello, please excuse the mentions. @C-Nedelcu I would be happy to know if you could tell me what I am missing as far as formatting in this pull request. Thank you.

C-Nedelcu commented 12 months ago

Hello, please excuse the mentions. @C-Nedelcu I would be happy to know if you could tell me what I am missing as far as formatting in this pull request. Thank you.

hi, you aren't missing anything, it's great! it's just that I haven't had the time to dedicate to doing further testing at the moment. I am 99% sure it will be fine, but I always take it upon myself to test any changes before I submit the extension update to the Chrome/Edge stores.

As I have an extremely busy work schedule and this is on my free time, I usually do this on weekends. Sadly last weekend I was sick.

I welcome any pull requests with open arms, so if you want to make others please be my guest :)

decfrr commented 12 months ago

I'm sorry for the unnecessary notifications, and please take good care of yourself. I respect the work you put into this during your spare time. Your health comes first, so please rest and recuperate. 🙏

C-Nedelcu commented 11 months ago

Hello,

I'm sorry but after a couple of very simple tests, it seems like your changes have drastically broken the text to speech functionality.

Before (correct)

correct1

After your changes (erroneous)

error1

error2

Tested in both English and French.

Hence I have no other choice but to reject your pull request. If you can work it out feel free to try again, I will happily make further tests!

decfrr commented 11 months ago

Thanks for taking the time out of your busy schedule to review this. I will check it out on my end and try to improve it.