Skip to content

Commit

Permalink
Add base functions for text conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Jan 20, 2024
1 parent 8fd6842 commit 518dcfd
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/util/parseCantoneseReadings.js
Original file line number Diff line number Diff line change
@@ -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 };
28 changes: 28 additions & 0 deletions src/util/parseTextToSC.js
Original file line number Diff line number Diff line change
@@ -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 '';
}

0 comments on commit 518dcfd

Please sign in to comment.