Skip to content

Commit

Permalink
Rebuild 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
discordier committed Jun 11, 2024
1 parent 5f2a2bb commit 917016b
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 150 deletions.
32 changes: 16 additions & 16 deletions dist/guessnum.common.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This is SamJs.js v0.2.0
* This is SamJs.js v0.3.0
*
* A Javascript port of "SAM Software Automatic Mouth".
*
* (c) 2017-2022 Christian Schiffler
* (c) 2017-2024 Christian Schiffler
*
* @link(https://github.com/discordier/sam)
*
Expand All @@ -24,7 +24,7 @@ let matchesBitmask = (bits, mask) => {
/**
*
* @param {AudioContext} context
* @param audiobuffer
* @param {Float32Array} audiobuffer
*
* @return {Promise}
*/
Expand Down Expand Up @@ -215,7 +215,7 @@ let PhonemeNameTable = (' *' + // 00
* '**', 'KX', '**', '**', 'UM', 'UN'
* 0x0020 FLAG_DIP_YX but looks like front vowels
* 'IY', 'IH', 'EH', 'AE', 'AA', 'AH', 'AX', 'IX', 'EY', 'AY', 'OY'
* 0x0010 FLAG_DIPTHONG
* 0x0010 FLAG_DIPHTHONG
* 'EY', 'AY', 'OY', 'AW', 'OW', 'UW'
* 0x0008
* 'M*', 'N*', 'NX', 'DX', 'Q*', 'CH', 'J*', 'B*', '**', '**', 'D*',
Expand Down Expand Up @@ -517,7 +517,7 @@ SPECIAL
*/

/**
* Match both characters but not with wildcards.
* Match two character phoneme.
*
* @param {string} sign1
* @param {string} sign2
Expand All @@ -531,14 +531,14 @@ let full_match = (sign1, sign2) => {
return index !== -1 ? index : false;
};
/**
* Match character with wildcard.
* Match single character phoneme.
*
* @param {string} sign1
* @return {boolean|Number}
*/


let wild_match = sign1 => {
let single_match = sign1 => {
let index = PhonemeNameTable.findIndex(value => {
return value === sign1 + '*';
});
Expand All @@ -561,11 +561,11 @@ let wild_match = sign1 => {
*
* Repeat until the end is reached:
* 1. First, a search is made for a 2 character match for phonemes that do not
* end with the '*' (wildcard) character. On a match, the index of the phoneme
* end with the '*' (single char mark) character. On a match, the index of the phoneme
* is added to the result and the buffer position is advanced 2 bytes.
*
* 2. If this fails, a search is made for a 1 character match against all
* phoneme names ending with a '*' (wildcard). If this succeeds, the
* phoneme names ending with a '*' (single char mark). If this succeeds, the
* phoneme is added to result and the buffer position is advanced
* 1 byte.
*
Expand Down Expand Up @@ -611,14 +611,14 @@ let Parser1 = (input, addPhoneme, addStress) => {
let match;

if ((match = full_match(sign1, sign2)) !== false) {
// Matched both characters (no wildcards)
// Matched both characters (no single char mark)
srcPos++; // Skip the second character of the input as we've matched it

addPhoneme(match);
continue;
}

if ((match = wild_match(sign1)) !== false) {
if ((match = single_match(sign1)) !== false) {
// Matched just the first character (with second character matching '*'
addPhoneme(match);
continue;
Expand Down Expand Up @@ -671,12 +671,12 @@ let FLAG_PUNCT = 0x0100;
let FLAG_VOWEL = 0x0080;
let FLAG_CONSONANT = 0x0040;
/**
* dipthong ending with YX
* diphthong ending with YX
*
*/

let FLAG_DIP_YX = 0x0020;
let FLAG_DIPTHONG = 0x0010;
let FLAG_DIPHTHONG = 0x0010;
/** unknown:
* 'M*', 'N*', 'NX', 'DX', 'Q*', 'CH', 'J*', 'B*', '**', '**', 'D*',
* '**', '**', 'G*', '**', '**', 'GX', '**', '**', 'P*', '**', '**',
Expand Down Expand Up @@ -797,7 +797,7 @@ let Parser2 = (insertPhoneme, setPhoneme, getPhoneme, getStress) => {
continue;
}

if (phonemeHasFlag(phoneme, FLAG_DIPTHONG)) {
if (phonemeHasFlag(phoneme, FLAG_DIPHTHONG)) {
// <DIPHTHONG ENDING WITH WX> -> <DIPHTHONG ENDING WITH WX> WX
// <DIPHTHONG NOT ENDING WITH WX> -> <DIPHTHONG NOT ENDING WITH WX> YX
// Example: OIL, COW
Expand Down Expand Up @@ -933,7 +933,7 @@ let Parser2 = (insertPhoneme, setPhoneme, getPhoneme, getStress) => {
if (!phonemeHasFlag(phoneme, FLAG_DIP_YX) && phoneme !== null) {
// replace G with GX and continue processing next phoneme
{
console.log("".concat(pos, " RULE: G <VOWEL OR DIPTHONG NOT ENDING WITH IY> -> GX <VOWEL OR DIPTHONG NOT ENDING WITH IY>"));
console.log("".concat(pos, " RULE: G <VOWEL OR DIPHTHONG NOT ENDING WITH IY> -> GX <VOWEL OR DIPHTHONG NOT ENDING WITH IY>"));
}

setPhoneme(pos, 63); // 'GX'
Expand All @@ -951,7 +951,7 @@ let Parser2 = (insertPhoneme, setPhoneme, getPhoneme, getStress) => {
if (!phonemeHasFlag(Y, FLAG_DIP_YX) || Y === null) {
// VOWELS AND DIPHTHONGS ENDING WITH IY SOUND flag set?
{
console.log("".concat(pos, " K <VOWEL OR DIPTHONG NOT ENDING WITH IY> -> KX <VOWEL OR DIPTHONG NOT ENDING WITH IY>"));
console.log("".concat(pos, " K <VOWEL OR DIPHTHONG NOT ENDING WITH IY> -> KX <VOWEL OR DIPHTHONG NOT ENDING WITH IY>"));
}

setPhoneme(pos, 75);
Expand Down
4 changes: 2 additions & 2 deletions dist/guessnum.common.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/guessnum.common.min.js.map

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions dist/guessnum.esm.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This is SamJs.js v0.2.0
* This is SamJs.js v0.3.0
*
* A Javascript port of "SAM Software Automatic Mouth".
*
* (c) 2017-2022 Christian Schiffler
* (c) 2017-2024 Christian Schiffler
*
* @link(https://github.com/discordier/sam)
*
Expand All @@ -22,7 +22,7 @@ let matchesBitmask = (bits, mask) => {
/**
*
* @param {AudioContext} context
* @param audiobuffer
* @param {Float32Array} audiobuffer
*
* @return {Promise}
*/
Expand Down Expand Up @@ -213,7 +213,7 @@ let PhonemeNameTable = (' *' + // 00
* '**', 'KX', '**', '**', 'UM', 'UN'
* 0x0020 FLAG_DIP_YX but looks like front vowels
* 'IY', 'IH', 'EH', 'AE', 'AA', 'AH', 'AX', 'IX', 'EY', 'AY', 'OY'
* 0x0010 FLAG_DIPTHONG
* 0x0010 FLAG_DIPHTHONG
* 'EY', 'AY', 'OY', 'AW', 'OW', 'UW'
* 0x0008
* 'M*', 'N*', 'NX', 'DX', 'Q*', 'CH', 'J*', 'B*', '**', '**', 'D*',
Expand Down Expand Up @@ -515,7 +515,7 @@ SPECIAL
*/

/**
* Match both characters but not with wildcards.
* Match two character phoneme.
*
* @param {string} sign1
* @param {string} sign2
Expand All @@ -529,14 +529,14 @@ let full_match = (sign1, sign2) => {
return index !== -1 ? index : false;
};
/**
* Match character with wildcard.
* Match single character phoneme.
*
* @param {string} sign1
* @return {boolean|Number}
*/


let wild_match = sign1 => {
let single_match = sign1 => {
let index = PhonemeNameTable.findIndex(value => {
return value === sign1 + '*';
});
Expand All @@ -559,11 +559,11 @@ let wild_match = sign1 => {
*
* Repeat until the end is reached:
* 1. First, a search is made for a 2 character match for phonemes that do not
* end with the '*' (wildcard) character. On a match, the index of the phoneme
* end with the '*' (single char mark) character. On a match, the index of the phoneme
* is added to the result and the buffer position is advanced 2 bytes.
*
* 2. If this fails, a search is made for a 1 character match against all
* phoneme names ending with a '*' (wildcard). If this succeeds, the
* phoneme names ending with a '*' (single char mark). If this succeeds, the
* phoneme is added to result and the buffer position is advanced
* 1 byte.
*
Expand Down Expand Up @@ -609,14 +609,14 @@ let Parser1 = (input, addPhoneme, addStress) => {
let match;

if ((match = full_match(sign1, sign2)) !== false) {
// Matched both characters (no wildcards)
// Matched both characters (no single char mark)
srcPos++; // Skip the second character of the input as we've matched it

addPhoneme(match);
continue;
}

if ((match = wild_match(sign1)) !== false) {
if ((match = single_match(sign1)) !== false) {
// Matched just the first character (with second character matching '*'
addPhoneme(match);
continue;
Expand Down Expand Up @@ -669,12 +669,12 @@ let FLAG_PUNCT = 0x0100;
let FLAG_VOWEL = 0x0080;
let FLAG_CONSONANT = 0x0040;
/**
* dipthong ending with YX
* diphthong ending with YX
*
*/

let FLAG_DIP_YX = 0x0020;
let FLAG_DIPTHONG = 0x0010;
let FLAG_DIPHTHONG = 0x0010;
/** unknown:
* 'M*', 'N*', 'NX', 'DX', 'Q*', 'CH', 'J*', 'B*', '**', '**', 'D*',
* '**', '**', 'G*', '**', '**', 'GX', '**', '**', 'P*', '**', '**',
Expand Down Expand Up @@ -795,7 +795,7 @@ let Parser2 = (insertPhoneme, setPhoneme, getPhoneme, getStress) => {
continue;
}

if (phonemeHasFlag(phoneme, FLAG_DIPTHONG)) {
if (phonemeHasFlag(phoneme, FLAG_DIPHTHONG)) {
// <DIPHTHONG ENDING WITH WX> -> <DIPHTHONG ENDING WITH WX> WX
// <DIPHTHONG NOT ENDING WITH WX> -> <DIPHTHONG NOT ENDING WITH WX> YX
// Example: OIL, COW
Expand Down Expand Up @@ -931,7 +931,7 @@ let Parser2 = (insertPhoneme, setPhoneme, getPhoneme, getStress) => {
if (!phonemeHasFlag(phoneme, FLAG_DIP_YX) && phoneme !== null) {
// replace G with GX and continue processing next phoneme
{
console.log("".concat(pos, " RULE: G <VOWEL OR DIPTHONG NOT ENDING WITH IY> -> GX <VOWEL OR DIPTHONG NOT ENDING WITH IY>"));
console.log("".concat(pos, " RULE: G <VOWEL OR DIPHTHONG NOT ENDING WITH IY> -> GX <VOWEL OR DIPHTHONG NOT ENDING WITH IY>"));
}

setPhoneme(pos, 63); // 'GX'
Expand All @@ -949,7 +949,7 @@ let Parser2 = (insertPhoneme, setPhoneme, getPhoneme, getStress) => {
if (!phonemeHasFlag(Y, FLAG_DIP_YX) || Y === null) {
// VOWELS AND DIPHTHONGS ENDING WITH IY SOUND flag set?
{
console.log("".concat(pos, " K <VOWEL OR DIPTHONG NOT ENDING WITH IY> -> KX <VOWEL OR DIPTHONG NOT ENDING WITH IY>"));
console.log("".concat(pos, " K <VOWEL OR DIPHTHONG NOT ENDING WITH IY> -> KX <VOWEL OR DIPHTHONG NOT ENDING WITH IY>"));
}

setPhoneme(pos, 75);
Expand Down
4 changes: 2 additions & 2 deletions dist/guessnum.esm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/guessnum.esm.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 917016b

Please sign in to comment.