Algorithm comparisons
Compare
Run two different processing pipelines on the same text and see the difference word by word, then review the comparison tables between opposing algorithms.
Compare two pipelines
Runs in your browserResult
Steps
Light stemming versus root extraction
| Item | Light10 light stemmer | ISRI root stemmer |
|---|---|---|
| Family | Traditional algorithm | Traditional algorithm |
| Definition | A light stemmer for Arabic that removes a limited number of common prefixes and suffixes without trying to reach the root, and improves retrieval compared with full words and roots. | An Arabic stemmer that tries to reach the root without a root dictionary, by removing prefixes and suffixes and then matching the word with morphological patterns according to its length. |
| Outputs | Stem | An approximate root |
| Complexity | O(1) per word | O(1) per word |
| Strengths |
|
|
| Cons |
|
|
Frequency-based versus graph-based summarization
| Item | TF-IDF weighting | The TextRank algorithm |
|---|---|---|
| Family | Traditional algorithm | Traditional algorithm |
| Definition | A weight for a word in a document that rises with its frequency there (TF) and falls with how common it is in other documents (IDF), highlighting distinctive words. | A graph-based ranking algorithm that applies the PageRank idea to sentences (or words) to extract the most important ones without supervision. |
| Outputs | A weight for each (word, document) | A score for each sentence, and a summary |
| Complexity | O(N) in the text size | O(S²) to build the graph + the PageRank iterations |
| Strengths |
|
|
| Cons |
|
|
Subwords: BPE versus WordPiece
| Item | Byte Pair Encoding | WordPiece tokenization |
|---|---|---|
| Family | Traditional algorithm | Traditional algorithm |
| Definition | A subword tokenization algorithm that learns its vocabulary from a corpus by repeatedly merging the most frequent adjacent pair of symbols, producing units between a character and a word. | A subword tokenization method used by BERT models: the vocabulary is built by choosing the merges that raise the likelihood of the training data, and a word is encoded by longest match from the left. |
| Outputs | A list of merges and subword vocabulary, and the encoding of each word | A list of pieces such as «ال ##معلم ##ون» |
| Complexity | Naive training is O(N·M), where N is the corpus size and M the number of merges; faster implementations exist | Encoding is O(n²) in the word length with a naive implementation |
| Strengths |
|
|
| Cons |
|
|
Word similarity versus character n-gram similarity
| Item | Jaccard coefficient | Character n-gram similarity |
|---|---|---|
| Family | Traditional algorithm | Traditional algorithm |
| Definition | The similarity of two sets, equal to the size of their intersection divided by the size of their union. | Comparing two texts by their sets of character n-grams (for example trigrams), which captures the similarity of morphological forms and simple spelling mistakes. |
| Outputs | A number between 0 and 1 | A number between 0 and 1 |
| Complexity | O(|A|+|B|) with hash tables | O(L) in the number of characters |
| Strengths |
|
|
| Cons |
|
|
Pattern-and-list entities versus a trained model
| Item | Pattern and list-based entity recognition | Transformer entity recognition |
|---|---|---|
| Family | Resource-based | Deep learning |
| Definition | Detecting entities with regular expressions for regular forms (dates, times, amounts and percentages) and with lists of known names and trigger words (titles and organization heads). | Fine-tuning a pretrained language model (such as CAMeLBERT or AraBERT) on data tagged in BIO format to classify each token into an entity type. |
| Outputs | A list of entities (text, type, position, method) | Entities with their types |
| Complexity | O(n·p), where p is the number of patterns | Transformer inference is O(n²) in the segment length |
| Strengths |
|
|
| Cons |
|
|
Lexicon-based sentiment versus a trained model
| Item | Lexicon-based sentiment analysis | Transformer sentiment classification |
|---|---|---|
| Family | Resource-based | Deep learning |
| Definition | Computing a text's polarity by adding up word values from a sentiment lexicon, with rules for negation, intensification and contrast. | Fine-tuning a language model pretrained on Arabic text (such as MARBERT or CAMeLBERT-DA) to classify sentiment in Modern Standard Arabic and the dialects. |
| Outputs | A score, a verdict and the influential words | A class and probabilities |
| Complexity | O(n) | Transformer inference is O(n²) |
| Strengths |
|
|
| Cons |
|
|
Traditional, lexical and trained
| Family | What do you need? | Number of algorithms in the library | In this lab |
|---|---|---|---|
| Traditional algorithm | Rules, counting and arithmetic, with no need for a trained model | 17 | Runs in the browser |
| Resource-based | Ready-made dictionaries, lists and linguistic rules | 11 | Runs in the browser |
| Machine learning | A statistical model that needs labeled training data | 8 | Explanation only, or through an external engine enabled by the admin |
| Deep learning | A neural network with trained weights | 9 | Explanation only, or through an external engine enabled by the admin |
| Large language model | A huge pre-trained generative model | 0 | Explanation only, or through an external engine enabled by the admin |
