-
Notifications
You must be signed in to change notification settings - Fork 0
LEXIOJS‐DOCS
Introducing LexioJS a lightweight(~7.60 kb minified) simple JavaScript library built with vanilla JS which provides you a lightning fast API for performing basic NLP tasks Such as:
-Tokenization
-Text Processing
-Stop Word Removal
-sentiment analysis
-NER
-stemming
-lemmatization
Lexio.js is a JavaScript library for Natural Language Processing (NLP) tasks. It provides various classes and methods for text processing, sentiment analysis, named entity recognition, stemming, and lemmatization.
The core class containing Tokenizer and StopWordRemover.
Tokenizer
-
tokenize(text: string)
: Tokenizes the input text into individual words or tokens. -
removePunctuation(text: string)
: Removes punctuation from the input text. -
expandContractions(text: string)
: Expands contractions in the input text.
StopWordRemover
-
removeStopWords(tokens: array)
: Removes stopwords from the input tokens.
Analyzes sentiment of input text.
-
analyzeSentiment(text: string)
: Analyzes sentiment of the input text.- Returns: "positive", "negative", or "neutral"
Identifies named entities in input text.
-
identifyEntities(text: string)
: Identifies named entities in the input text.- Returns: An array of identified entities
Stems input tokens.
-
stem(token: string)
: Stems the input token.- Returns: The stemmed token
Lemmatizes input text.
-
lemmatize(text: string)
: Lemmatizes the input text.- Returns: An array of lemmatized tokens
you can use a CDN to include Lexio in directly in your project!
<script src="[https://cdn.jsdelivr.net/gh/SomnathDevPro/LexioJS@main/src/lexio.min.js]"></script>
const lexio = new Lexio();
const tokenizer = new lexio.Tokenizer();
const tokens = tokenizer.tokenize('This is an example sentence.');
console.log(tokens); // Output: ["This", "is", "an", "example", "sentence"]
const lexio = new Lexio();
const sentimentAnalyzer = new LexioSentimentAnalyzer();
const sentiment = sentimentAnalyzer.analyzeSentiment('I love this product!');
console.log(sentiment); // Output: "positive"
const lexio = new Lexio();
const ner = new Lner();
const entities = ner.identifyEntities('John Smith is a software engineer at Google.');
console.log(entities); // Output: [{"token": "John Smith", "type": "Person"}, {"token": "Google", "type": "Organization"}]
const stemmer = new LexioPorterStemmer();
const stemmedToken = stemmer.stem('running');
console.log(stemmedToken); // Output: "run"
const lemmatizer = new LexioLemmatizer();
const lemmatizedTokens = lemmatizer.lemmatize('The quick brown fox jumps over the lazy dog.');
console.log(lemmatizedTokens); // Output: ["The", "quick", "brown", "fox", "jump", "over", "the", "lazy", "dog"]
Lexio.js is licensed under the MIT License.
Pull requests and issues are welcome!
thanks for checking out my project 😊 please give me a star if you liked...