βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Text β --> β Language β --> β Ranked β
β Corpus β β Model β β Sentences β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
Multi-metric similarity scoring combining:
- π€ TF-IDF - Term frequency analysis
- π Character-level - LCS-based matching
- π Co-occurrence - Semantic relationships
# 1. Clone & Install
git clone https://github.com/ItzmeJan/NarrowMind-L2.git
cd NarrowMind-L2
# 2. Add your text to input.txt
echo "Your text corpus here..." > input.txt
# 3. Run
node index.js=> your query here
| Feature | Description |
|---|---|
| π§ Multi-Metric Scoring | TF-IDF + Character + Co-occurrence |
| π Semantic Analysis | Word co-occurrence & n-gram patterns |
| βοΈ Text Processing | Custom stemming & filler word filtering |
| π Interactive Shell | Real-time query analysis |
node index.js======================================================================
NarrowMind S2 - Statistical Language Model
======================================================================
=> where did aria walk
π QUERY ANALYSIS
β’ walked β TF: 0.0180 | IDF: 3.0794
β’ aria β TF: 0.0270 | IDF: 2.7918
π Common Co-occurrences
β’ aria - co-occurs with 2 query tokens
π RANKING RESULTS
1. [Score: 0.2639] ββββββββββββ
"Aria walked home late after her evening class"
import { NarrowMindModel } from './model.js';
const model = new NarrowMindModel(textData);
// Rank sentences
const results = model.rankSentences(
"your query",
10, // top N results
0.70, // TF-IDF weight
0.10, // Character weight
false, // filter fillers
0.20, // Co-occurrence weight
'jaccard' // method
);TF-IDF: ββββββββββββββββββββ 70%
Character: ββββ 10%
Co-occurrence: ββββββ 20%
- Jaccard - Set-based similarity (intersection/union)
- PMI - Pointwise Mutual Information
NarrowMind-L2/
βββ π index.js # Interactive shell
βββ π§ model.js # Core language model
βββ βοΈ stem.js # Stemming utility
βββ π fillers.json # Stop words
βββ π input.txt # Your corpus
// Main methods
model.rankSentences(query, topN, ...weights)
model.getTokenStats(token)
model.getTopCoOccurrences(word, topN)
model.calculateCoOccurrenceScore(word1, word2, method)1. Text Processing
ββ> Tokenize β Stem β Filter
2. Feature Extraction
ββ> TF-IDF vectors
ββ> Co-occurrence matrix
ββ> Character features
3. Similarity Calculation
ββ> Multi-metric scoring
4. Ranking
ββ> Weighted combination β Results
ISC
Built with β€οΈ for intelligent text understanding