Professional Documents
Culture Documents
S.N Date Experiment Name Pre- In-Lab (25M) Post- Viva Total Faculty
o Lab Program/ Data and Analysis & Lab Voce (50M) Signature
(10M) Procedure Results Inference (10M) (5M)
(5M) (10M) (10M)
1. Introductory Session -NA-
Tokenization_of_text #1
2.
Text_2_Sequences #2
3.
One_Hot_Encoding #3
4.
Vectorization_of_texts #4
5.
Databases_how_to_Use #5
6.
Parsing_nltk_toolbox #6
7.
TF_Testing_fail #7
8.
IDF_Why #8
9.
TFIDF_Vertorization #9
10.
TF_IDF_Failure_meaning #10
11.
Distance_Metrics #11
12
14. Document_recognition_tfidf_vectors
S.N Date Experiment Name Pre- In-Lab (25M) Post- Viva Total Faculty
o Lab Program/ Data and Analysis & Lab Voce (50M) Signature
(10M) Procedure Results Inference (10M) (5M)
(5M) (10M) (10M)
#13 (Adv/Peer)
Zipf's_Law_nlp #14 (Adv/Peer)
15.
Simple_topic_modelling_ex #15
16.
(Adv/Peer)
PCA_From_SCratch #16 (Adv/Peer)
17.
Singular_Value_Decomposition_SVD_Ex
18.
#17 (Adv/Peer)
Latent_Semantic_Analysis_SVD #18
19.
(Adv/Peer)
spam_dect_class #19 (Adv/Peer)
20.
Sentiment_Analysis_RNN #20
21
(Adv/Peer)
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>
Aim/Objective:
The aim is to compare and evaluate different tokenization techniques or libraries, such as NLTK,
SpaCy, and TensorFlow, to determine their effectiveness in handling various types of text data.
Description:
Tokenization is the 1st step in any NLP model. The experiment may aim to explore how tokenization
using NLTK, spaCy, and TensorFlow can be integrated into a broader NLP pipeline or used as a
preprocessing step for tasks such as sentiment analysis, machine translation, named entity
recognition, or text summarization. The focus is on understanding the impact of tokenization choices
on downstream model performance. The experiment may aim to analyze the performance
characteristics of tokenization using NLTK and TensorFlow.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
This Section must contain at least 5 Descriptive type questions or Self-Assessment Questions which
help the student to understand the Program/Experiment that must be performed in the Laboratory
Session.
2. How can you tokenize a sentence into individual words using NLTK?
5. How can you tokenize a text document into sentences using NLTK?
In-Lab:
1. Apply tokenization methods in the NLTK library on a 5-line text data available in NLTK.
2. Apply tokenization methods in the TF library on a 5-line text data available in NLTK.
3. Draw comparisons based on text handling capabilities.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
1. What is tokenization?
2. According to your exp which tokenizer API is the best?
3. How NLTK and TensorFlow handle tokenization for different languages.
4. List the Metrics used to Evaluate Tokenization Techniques.
5. Can you tokenize multiple text documents simultaneously using TensorFlow.
Course Title NATURAL LANGUAGE PROCESSING & ACADEMIC YEAR: 2023-24
APPLICATIONS
Course Code(s) 21EC4082, 21EC4082A, 21EC4082P Page 6 of 106
Experiment # <TO BE FILLED BY STUDENT> Student ID <TO BE FILLED BY STUDENT>
Date <TO BE FILLED BY STUDENT> Student Name <TO BE FILLED BY STUDENT>
Post-Lab:
1. Try tokenization in the spaCy library and compare with the NLTK and Tensorflow.
2. Try tokenization on big corpus dataset given below.
https://www.kaggle.com/datasets/thoughtvector/customer-support-on-twitter
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to evaluate different techniques or libraries, such as NLTK, SpaCy, and TensorFlow, to
determine their effectiveness in converting text to a sequence of numbers.
Description:
The objective of converting text to a sequence of numbers is a fundamental step in natural language
processing (NLP) tasks. The primary goal of this conversion is to represent textual data in a numerical
format that machine learning models can process effectively. To convert text to a numerical format
that enables the application of machine learning and NLP techniques.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
This Section must contain at least 5 Descriptive type questions or Self-Assessment Questions which
help the student to understand the Program/Experiment that must be performed in the Laboratory
Session.
3. Are all sentences in the text considered to have the same length? If No, What did you do.
In-Lab:
1. Apply tokenization and convert a sequence of sentences in the NLTK library to a sequence of
numbers.
2. Convert a 10-sentence dataset with multiple-length sentences into a number array of equal
size for ML model training.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
Post-Lab:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to convert the text into numbers and eventually code those converted numbers into
encodings for downstream NLP tasks using NLTK, SpaCy, and TensorFlow.
Description:
One hot encoding of text data is a process of transforming categorical data, such as words or
symbols, into numerical data that can be used by machine learning models. It involves creating a
binary vector for each categorical value, where only one element is 1 and the rest are 0. The length
of the vector is equal to the number of unique categories in the data. One hot encoding allows the
representation of categorical data as multidimensional binary vectors that can be fed to models that
require numerical input.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
This Section must contain at least 5 Descriptive type questions or Self-Assessment Questions which
help the student to understand the Program/Experiment that must be performed in the Laboratory
Session.
3. Are all sentences in the text considered to have the same length? If No, what did you do.
In-Lab:
1. Apply One Hot Encodings and convert a sequence of sentences in the NLTK library to a
sequence of numbers and then OHE.
2. Convert a 10-sentence dataset with multiple-length sentences into a OHE array of equal size
for ML model training.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
Post-Lab:
1. Try using OHE data for training a simple neural network model.
2. Try text to OHE on big corpus dataset given below and train a ANN model.
https://www.kaggle.com/datasets/thoughtvector/customer-support-on-twitter
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to convert text into vectors by computing term frequencies and create a corpus.
Description:
The objective of converting text to a sequence of numbers using TF vectorizer function. The primary
goal of this conversion is to represent textual data in a numerical format that machine learning
models can process effectively. To convert text to a numerical format that enables the application of
machine learning and NLP techniques.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
This Section must contain at least 5 Descriptive type questions or Self-Assessment Questions which
help the student to understand the Program/Experiment that must be performed in the Laboratory
Session.
In-Lab:
1. Apply tokenization and convert a sequence of sentences in the NLTK library to a sequence of
numbers. Use those sequences and calculate term frequencies for representing text data on
a small corpus.
2. Convert a 10-sentence dataset with multiple-length sentences into TF representations and
compare them with OHE.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
Post-Lab:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to use the online resources of text data to test NLP applications.
Description:
A text corpus is a large and structured collection of texts, typically stored in a digital format, that
serves as a linguistic resource for language analysis and research. It consists of a diverse range of
written or spoken texts from various sources and domains, such as books, articles, newspapers,
websites, social media, conversations, and more.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
1. How can I create a text corpus from a collection of documents using Python?
2. What Python libraries can I use to tokenize and preprocess text data for corpus creation?
3. How can I handle different file formats (e.g., PDF, Word documents) when building a text
corpus in Python?
4. What are the steps involved in cleaning and preprocessing text data for corpus creation?
5. How can I remove stopwords and punctuation from text documents when creating a corpus
in Python?
In-Lab:
1. From NLTK library, download and apply wordnet package of built-in corpus. Extract the
requirements of a text dataset and tokenize the text.
2. From spaCy, use en_core_web_sm (English Small) corpus and tokenize this text.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
Post-Lab:
1. Try to encode the wordnet text into TF vectors and OHE. Measure the corpus size occupied
by them in memory.
2. Try to find some text datasets available online and load into your current program.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to analyze the grammatical structure of sentences in natural language text data using
NLTK and spaCy.
Description:
To perform parsing in NLTK, you typically start by defining a grammar using CFG, then apply a
parsing algorithm to parse a sentence and obtain a parse tree or dependency tree representation.
NLTK provides functions and methods to assist in these tasks, such as nltk.CFG for defining CFG,
nltk.ChartParser for chart parsing, and nltk.DependencyParser for dependency parsing.By utilizing
NLTK's parsing capabilities, you can analyze sentence structure, extract syntactic information, and
facilitate further natural language understanding and processing tasks.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
1. What is parsing in natural language processing (NLP), and what is its goal?
2. Explain the concept of Context-Free Grammars (CFG) and their role in parsing.
1. Analyze the grammatical structure of sentences and extract syntactic information on small
text corpus to identify the performance of the libraries used in NLTK.
2. Show that the parser used in spaCy and NLTK libraries have the capability to extract
semantic information.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
Post-Lab:
1. Try parsing using context free grammar on wordnet text data in NLTK.
2. Try parsing on big corpus dataset given below.
https://www.kaggle.com/datasets/thoughtvector/customer-support-on-twitter
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to evaluate term frequency (TF) on large text corpuses note its breaking point.
Description:
TF = (Number of occurrences of the term in the document) / (Total number of terms in the
document)
The TF value reflects the relative importance or prevalence of a term within a specific document. It
helps to identify which terms are more frequently used and potentially carry more significance or
relevance in the context of that document. However, term frequency alone does not consider the
significance of the term in the overall corpus.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
3. How can you calculate the term frequency of a specific term in a document using NLTK?
4. How can you count the occurrences of a specific term in a list of tokens using NLTK?
5. How do you normalize the term frequency to account for the document length in NLTK?
In-Lab:
1. Compute TF vectors on large corpus in NLTK library and identify the reason why it cannot
capture the sematic information in the text data.
2. Investigate deeply the above process on a text corpus of your choice to arrive at the solution
in a faster way.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
Post-Lab:
1. Try to compare dimensionality of TF and OHE. Which is the best show through program.
2. Try to explain how TF fails on big corpus dataset given below.
https://www.kaggle.com/datasets/thoughtvector/customer-support-on-twitter
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to evaluate the importance of IDF as an alternative to TF, which is projected as an
information retrieval to quantify the importance or rarity of a term in a collection of documents.
Description:
The IDF of a term is calculated as the logarithm of the ratio between the total number of documents
in the collection and the number of documents that contain the term. The formula for IDF is as
follows:
IDF = log(N / DF), N: Total number of documents in the collection, DF: Number of documents that
contain the term. The IDF value increases as the term becomes less frequent in the document
collection. It helps to identify terms that are relatively rare and potentially carry more important or
distinctive information. Terms with higher IDF scores are considered to have more discriminative
power.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
3. How can you calculate IDF for a specific term using Python and a given collection of
documents?
5. Can you handle the presence of stop words during IDF calculations in NLTK?
In-Lab:
1. Compute IDF on small text data and show how IDF is better than TF in the context of text
discrimination in documents of a corpus.
2. Use wordnet dataset in NLTK and show how IDF beats TF as a text discriminator.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
Post-Lab:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to transform a collection of documents into a numerical representation with TF-IDF
vectors.
Description:
The TF-IDF value is computed by multiplying the term frequency (TF) of a term in a document by the
inverse document frequency (IDF) of the term. Each document is represented as a vector, where
each dimension corresponds to a unique term in the collection. The TF-IDF value for each term in the
document becomes the value of the corresponding dimension in the vector.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
This Section must contain at least 5 Descriptive type questions or Self-Assessment Questions which
help the student to understand the Program/Experiment that must be performed in the Laboratory
Session.
In-Lab:
1. Apply TF-IDF vectorization model in NLTK on a small set of text data and show the
representation is better than TF and IDF.
2. Convert the NLTK wordnet corpus into a TF-IDF data representaiton.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
2. According to you explain the concept of term weighting and its role in TF-IDF calculations.
3. Which Python libraries or modules can be used to perform TF-IDF calculations.
4. List the Metrics used to Evaluate TF-IDF vectors.
5. Can you handle stop words or common words when computing TF-IDF using Python.
Post-Lab:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.
Aim/Objective:
The aim is to evaluate the reason for failure of TF-IDF vectors and estimate the meaning of failure
to represent the text data in terms of semantics, context extraction and corpus size.
Description:
TF-IDF does not capture the semantic meaning of words or the context in which they are used. It
treats each term independently, without considering their relationships within the document or
across the collection. This can lead to issues when dealing with tasks that require a deeper
understanding of language, such as sentiment analysis or question-answering. TF-IDF is influenced
by document length, as longer documents generally have higher term frequencies. This bias can
result in longer documents dominating the similarity or importance measures, overshadowing
shorter and potentially relevant documents. TF-IDF treats documents as bags of words, disregarding
the order and context in which the words appear. This can be problematic in tasks like text
generation or language translation, where word order and context play a crucial role.
Pre-Requisites:
1. https://pip.pypa.io/en/stable/installation/
2. https://packaging.python.org/en/latest/tutorials/installing-packages/
3. https://pypi.org/project/nltk/
4.
https://www.tensorflow.org/install/pip
5.
https://spacy.io/usage
6. https://pypi.org/project/gensim/
Pre-Lab:
1. Apply TF-IDF and evaluate the vectors to check their failure related to context and semantic
representation.
2. Show the reason for failure of TF-IDF on large datasets such as wordnet in nltk.
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data
Post-Lab:
1. Try normalization of converted TF-IDF vectors from text data and does they still fail.
2. Try TF-IDF on big corpus dataset given below and use ANN for classification.
https://www.kaggle.com/datasets/thoughtvector/customer-support-on-twitter
Procedure/Program:
This Section is meant for the student to Write the program/Procedure for the Experiment
This Section is meant for the students to collect, record the results generated during the
Program/Experiment execution. Include instructions on how to present the results, such as creating
tables, graphs, or visualizations.
This Section is meant for the students to analyse their data, perform calculations Include
questions or prompts to encourage critical thinking and interpretation of the data.
Evaluator MUST ask Viva-voce prior to signing and posting marks for each experiment.