Hello, this is a modified pull request. Please forgive my frequent requests for reviews.
What
This PR tries to solve #118 .
How
As the following, when a period or comma is between numbers, temporarily convert it to a placeholder and back to the end.
text = text.replace(/(\d),(\d)/g, '$1†$2');
text = text.replace(/(\d)\.(\d)/g, '$1‡$2');
However, I am considering the case where the sentence being input to this function is in the middle of a sentence. This phenomenon is inevitable because sentences are usually entered into CN_SplitIntoSentences even in the process of generation.
When this phenomenon occurs, problems arise. For example, if the sentence "The expences came up 1,500,500" was entered up to "The expences came up 1,500," if the sentence was separated there, the ",500" would be lost.
”Lost" means as in the following image
This problem occurs because "a period/comma at the end of a sentence is not considered part of the number" and occurs when a complete sentence is entered later.
Therefore, a function has been added to prevent this from happening. On the other hand, if "The expences came up 1,500, however" is entered in this case, there is a side-effect that the delimiter is not placed before "however".
But, we can now handle commas and periods correctly. (except in the case of i.e., ... )
Hello, this is a modified pull request. Please forgive my frequent requests for reviews.
What
This PR tries to solve #118 .
How
As the following, when a period or comma is between numbers, temporarily convert it to a placeholder and back to the end.
However, I am considering the case where the sentence being input to this function is in the middle of a sentence. This phenomenon is inevitable because sentences are usually entered into
CN_SplitIntoSentences
even in the process of generation.When this phenomenon occurs, problems arise. For example, if the sentence "The expences came up 1,500,500" was entered up to "The expences came up 1,500," if the sentence was separated there, the ",500" would be lost.
”Lost" means as in the following image
This problem occurs because "a period/comma at the end of a sentence is not considered part of the number" and occurs when a complete sentence is entered later.
Therefore, a function has been added to prevent this from happening. On the other hand, if "The expences came up 1,500, however" is entered in this case, there is a side-effect that the delimiter is not placed before "however".
But, we can now handle commas and periods correctly. (except in the case of i.e., ... )