NLP:
NLP is like a bridge that helps computes understanding our human language
it acts as a translator
[Link] text and understand meaning
[Link] text and understand meaning
[Link] language
[Link] questions
[Link] human like text
preprocessing steps:
[Link] case:
makes everything lowercase or uppercase ,mixed cases like "happy" and "HAPPY"
confuse the machine
[Link] thml tags:
if u scrape text from websites ,u get junk like <,>, these confuse the machine
[Link] ulrs:
links like http and etc ..it confuse the machine
[Link] emojis:
emojis can mess things up,if they dont matter remove if they carry meaning ,replace
with words
eg: simile emoji , with smile word
[Link] special characters and punctuations:
dump symbols like #,%,$,&, they are not needed for understanding
6. remove stop words:
these words like i , am , the , they don't add much meaning ,they are useless words
for sentimental analysis
[Link] spellings:
fix the spelling to keep text clean
#Tokenization
we convert the text or like into smaller bits , called tokens
words tokenization :splits text into words
example :hello , i am learning NLP
break text into words or sentences
words tokenization :'hello' ,' ', 'I' ,'learning' , ',' ,'NLP'
sentence tokenization: 'hello' , i am learning NLP ","
tokenization helps break text into sentence
#stemming:
we simplify word to their root form ,by cutting off prefixes and suffixes this is
called stemming
what it does : removes stuff like ,"ing" , "ly"
example :
running - run
fasting - fast
studies - study
happily - happili
problem : it just chops off ends , doesn't always give the real dictionary root
word ,like happili isn't happy
lemmatization :
this is better than stemming , it turns words into their true dictionary root form
what it does : checks a dictionary to find the right root
example :
studying - study
#happily - happy
more accurate becoz it uses real words from a dictionary
#words embeddings:
converting of text data into numerical with meanings
word embedding turn words into numbers vectors
what are they: vectors of numbers representing words could be 3d 123 or 6d 123456
three methods:
[Link] hot encoding ; each word get a unique vector , like
I - [1,0,0] , am - [0,1,0] ,simple but does not show how relate
[Link] of words : counts hoe many times words appear in a sentence
example :
I love coding , coding is fun , i love it ;
what it does : coding, fun, i, is, love
3. TF_IDF (Term Frequency -Inverse Document Frequency):
its smarter than bag of words , weigh words by importance
TF- how often a word appears in a sentence
IDF - how rare it is across all sentences
TF-IDF = TF*IDF
RNN-RECURRENT NEURAL NETWORKS
DEFINATION:
-RNN is a neural network used to handle sequence data
-data in order like sentences or time series
USES:
processes sequences while remembering past info good for short predictions
saves entire document as 1 and give output
EX-
i am happy
read 'i' -store this info
read 'am' - mix with previous info
read 'happy' - mix with all previous info and gives the output as negative or
positive
problems:
[Link] gradient
during training the network learns by updating weights ,it uses something called a
gradient, its a slope that shows which direction to change. But sometimes this
gradient get smaller and smaller until its basically 0.
[Link] the gradient
the gradient get huge instead of tiny, this makes training unstable and
unpredictable .
[Link](LONG TERM MEMORY):
WHAT IT DOES-
adds a memory cell(extra storage)
uses three gates to control information
[Link] gate :decides what to throw away
[Link] gate: decides what to add
[Link] gate: decides what to share
it remembers important stuff and forgets noise works great for long text
GRU(GRADIENT RECURRENT UNIT):
WHAT IT DOES-
like LSTM but simpler
uses only two gates instead of three
[Link] gate: decides what to keep and change
[Link] gate: decides what to forget
does the same job as LSTM but fater and uses less memory
before 2014 we use LSTM
after 2014 GRU because we have less gate and faster then LSTM