0% found this document useful (0 votes)
5 views6 pages

Assignment 1: Zipf's Law and Stemming Analysis: Roll Number: 23075031 Name: Harsh Kumar Jha

This assignment investigates Zipf's Law and the impact of stemming on English and Hindi text datasets. It confirms that Zipf's Law holds for English and approximately for Hindi, while stemming reduces vocabulary size significantly more in English due to its simpler morphology. The assignment includes preprocessing methods, stemming results, and observations on the effectiveness of stemming in relation to language complexity.

Uploaded by

p1x3lph4nt0m
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Assignment 1: Zipf's Law and Stemming Analysis: Roll Number: 23075031 Name: Harsh Kumar Jha

This assignment investigates Zipf's Law and the impact of stemming on English and Hindi text datasets. It confirms that Zipf's Law holds for English and approximately for Hindi, while stemming reduces vocabulary size significantly more in English due to its simpler morphology. The assignment includes preprocessing methods, stemming results, and observations on the effectiveness of stemming in relation to language complexity.

Uploaded by

p1x3lph4nt0m
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment 1: Zipf’s Law and Stemming Analysis

Roll Number: 23075031


Name: Harsh Kumar Jha

1 Introduction
Natural language text collections exhibit strong statistical regularities. One of the most impor-
tant empirical laws governing word distributions is Zipf’s Law, which states that the frequency
of a word is inversely proportional to its rank in the frequency table.
This assignment has two objectives:

• To verify whether Zipf’s Law holds for real-world English and Indian language document
collections.

• To analyze the impact of stemming by comparing the number of unique words before and
after stemming.

2 Dataset Description
2.1 English Dataset
• Source Name: The Telegraph

• Source URL: [Link]

• Time Period: 1st September 2004 – 30th September 2007

• Encoding: UTF-8

• Number of Documents: 125,586

• Corpus Size: 580 MB

The dataset is organized hierarchically by year of publication and newspaper section (e.g.,
nation, sports, business). Each file contains a single news article marked using XML-like tags
such as <DOC>, <DOCNO>, and <TEXT>.

2.2 Hindi Dataset


• Source Names: Amar Ujala, Dainik Jagran

• Encoding: UTF-8 (with some noise)

• Number of Documents: 149,481

1
• Corpus Size: Approximately 1.3 GB

• File Types: .utf8 and .xml

Each file contains multiple news articles marked using XML tags. All markup tags were
removed during preprocessing.

3 Preprocessing
The following preprocessing steps were applied to both datasets:

1. Recursive traversal of directories to read all documents

2. Conversion of text to lowercase

3. Removal of XML and markup tags

4. Removal of punctuation, numbers, and special symbols

5. Tokenization based on whitespace

Stopword removal was not performed to preserve natural frequency distributions required
for Zipf’s Law analysis.

4 Zipf’s Law Analysis


Zipf’s Law states:
1
f (r) ∝
r
where f (r) is the frequency of a word with rank r.
For each dataset, words were ranked by descending frequency and a log–log plot of rank
versus frequency was generated.

2
4.1 English Zipf Plot

Figure 1: Zipf’s Law Plot for English Dataset

3
4.2 Hindi Zipf Plot

Figure 2: Zipf’s Law Plot for Hindi Dataset

4.3 Zipf’s Law Observation

Language Zipf’s Law Observed Observation


English Yes Linear trend in log–log scale
Hindi Approximately Minor deviation in tail region

Table 1: Zipf’s Law Observations

5 Stemming Analysis
5.1 English Stemming (Porter Stemmer)
The Porter Stemmer is a rule-based stemmer that removes common English suffixes to reduce
words to their stems.

Stemming Rules Used


• ing → ϵ (playing → play)
• ed → ϵ (worked → work)
• sses → ss (classes → class)
• ies → i (studies → studi)

4
Results

Metric Count
Unique Words (Before Stemming) 235,138
Unique Stems (After Stemming) 179,440

Table 2: English Stemming Results

5.2 Hindi Stemming (Rule-Based)


A simple rule-based Hindi stemmer was implemented by removing common suffixes.

Stemming Rules Used


• ◌ाें removal: लड़काें → लड़क
• ◌ा removal: लड़का → लड़क
• ◌ी removal: लड़की → लड़क
• ◌ें removal: िकताबें → िकताब

Results

Metric Count
Unique Words (Before Stemming) 285,108
Unique Stems (After Stemming) 249,661

Table 3: Hindi Stemming Results

6 Comparison of Stemming Results

Language Unique Words Unique Stems


English 235,138 179,440
Hindi 285,108 249,661

Table 4: Comparison of Vocabulary Reduction

7 Observations
• Zipf’s Law holds strongly for the English dataset and approximately for the Hindi dataset.
• English shows greater vocabulary reduction due to simpler morphology.
• Hindi exhibits smaller reduction because of rich inflectional structure.
• Rule-based stemming may lead to over-stemming, which is a known limitation.

5
8 Conclusion
This assignment demonstrates that Zipf’s Law is a language-independent statistical property
of natural text. Stemming significantly reduces vocabulary size and improves normalization,
although its effectiveness depends on the morphological complexity of the language.

9 Submission Details
The submission includes:

• Source code used for preprocessing, Zipf’s Law analysis, and stemming

• Zipf’s Law plots for English and Hindi datasets

• This report in PDF format

Common questions

Powered by AI

The study aimed to verify Zipf’s Law across English and Indian language collections. For the English dataset, where Zipf’s Law was strongly observed, the outcome aligned well with expectations, indicating natural language consistency. However, for the Hindi dataset, where the Law was only approximately followed with minor deviations in the tail region, the results still supported the law’s underlying principle but highlighted the variance due to different linguistic features. This demonstrates the law's overall applicability across languages while acknowledging morphological impacts .

The hierarchical arrangement by year and newspaper section for English, and mixed XML/UTF-8 formats for Hindi, influenced preprocessing to accommodate varied data presentation. Strategies included handling diverse file structures systematically, removing format-specific tags, and ensuring uniform tokenization. Such measures ensure consistent text input formats, necessary for cross-language analysis of Zipf’s Law and stemming applications .

Preprocessing steps included recursive directory traversal, text conversion to lowercase, removal of XML tags and punctuations, and tokenization based on whitespace. Importantly, stopword removal was intentionally not performed to maintain the natural frequency distributions required for accurate Zipf's Law analysis .

Rule-based stemming can lead to over-stemming because such methods apply general rules to remove suffixes without considering the context of a word, potentially reducing more than necessary. This is problematic in languages like Hindi with complex morphology, where inappropriate suffix removal can lead to loss of meaning or incorrect word forms. The study notes that while stemming reduces vocabulary size, it can be less effective in languages with rich inflectional structures .

Stemming aids text normalization by reducing inflected words to common bases, thereby standardizing lexical forms. English, with fewer morphological variations, benefits more, as evidenced by the significant reduction in unique forms. Hindi's complex morphology means less reduction, suggesting that stems do not always unify variations comprehensively. Thus, stemming efficiency is influenced by linguistic structure, affecting normalization levels achieved across languages .

The English dataset had 125,586 documents and a 580 MB corpus size, while the Hindi dataset had 149,481 documents with a 1.3 GB corpus size. Larger and diverse datasets allow more reliable frequency-based analysis, critical for Zipf’s Law, which depends on extensive lexical data to establish the regularities in word distributions across ranks. These comprehensive datasets ensure robust validation of theoretical assertions like Zipf’s Law .

Stemming reduces the number of unique words by converting them to their root forms. In the study, English stemming resulted in a reduction from 235,138 to 179,440 unique words, while Hindi stemming reduced unique words from 285,108 to 249,661. This suggests that English, with its simpler morphological structure, shows greater vocabulary reduction compared to Hindi, which exhibits smaller reduction due to its richer inflectional morphology .

Stemming reduces computational redundancy by decreasing unique word forms, enhancing efficiency in NLP tasks like indexing or machine learning training. Zipf's Law helps optimize data storage by highlighting key vocabulary distribution, informing scalable model designs that can prioritize higher-frequency terms. Together, these analyses enhance language model robustness and processing speed, crucial for effective, resource-efficient NLP applications .

Zipf's Law is a principle that suggests a statistical regularity in word distributions within natural language texts, indicating that the frequency of a word is inversely proportional to its rank. This study validated Zipf's Law by analyzing real-world English and Indian language document collections. For the English dataset, a strong linear trend in a log-log plot confirmed the law, whereas the Hindi dataset showed minor deviations in the tail region, suggesting the law holds approximately .

The study shows Zipf’s Law as a language-independent property by demonstrating its applicability to both English and Hindi datasets. While the law was strongly adhered to in English, and approximately in Hindi with manageable deviations, both languages followed its core principle. This indicates that Zipf's Law is not constrained by the language's native structures, reinforcing its universality across different linguistic contexts .

You might also like