Baseline: main branch state prior to Top-10 films expansion
This commit is contained in:
commit
6b15603e56
139 files changed
+329420
No files matched your search
+3905
File diff suppressed because it is too large.
Load diff
+66
@@ -0,0 +1,66 @@
|
||||
import { OutputFormat, TranslatedToken } from '@ingglish/phonemes';
|
||||
|
||||
interface IpaDict {
|
||||
entries: Record<string, string>;
|
||||
lang: string;
|
||||
}
|
||||
interface Language {
|
||||
code: string;
|
||||
label: string;
|
||||
}
|
||||
/** Insert spaces between adjacent Khmer words that have no separator. */
|
||||
declare function segmentKhmerText(text: string): string;
|
||||
declare const LANGUAGES: Language[];
|
||||
/**
|
||||
* Converts an IPA transcription to Ingglish spelling.
|
||||
* Strips slashes and syllable dots before conversion.
|
||||
*/
|
||||
declare function ipaToIngglish(ipa: string): string;
|
||||
declare function lookupIpa(dict: IpaDict, word: string): string | undefined;
|
||||
/** Marker for words not found in the dictionary */
|
||||
declare const NOT_FOUND_MARKER = "\uFFFD";
|
||||
/**
|
||||
* Translates foreign text to the specified output format.
|
||||
* Words not found in the dictionary are returned with a marker prefix.
|
||||
*
|
||||
* For caseless scripts (Arabic, Japanese, Chinese, Korean), sentence-initial
|
||||
* words are automatically capitalized in the output.
|
||||
*/
|
||||
declare function translateForeign(text: string, dict: IpaDict, format?: OutputFormat): string;
|
||||
/**
|
||||
* Like {@link translateForeign}, but returns token-by-token mappings instead of a string.
|
||||
* Each token includes the original text, translation, and whether it matched the dictionary.
|
||||
*/
|
||||
declare function translateForeignWithMapping(text: string, dict: IpaDict, format?: OutputFormat): TranslatedToken[];
|
||||
|
||||
/**
|
||||
* Converts IPA text to ARPAbet with stress digits stripped.
|
||||
*/
|
||||
declare function ipaToArpabetClean(ipa: string): null | string[];
|
||||
|
||||
/**
|
||||
* ARPAbet to IPA conversion.
|
||||
*
|
||||
* Converts CMU dictionary phoneme sequences to IPA notation,
|
||||
* with proper stress marker placement at syllable boundaries.
|
||||
*/
|
||||
/**
|
||||
* Converts a single ARPAbet phoneme to IPA.
|
||||
* Handles stress markers on vowels.
|
||||
*
|
||||
* @param phoneme ARPAbet phoneme (e.g., "AH0", "EY1", "B")
|
||||
* @returns IPA symbol (e.g., "ə", "ˈeɪ", "b")
|
||||
*/
|
||||
declare function arpabetPhonemeToIPA(phoneme: string): string;
|
||||
/**
|
||||
* Converts ARPAbet to IPA without surrounding slashes.
|
||||
* Useful for combining with other text.
|
||||
*
|
||||
* @param arpabet Array of ARPAbet symbols
|
||||
* @returns IPA transcription without surrounding slashes
|
||||
*/
|
||||
declare function arpabetToIPARaw(arpabet: string[]): string;
|
||||
|
||||
declare function registerIPA(): void;
|
||||
|
||||
export { type IpaDict, LANGUAGES, type Language, NOT_FOUND_MARKER, arpabetPhonemeToIPA, arpabetToIPARaw, ipaToArpabetClean, ipaToIngglish, lookupIpa, registerIPA, segmentKhmerText, translateForeign, translateForeignWithMapping };
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
import { OutputFormat, TranslatedToken } from '@ingglish/phonemes';
|
||||
|
||||
interface IpaDict {
|
||||
entries: Record<string, string>;
|
||||
lang: string;
|
||||
}
|
||||
interface Language {
|
||||
code: string;
|
||||
label: string;
|
||||
}
|
||||
/** Insert spaces between adjacent Khmer words that have no separator. */
|
||||
declare function segmentKhmerText(text: string): string;
|
||||
declare const LANGUAGES: Language[];
|
||||
/**
|
||||
* Converts an IPA transcription to Ingglish spelling.
|
||||
* Strips slashes and syllable dots before conversion.
|
||||
*/
|
||||
declare function ipaToIngglish(ipa: string): string;
|
||||
declare function lookupIpa(dict: IpaDict, word: string): string | undefined;
|
||||
/** Marker for words not found in the dictionary */
|
||||
declare const NOT_FOUND_MARKER = "\uFFFD";
|
||||
/**
|
||||
* Translates foreign text to the specified output format.
|
||||
* Words not found in the dictionary are returned with a marker prefix.
|
||||
*
|
||||
* For caseless scripts (Arabic, Japanese, Chinese, Korean), sentence-initial
|
||||
* words are automatically capitalized in the output.
|
||||
*/
|
||||
declare function translateForeign(text: string, dict: IpaDict, format?: OutputFormat): string;
|
||||
/**
|
||||
* Like {@link translateForeign}, but returns token-by-token mappings instead of a string.
|
||||
* Each token includes the original text, translation, and whether it matched the dictionary.
|
||||
*/
|
||||
declare function translateForeignWithMapping(text: string, dict: IpaDict, format?: OutputFormat): TranslatedToken[];
|
||||
|
||||
/**
|
||||
* Converts IPA text to ARPAbet with stress digits stripped.
|
||||
*/
|
||||
declare function ipaToArpabetClean(ipa: string): null | string[];
|
||||
|
||||
/**
|
||||
* ARPAbet to IPA conversion.
|
||||
*
|
||||
* Converts CMU dictionary phoneme sequences to IPA notation,
|
||||
* with proper stress marker placement at syllable boundaries.
|
||||
*/
|
||||
/**
|
||||
* Converts a single ARPAbet phoneme to IPA.
|
||||
* Handles stress markers on vowels.
|
||||
*
|
||||
* @param phoneme ARPAbet phoneme (e.g., "AH0", "EY1", "B")
|
||||
* @returns IPA symbol (e.g., "ə", "ˈeɪ", "b")
|
||||
*/
|
||||
declare function arpabetPhonemeToIPA(phoneme: string): string;
|
||||
/**
|
||||
* Converts ARPAbet to IPA without surrounding slashes.
|
||||
* Useful for combining with other text.
|
||||
*
|
||||
* @param arpabet Array of ARPAbet symbols
|
||||
* @returns IPA transcription without surrounding slashes
|
||||
*/
|
||||
declare function arpabetToIPARaw(arpabet: string[]): string;
|
||||
|
||||
declare function registerIPA(): void;
|
||||
|
||||
export { type IpaDict, LANGUAGES, type Language, NOT_FOUND_MARKER, arpabetPhonemeToIPA, arpabetToIPARaw, ipaToArpabetClean, ipaToIngglish, lookupIpa, registerIPA, segmentKhmerText, translateForeign, translateForeignWithMapping };
|
||||
+3881
File diff suppressed because it is too large.
Load diff
+51
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "@ingglish/ipa",
|
||||
"version": "0.1.1",
|
||||
"description": "IPA (International Phonetic Alphabet) conversion for Ingglish",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"source": "./src/index.ts",
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build:fast": "tsup src/index.ts --format esm",
|
||||
"lint": "eslint --cache src",
|
||||
"test": "vitest run --no-color",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ingglish/normalize": "^0.1.0",
|
||||
"@ingglish/phonemes": "^0.1.0"
|
||||
},
|
||||
"author": "Paul Tarjan",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ptarjan/ingglish.git",
|
||||
"directory": "packages/ipa"
|
||||
},
|
||||
"homepage": "https://github.com/ptarjan/ingglish#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ptarjan/ingglish/issues"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user