UNPKG

affixi

Version:

Affixi is a helper library for Turkish suffixes for nouns and proper nouns written in typescript.

172 lines (171 loc) 7.33 kB
export interface WordComponent { letter: string; vowel: string; } export declare enum Pronoun { /** Birinci Tekil Şahıs */ SingularFirst = 0, /** İkinci Tekil Şahıs */ SingularSecond = 1, /** Üçüncü Tekil Şahıs */ SingularThird = 2, /** Birinci Çoğul Şahıs */ PluralFirst = 3, /** İkinci Çoğul Şahıs */ PluralSecond = 4, /** Üçüncü Çoğul Şahıs */ PluralThird = 5 } export declare enum Case { /** İsmin Yalın Hâli - */ Absolute = 0, /** İsmin Belirtme Hâli -i */ Accusative = 1, /** İsmin Ayrılma Hâli -den */ Ablative = 2, /** İsmin Bulunma Hâli -de */ Locative = 3, /** İsmin Vasıta Hâli -ile */ Instrumental = 4, /** İsmin Yönelme Hâli -e */ Dative = 5 } export declare enum Compound { /** Tamlayan */ Compounder = 0, /** Tamlanan */ Compoundee = 1 } interface Util { duplicateToUppercase: (list: string[]) => string[]; getComponents: (base: string) => WordComponent; getSyllableCount: (base: string) => number; getNumberText: (value: number) => string; } export declare const util: Util; export declare const sounds: { unvoicedStoppingConsonants: string[]; unvoicedContinuousConsonants: string[]; voicedStoppingConsonants: string[]; concatentorConsonants: string[]; unvoicedConsonants: string[]; roundedVowels: string[]; unRoundedVowels: string[]; backVowels: string[]; frontVowels: string[]; acuteVowels: string[]; wideVowels: string[]; vowels: string[]; }; export declare const exceptions: { /** Unvoiced exceptions that does not soften with a vowel suffix immediately after */ unvoiced: string[]; /** Unvoiced single syllable exceptions that does soften with a vowel suffix immediately after */ unvoicedSingleSyllable: string[]; /** Exceptions that need to be filled when made plural */ plural: string[]; /** Limited list of words that drop their vowe upon a cretain condition */ vowelDrop: string[]; }; export declare type BaseValue = string | number; /** Some words that end with an unvoiced consonants (p,ç,t,k) may be converted into their voiced counterparts (b,c,d,ğ). * If extist, this function returns the voiced consonant. If not returns undefined - * Eğer kelime sert ünsüz ile bitiyorsa, ünsüzün yumuşak halini, bitmiyorsa undefined döndürür */ export declare const getVoicedConsonant: (_base: BaseValue, isProperNoun?: boolean) => string | undefined; /** This function returns the mutated version of a word with its voiced consonant. If base does not have a voiced counterpart, the base itself is returned - * Kelimenin sonunda sert ünsüz varsa, sert ünsüzü yumuşak haliyle değiştirir, yoksa kelimenin kendisini döndürür * 'Renk' -> 'Reng' * 'Akıl' -> 'Akıl' */ export declare const alterToVoicedConsonant: (_base: BaseValue, isProperNoun?: boolean) => string; /** Alter given word to its vowel dropped version. If no vowel is supposed to drop, the word itself is returned - * Verilen kelimenin hecesi düşmüş versiyonunu döndürür. Eğer kelimede ünlü düşmesi yoksa, kelimenin kendisi döndürülür * e.g 'Akıl' -> 'Akl', * e.g 'Bebek' -> 'Bebek' */ export declare const alterToVowelDrop: (_base: BaseValue) => string; /** Returns the plural suffix for a given word - * Verilen kelimenin çoğul ekini dödürür */ export declare const getPluralSuffix: (_base: BaseValue) => string; /** Transforms a given word into plural form - * Verilen kelimeyi çoğul hale getirir */ export declare const makePlural: (_base: BaseValue) => string; /** Returns the equality suffix for a given word - * Verilen kelimenin eşitlik ekini dödürür; e.g 'Çocuk' -> 'ça' */ export declare const getEqualitySuffix: (_base: BaseValue) => string; /** Transforms a given word into equal form - * Verilen kelimeye eşitlik ekini ekler; e.g 'Çocuk' -> 'Çocukça' */ export declare const makeEqual: (_base: BaseValue) => string; /** Returns the possesive suffix for a given word and pronoun - * Verilen kelimeye ve zamire uygun iyelik ekini döndürür */ export declare const getPossesiveSuffix: (_base: BaseValue, pronoun: Pronoun) => string; /** Concatenates the word with the possesive suffix for a given base and pronoun - * Verilen kelimeye ve zamire uygun iyelik ekini ekler */ export declare const makePossesive: (_base: BaseValue, pronoun: Pronoun, isProperNoun?: boolean) => string; /** Returns the appropriate case suffix for a given base word and a case - * Verilen kelimeye ve hâle uygun hâl ekini döndürür. */ export declare const getCaseSuffix: (_base: BaseValue, _case: Case, isCompound?: boolean) => string; /** Returns the word base concatenated with the appropriate case suffix for a given base word and a case * Verilen kelimeye ve hâle uygun hâl ekini ekler */ export declare const makeCase: (_base: BaseValue, _case: Case, isProperNoun?: boolean, isCompound?: boolean) => string; /** Returns the appropriate case suffix for a given base word and a compound type - * Verilen kelimeye ve tamlama tipine uygun tamlama ekini döndürür. */ export declare const getCompoundSuffix: (_base: BaseValue, type: Compound) => string; /** Returns the word base concatenated with the appropriate compound suffix for a given base word and a compound type * Verilen kelimeye ve tamlama tipine uygun tamlama ekini ekler */ export declare const makeCompound: (_base: BaseValue, type: Compound, isProperNoun?: boolean) => string; /** Represents a state of word at a given time with properties like isCompound and isProperNoun */ export interface AffixiWordState { word: string; isCompound: boolean; isProperNoun: boolean; } /** AffixiWord is a construct that makes it easier to handle nouns in a complex manner. * It holds a state that can be undone and handles aspects like compoundness in itslef. * It has a toString method that returns the resulting word and can be used with String(word). * All its methods apart from toString return the instance itself so they are chainable. */ export declare class AffixiWord { base: BaseValue; isProperNoun: boolean; isCompound: boolean; word: string; history: AffixiWordState[]; constructor(base: BaseValue, isProperNoun?: boolean); /** Concatenates the word with the appropriate compound suffix for a given compound type - * Kelimeye verilen tamlama tipine uygun tamlama ekini ekler */ makeCompound(type: Compound): AffixiWord; /** Concatenates the word with the appropriate case suffix for a given case - * Kelimeye verilen hâle uygun hâl ekini ekler */ makeCase(_case: Case): AffixiWord; /** Concatenates the word with the possesive suffix for a given pronoun - * Kelimeye verilen zamire uygun iyelik ekini ekler */ makePossesive(pronoun: Pronoun): AffixiWord; /** Transforms the word into equal form - * Kelimeye eşitlik ekini ekler; e.g 'Çocuk' -> 'Çocukça' */ makeEqual(): AffixiWord; /** Transforms the word into plural form - * Kelimeyi çoğul hale getirir */ makePlural(): AffixiWord; private commit; /** Undoes the last operation */ undo(): AffixiWord; toString(): string; } export {};