Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8750469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:52:09+00:00 2026-06-13T12:52:09+00:00

Is there a way (Pattern or Python or NLTK, etc) to detect of a

  • 0

Is there a way (Pattern or Python or NLTK, etc) to detect of a sentence has a list of words in it.

i.e.

The cat ran into the hat, box, and house. | The list would be hat, box, and house

This could be string processed but we may have more generic lists:

i.e.

The cat likes to run outside, run inside, or jump up the stairs. |

List=run outside, run inside, or jump up the stairs.

This could be in the middle of a paragraph or the end of the sentence which further complicates things.

I’ve been working with Pattern for python for awhile and I’m not seeing a way to go about this and was curious if there is a way with pattern or nltk (natural language tool kit).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:52:10+00:00Added an answer on June 13, 2026 at 12:52 pm

    What about using from nltk.tokenize import sent_tokenize ?

    sent_tokenize("Hello SF Python. This is NLTK.")
    ["Hello SF Python.", "This is NLTK."]
    

    Then you can use that list of sentences in this way:

    for sentence in my_list:
      # test if this sentence contains the words you want
      # using all() method 
    

    More info here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making my way into using Event Sourcing pattern, and there is one thing
Is there way to better identify design pattern in source codes, esp. if you
Is there a way to look for a pattern in aspx/ascx files and replace
Is there a way to match a pattern ( e\d\d ) several times, capturing
In a replacement pattern, is there any way to print the NUMBER of the
Is there a way to obtain patterns in one file (a list of patterns)
Is there way to copy a file into Plone with WebDAV and have Plone
I want to implement the decorator pattern in Python, and I wondered if there
Is there some way to make boost::python control the Python GIL for every interaction
Is there a way to detect when a window that doesn't belong to my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.