diff --git a/src/util/parseCantoneseReadings.js b/src/util/parseCantoneseReadings.js new file mode 100644 index 0000000..77cb070 --- /dev/null +++ b/src/util/parseCantoneseReadings.js @@ -0,0 +1,12 @@ +/** + * Parses a text string into an array matching each character to the readings + * @example "你get唔get到我講咩? (nei5 get1 m4 get1 dou2 ngo5 gong2 me1?)" => [{text: "你", reading: "nei5"}, {text: "get", reading: "get1"}, ...] + * @param {string} text + * @returns {{text: string, reading: string}[]} + */ +function parseCantoneseReadings(text) { + // TODO + return []; +} + +export { parseCantoneseReadings }; diff --git a/src/util/parseTextToSC.js b/src/util/parseTextToSC.js new file mode 100644 index 0000000..7248ea5 --- /dev/null +++ b/src/util/parseTextToSC.js @@ -0,0 +1,28 @@ +/** + * Parses a text string into a structured content object. + * @param {string} text + * @returns {import("yomichan-dict-builder/dist/types/yomitan/termbank").StructuredContent} + */ +function convertTextToSC(text, language) { + if (language !== 'yue') { + return text; + } + // /** + // * @type {import("yomichan-dict-builder/dist/types/yomitan/termbank").StructuredContent} + // */ + // const sc = { + + // }; + // return sc; + return ''; +} + +/** + * Parses a text string into a structured content object. + * @param {string} text + * @returns {import("yomichan-dict-builder/dist/types/yomitan/termbank").StructuredContent} + */ +function convertCantoneseStringToSC(text) { + // TODO + return ''; +} \ No newline at end of file