đĻ @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 Member | Value | Description | Defined in |
|---|---|---|---|
ADJ | "ADJ" | Adjectives are words that typically modify nouns Example āĻŦāĻĄāĻŧ/boro, āϏā§āύā§āĻĻāϰ/sundor, āύāϤā§āύ/notun | index.ts:14 |
ADP | "ADP" | Adpositions are prepositions and postpositions Example āĻŽāϧā§āϝā§/moddhe, āĻĨā§āĻā§/theke, āĻāĻĒāϰā§/upore | index.ts:17 |
ADV | "ADV" | Adverbs are words that typically modify verbs, adjectives or other adverbs Example āĻā§āĻŦ/khub, āϧā§āϰā§/dhire, āĻāĻžāϞā§āĻāĻžāĻŦā§/bhalobhabe | index.ts:20 |
AUX | "AUX" | Auxiliary verbs are used to form tenses, moods, etc. Example āĻāĻā§/ache, āĻšāϝāĻŧ/hoi, āĻšāĻŦā§/hobe | index.ts:23 |
CCONJ | "CCONJ" | Coordinating conjunctions connect words, phrases, clauses of equal status Example āĻāĻŦāĻ/ebong, āĻāĻŋāύā§āϤā§/kintu, āĻ
āĻĨāĻŦāĻž/othoba | index.ts:26 |
DET | "DET" | Determiners are words that modify nouns or noun phrases Example āĻāĻ/ei, āϏā§āĻ/sei, āĻā§āύ/kon | index.ts:29 |
INTJ | "INTJ" | Interjections are exclamatory words Example āĻāĻš/oh, āĻŦāĻžāĻš/bah, āĻšāĻžāϝāĻŧ/hay | index.ts:32 |
NOUN | "NOUN" | Nouns are words denoting all physical objects and materials Example āĻŦāĻ/boi, āĻŽāĻžāύā§āώ/manush, āĻŦāĻžāĻĄāĻŧāĻŋ/bari | index.ts:35 |
NUM | "NUM" | Numerals represent numbers, quantities, etc. Example āĻāĻ/ek, āĻĻā§āĻ/dui, āĻĒā§āϰāĻĨāĻŽ/prothom | index.ts:38 |
PART | "PART" | Particles are function words that must be associated with another word Example āύāĻž/na, āϤā§/to, āĻāĻŋ/ki | index.ts:41 |
PRON | "PRON" | Pronouns substitute for nouns or noun phrases Example āĻāĻŽāĻŋ/ami, āϤā§āĻŽāĻŋ/tumi, āϏā§/se | index.ts:44 |
PROPN | "PROPN" | Proper nouns are names of specific persons, places, organizations Example āĻĸāĻžāĻāĻž/dhaka, āϰāĻŦā§āύā§āĻĻā§āϰāύāĻžāĻĨ/robindronath, āĻŦāĻžāĻāϞāĻžāĻĻā§āĻļ/bangladesh | index.ts:47 |
PUNCT | "PUNCT" | Punctuation marks Example āĨ¤, ?, !, , | index.ts:50 |
SCONJ | "SCONJ" | Subordinating conjunctions link dependent clauses to independent ones Example āϝāĻĻāĻŋ/jodi, āĻāĻžāϰāĻŖ/karon, āϝāĻāύ/jokhon | index.ts:53 |
SYM | "SYM" | Symbols represent currency, math operators, etc. Example ā§ŗ, +, = | index.ts:56 |
VERB | "VERB" | Verbs denote actions and processes Example āϝāĻžāĻ/jai, āĻāĻžāĻ/khai, āĻĒāĻĄāĻŧāĻŋ/pori | index.ts:59 |
X | "X" | Other words that don't fit into above categories Example āĻāϤā§āϝāĻžāĻĻāĻŋ/ittyadi, āĻĒā§āϰāĻā§āϤāĻŋ/probhriti | index.ts:62 |
TaggedWordâ
Defined in: index.ts:68
Represents a word with its POS tag and additional linguistic features
Propertiesâ
| Property | Type | Description | Defined in |
|---|---|---|---|
features? | Record<string, string> | Additional linguistic features (e.g., gender, number, case) | index.ts:74 |
tag | UniversalPOSTag | The POS tag for the word | index.ts:72 |
word | string | The original word | index.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â
| Parameter | Type | Description |
|---|---|---|
taggedWords | TaggedWord[] | 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â
| Parameter | Type | Description |
|---|---|---|
text | string | The Bangla text to tag |
Returnsâ
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â
| Parameter | Type | Description |
|---|---|---|
word | string | The Bangla word to tag |
Returnsâ
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â
| Parameter | Type | Description |
|---|---|---|
words | string[] | Array of Bangla words to tag |
Returnsâ
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 }
// ]