NLP301_-_PE2_-_SU_2023_663.webp
C

NLP301_-_PE2_-_SU_2023_663.webp

  • Media owner cute_cat
  • Ngày thêm
Define a function percent(word, text) that calculates how often a given word occurs in a text and expresses the result as a percentage.
Question 2: (2 marks)
Write a Python NLTK program to split all punctuation into separate tokens.
Sample Output:
Original string:
Reset your password if you just can't remember your old one.
Split all punctuation into separate tokens:
['Reset', 'your', 'password', 'if', 'you', 'just', 'can', """, 't', 'remember', 'your', 'old', 'one', '']
Question 3: (3 marks)
Write a program to find all words with number of the letters less than 4 in the given text.With the help of a frequency distribution (FreqDist), show these words in decreasing order of frequency.
Example:
Input:
'He would also attend the opening ceremony for the construction of the U.S.Embassy complex in Cau Giay District, as well as meeting students, teachers and scientists at the Hanoi University of Science and Technology'
Output:
['Cau', 'He', 'and', 'as', 'at', 'for', 'in', 'of', 'the']
+ 100%
Zoom

Close
Chưa có bình luận nào.

Thông tin

Category
NLP301c
Thêm bởi
cute_cat
Ngày thêm
Lượt xem
2,435
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
NLP301_-_PE2_-_SU_2023_663.webp
File size
58.4 KB
Dimensions
1552px x 660px

Share this media

Back
Bên trên Bottom