Professional Documents
Culture Documents
Assignment-01 NLP
Assignment-01 NLP
EXAMPLE 1
Sentences in the following examples are given below: -
• D1 - Tom waited for the train
• D2 - The train was late
• D3 - Jerry took the bus
• D4 - The train leaves in ten minutes
• D5 - Tom and Jerry enjoy traveling
• Query: Who waited for the train?
After removing the stop words from the above documents, the modified
documents are as follows:
• D1 – Tom waited train
• D2 – train late
• D3 – Jerry took bus
• D4 – train leaves ten minutes
• D5 - Tom Jerry enjoy traveling
• Query: waited train
TF – IDF TABLE:
Words TF IDF TF * IDF
D1 D2 D3 D4 D5 D1 D2 D3 D4 D5
Tom 0.33 0 0 0 0.25 0.398 0.13134 0 0 0 0.0995
Waited 0.33 0 0 0 0 0.699 0.23067 0 0 0 0
Train 0.33 0.5 0 0.25 0 0.222 0.07326 0.111 0 0.0555 0
Late 0 0.5 0 0 0 0.699 0 0.3495 0 0 0
Jerry 0 0 0.33 0 0.25 0.398 0 0 0.13134 0 0.0995
Took 0 0 0.33 0 0 0.699 0 0 0.23067 0 0
Bus 0 0 0.33 0 0 0.699 0 0 0.23067 0 0
Leaves 0 0 0 0.25 0 0.699 0 0 0 0.17475 0
Ten 0 0 0 0.25 0 0.699 0 0 0 0.17475 0
Minutes 0 0 0 0.25 0 0.699 0 0 0 0.17475 0
Enjoy 0 0 0 0 0.25 0.699 0 0 0 0 0.17475
traveling 0 0 0 0 0.25 0.699 0 0 0 0 0.17475
Q * (TF * IDF)
Words Q D1 D2 D3 D4 D5
Tom 0 0 0 0 0 0
Waited 1 0.23067 0 0 0 0
Train 1 0.07326 0.111 0 0.0555 0
Late 0 0 0 0 0 0
Jerry 0 0 0 0 0 0
Took 0 0 0 0 0 0
Bus 0 0 0 0 0 0
Leaves 0 0 0 0 0 0
Ten 0 0 0 0 0 0
Minutes 0 0 0 0 0 0
Enjoy 0 0 0 0 0 0
traveling 0 0 0 0 0 0
TOTAL 0.30393 0.111 0 0.0555 0