Bavya NLP 0.1
Bavya NLP 0.1
NAME : Bavya C
CLASS : AI-DS ‘A’
ROLLNO : 22AD010
1. Word Frequency Analysis
Explanation:
Word frequency analysis identifies how often each word appears in a text. It helps determine the text's dominant
themes and frequent patterns.
Steps to Solve:
Preprocessing: Clean the text to remove punctuation, convert to lowercase, and split into words.
Count Total Words: Count all the words in the cleaned list.
Calculate Word Frequencies: Use a dictionary or collections.Counter to calculate the frequency of
each word.
Find the Most Common Word: Identify the word with the highest count.
Python Implementation:
OUTPUT:
Total words: 31
Word frequencies: Counter({'data': 3, 'is': 2, 'and': 2, 'that': 1, 'science': 1, 'an': 1, 'interdisciplinary': 1, 'field': 1, 'uses': 1,
'various': 1, 'techniques': 1, 'algorithms': 1, 'tools': 1, 'to': 1, 'extract': 1, 'insights': 1, 'knowledge': 1, 'from': 1, 'structured': 1,
'unstructured': 1, 'driven': 1, 'decisionmaking': 1, 'transforming': 1, 'industries': 1, 'worldwide': 1})
Word lengths in the text are analyzed using three statistical measures:
Steps to Solve:
Python Implementation:
OUTPUT:
Typical word length: Median, as it reduces the impact of very short or long words.
3. Visualization
Explanation:
Visualizing the word frequencies offers insights into the text's structure and focus:
Steps to Solve:
Python Implementation:
OUTPUT:
Frequencies: 3, 2, 2, 1, 1