Đề Thi PE NLP301c - SP26 - NO2 - PE - RE

adminadmin is verified member.

Member
Thành viên BQT
Administrator
Học kỳ
SP2026
Thời Gian
3/5/26
Loại tài liệu
PE
NLP301c SP26 NO2 PE RE

NLP301c PE INSTRUCTIONS

Student preparation:
  • Before proceeding, install Python 3.8 or higher.



  • Install NLTK (nltk-3.6.2), downloadable from
    You do not have permission to view link Đăng nhập hoặc Đăng ký.






  • Run cmd with administrator role, change the current path in prompt to the nltk-3.6.2 folder, and type the following command to set up: python setup.py install





  • Once installed, start up the Python interpreter and install the data required for the book by typing:




    Python

    <span>&gt;&gt;&gt; </span><span>import</span> nltk<br><span>&gt;&gt;&gt; </span>nltk.download()<br>
  • In the NLTK Downloader, select the 'book' collection and ensure it is fully installed.



Instructions for completing PE:






  • For submission: Create a folder named in the format: YourName YourRollNumber NLP301c





  • Example: Nguyễn Thế Hùng with roll number SE09234 will submit: HungNT SE09234 NLP301c





  • Create separate files named Q1.py, Q2.py, Q3.py, Q4.py and place them in the folder.



  • Submit the folder to the server. Incorrect submissions will receive a ZERO.





Question 1: (2 marks)






  • Task: Write a program to count how many words in a customer feedback contain all lowercase letters only.



  • Input: A string containing the feedback text.



  • Desired Output: An integer representing the number of words written entirely in lowercase.



  • Example:
    • Input: "This product is amazing and works Perfectly."
    • Output: 5




Question 2: (2 marks)






  • Task: Write a program to remove all consecutive duplicate characters from a chatbot message.



  • Requirements:
    • Case-sensitive.



    • Only remove consecutive duplicates (not all duplicates).


  • Input: A string containing chatbot text.



  • Desired Output: A cleaned string.



  • Example:
    • Input: "heyyy!!! I loooove NLP"
    • Output: "hey! I love NLP"




Question 3: (3 marks)






  • Task: Write a program to extract all valid job titles from a recruitment post.



  • A valid job title must meet these criteria:
    1. Starts with an uppercase letter.



    2. Contains only letters and spaces.



    3. Must be at least 2 words long.


  • Input: A string containing a job posting.



  • Desired Output: A list of job titles in order of appearance.



  • Example:
    • Input: "We are hiring Data Scientist and Software Engineer. Join our team as a Junior Developer!"
    • Output: ['Data Scientist', 'Software Engineer', 'Junior Developer']




Question 4: (3 marks)






  • Task: Write a program to process social media captions and return the longest word in each sentence.



  • Rules:
    1. Sentences are separated by ., !, ?





    2. Ignore punctuation.



    3. If multiple longest words exist, return the first one.


  • Input: A paragraph string.



  • Desired Output: A list of longest words (one per sentence).



  • Example:
    • Input: "AI is transforming industries. NLP is very powerful!"
    • Output: ['transforming', 'powerful']




 

Đính kèm

  • NLP301c SP26 NO2 PE RE_001.webp
    NLP301c SP26 NO2 PE RE_001.webp
    76 KB · Lượt xem: 1
  • NLP301c SP26 NO2 PE RE_002.webp
    NLP301c SP26 NO2 PE RE_002.webp
    68.2 KB · Lượt xem: 1
  • NLP301c SP26 NO2 PE RE_003.webp
    NLP301c SP26 NO2 PE RE_003.webp
    25.1 KB · Lượt xem: 1

Tạo tài khoản hoặc đăng nhập để bình luận

Bạn phải là thành viên mới có thể bình luận.

Tạo tài khoản

Hãy tạo tài khoản trên cộng đồng của chúng tôi. Thật dễ dàng!

Đăng nhập

Bạn đã có tài khoản? Đăng nhập tại đây.

Back
Top