                return result;
            }

            // From right to left to do the longest matching to get the word segmentation
            function rightToLeftSegmentation(text, dictionary) {
                var result = [];
                while (text.length > 0) {
                    let subText = "";
                    // If the length of the text is less than the maxLength, then the subText is the text itself
                    if (text.length < maxLength) {
                        subText = 