Skip to main content

đŸ“Ļ @bntk/pos

UniversalPOSTag​

Defined in: index.ts:11

Universal POS tags based on Universal Dependencies (UD) v2 specification Source: https://universaldependencies.org/u/pos/

Enumeration Members​

Enumeration MemberValueDescriptionDefined in
ADJ"ADJ"Adjectives are words that typically modify nouns Example āĻŦāĻĄāĻŧ/boro, āϏ⧁āĻ¨ā§āĻĻāϰ/sundor, āύāϤ⧁āύ/notunindex.ts:14
ADP"ADP"Adpositions are prepositions and postpositions Example āĻŽāĻ§ā§āϝ⧇/moddhe, āĻĨ⧇āϕ⧇/theke, āωāĻĒāϰ⧇/uporeindex.ts:17
ADV"ADV"Adverbs are words that typically modify verbs, adjectives or other adverbs Example āϖ⧁āĻŦ/khub, āϧ⧀āϰ⧇/dhire, āĻ­āĻžāϞ⧋āĻ­āĻžāĻŦ⧇/bhalobhabeindex.ts:20
AUX"AUX"Auxiliary verbs are used to form tenses, moods, etc. Example āφāϛ⧇/ache, āĻšāϝāĻŧ/hoi, āĻšāĻŦ⧇/hobeindex.ts:23
CCONJ"CCONJ"Coordinating conjunctions connect words, phrases, clauses of equal status Example āĻāĻŦāĻ‚/ebong, āĻ•āĻŋāĻ¨ā§āϤ⧁/kintu, āĻ…āĻĨāĻŦāĻž/othobaindex.ts:26
DET"DET"Determiners are words that modify nouns or noun phrases Example āĻāχ/ei, āϏ⧇āχ/sei, āϕ⧋āύ/konindex.ts:29
INTJ"INTJ"Interjections are exclamatory words Example āĻ“āĻš/oh, āĻŦāĻžāĻš/bah, āĻšāĻžāϝāĻŧ/hayindex.ts:32
NOUN"NOUN"Nouns are words denoting all physical objects and materials Example āĻŦāχ/boi, āĻŽāĻžāύ⧁āώ/manush, āĻŦāĻžāĻĄāĻŧāĻŋ/bariindex.ts:35
NUM"NUM"Numerals represent numbers, quantities, etc. Example āĻāĻ•/ek, āĻĻ⧁āχ/dui, āĻĒā§āϰāĻĨāĻŽ/prothomindex.ts:38
PART"PART"Particles are function words that must be associated with another word Example āύāĻž/na, āϤ⧋/to, āĻ•āĻŋ/kiindex.ts:41
PRON"PRON"Pronouns substitute for nouns or noun phrases Example āφāĻŽāĻŋ/ami, āϤ⧁āĻŽāĻŋ/tumi, āϏ⧇/seindex.ts:44
PROPN"PROPN"Proper nouns are names of specific persons, places, organizations Example āĻĸāĻžāĻ•āĻž/dhaka, āϰāĻŦā§€āĻ¨ā§āĻĻā§āϰāύāĻžāĻĨ/robindronath, āĻŦāĻžāĻ‚āϞāĻžāĻĻ⧇āĻļ/bangladeshindex.ts:47
PUNCT"PUNCT"Punctuation marks Example āĨ¤, ?, !, ,index.ts:50
SCONJ"SCONJ"Subordinating conjunctions link dependent clauses to independent ones Example āϝāĻĻāĻŋ/jodi, āĻ•āĻžāϰāĻŖ/karon, āϝāĻ–āύ/jokhonindex.ts:53
SYM"SYM"Symbols represent currency, math operators, etc. Example ā§ŗ, +, =index.ts:56
VERB"VERB"Verbs denote actions and processes Example āϝāĻžāχ/jai, āĻ–āĻžāχ/khai, āĻĒāĻĄāĻŧāĻŋ/poriindex.ts:59
X"X"Other words that don't fit into above categories Example āχāĻ¤ā§āϝāĻžāĻĻāĻŋ/ittyadi, āĻĒā§āϰāϭ⧃āϤāĻŋ/probhritiindex.ts:62

TaggedWord​

Defined in: index.ts:68

Represents a word with its POS tag and additional linguistic features

Properties​

PropertyTypeDescriptionDefined in
features?Record<string, string>Additional linguistic features (e.g., gender, number, case)index.ts:74
tagUniversalPOSTagThe POS tag for the wordindex.ts:72
wordstringThe original wordindex.ts:70

getPOSTagFrequencies()​

function getPOSTagFrequencies(taggedWords): Map<UniversalPOSTag, number>;

Defined in: index.ts:196

Gets the most common POS tags in a sequence of tagged words

Parameters​

ParameterTypeDescription
taggedWordsTaggedWord[]Array of tagged words

Returns​

Map<UniversalPOSTag, number>

Map of POS tags to their frequencies

Description​

This function analyzes a sequence of tagged words and returns a map showing how many times each POS tag appears.

Example​

const tagged = [
{ word: "āφāĻŽāĻŋ", tag: UniversalPOSTag.PRON },
{ word: "āĻŦāĻžāĻ‚āϞāĻžāϝāĻŧ", tag: UniversalPOSTag.ADP },
{ word: "āĻ—āĻžāύ", tag: UniversalPOSTag.NOUN },
{ word: "āĻ—āĻžāχ", tag: UniversalPOSTag.VERB },
];
const frequencies = getPOSTagFrequencies(tagged);
console.log(frequencies);
// Output: Map(4) {
// UniversalPOSTag.PRON => 1,
// UniversalPOSTag.ADP => 1,
// UniversalPOSTag.NOUN => 1,
// UniversalPOSTag.VERB => 1
// }

tagText()​

function tagText(text): TaggedWord[];

Defined in: index.ts:162

Tags a Bangla text string with parts of speech

Parameters​

ParameterTypeDescription
textstringThe Bangla text to tag

Returns​

TaggedWord[]

Array of words with their POS tags and features

Description​

This function first tokenizes the input text into words and then performs POS tagging on the resulting word sequence.

Example​

const text = "āφāĻŽāĻŋ āĻŦāĻžāĻ‚āϞāĻžāϝāĻŧ āĻ—āĻžāύ āĻ—āĻžāχ";
const tagged = tagText(text);
console.log(tagged);
// Output: [
// { word: "āφāĻŽāĻŋ", tag: UniversalPOSTag.PRON },
// { word: "āĻŦāĻžāĻ‚āϞāĻžāϝāĻŧ", tag: UniversalPOSTag.ADP },
// { word: "āĻ—āĻžāύ", tag: UniversalPOSTag.NOUN },
// { word: "āĻ—āĻžāχ", tag: UniversalPOSTag.VERB }
// ]

tagWord()​

function tagWord(word): TaggedWord;

Defined in: index.ts:102

Tags a single Bangla word with its part of speech

Parameters​

ParameterTypeDescription
wordstringThe Bangla word to tag

Returns​

TaggedWord

The word with its POS tag and features

Description​

This function performs POS tagging for a single Bangla word. It uses a combination of rules and dictionary lookup to determine the most likely POS tag for the given word.

Examples​

const result = tagWord("āĻŦāĻžāĻ‚āϞāĻž");
console.log(result);
// Output: { word: "āĻŦāĻžāĻ‚āϞāĻž", tag: UniversalPOSTag.NOUN }
const result = tagWord("āϏ⧁āĻ¨ā§āĻĻāϰ");
console.log(result);
// Output: { word: "āϏ⧁āĻ¨ā§āĻĻāϰ", tag: UniversalPOSTag.ADJ }

tagWords()​

function tagWords(words): TaggedWord[];

Defined in: index.ts:134

Tags a sequence of Bangla words with their parts of speech

Parameters​

ParameterTypeDescription
wordsstring[]Array of Bangla words to tag

Returns​

TaggedWord[]

Array of words with their POS tags and features

Description​

This function performs POS tagging for a sequence of Bangla words. It takes into account the context of surrounding words to improve tagging accuracy.

Example​

const words = ["āφāĻŽāĻŋ", "āĻŦāĻžāĻ‚āϞāĻžāϝāĻŧ", "āĻ—āĻžāύ", "āĻ—āĻžāχ"];
const tagged = tagWords(words);
console.log(tagged);
// Output: [
// { word: "āφāĻŽāĻŋ", tag: UniversalPOSTag.PRON },
// { word: "āĻŦāĻžāĻ‚āϞāĻžāϝāĻŧ", tag: UniversalPOSTag.ADP },
// { word: "āĻ—āĻžāύ", tag: UniversalPOSTag.NOUN },
// { word: "āĻ—āĻžāχ", tag: UniversalPOSTag.VERB }
// ]