Interview Query

Term Frequency

Have you seen this question before?

Say you are given a text document in the form of a string with the following sentences:



document = "I have a nice car with a nice tires"


"car": 0.11,

Write a program in python to determine the TF (term_frequency) values for each term of this document.

Note: Round the term frequency to 2 decimal points.

Next question: Ranking Metrics
Python 3.9.6
Loading editor
Use Shift + Enter to run code