                     const rightToLeftSingle = rightToLeft.filter(word => word.length === 1).length;
                        if (leftToRightSingle < rightToLeftSingle) {
                            return leftToRight;
                        } else {
                            return rightToLeft;
                        }
                    }
                }
            }

            // Remove punctuation from the reference text
            referenceText = referenceText.split("").filter(char => /[\p{L}