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

  • SEARCH
  • Home
  • 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 6827265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:14:44+00:00 2026-05-26T22:14:44+00:00

Hopefully this makes sense. I have a php script, magpierss, that parses a RSS

  • 0

Hopefully this makes sense. I have a php script, magpierss, that parses a RSS feed and inserts the data into MySql and it works fine. I get the various parts of the RSS items into variables to make them easier to work with, so getting the pieces of the rss feed is not a problem.

However, my goal is to be able to have it filter the stories and only import certain ones. I want to automate this as much as possible, with some allowance for false positives/negatives because they will be manually verified after.

What I want to be able to do is set a list of keywords and ‘weights’ for each word. So when a new RSS item is parsed the script will create a ‘score’ based on the weights of the words in the description field.

For example:

stackoverflow = 10
very = 7
helpful = 8

So “stackoverflow very helpful” would get a score of 25

and also “stackoverflow is always very helpful” would still get a score of 25, because ‘is’ and ‘always’ are not keywords with weights assigned to them.

and “something random here” would get a score of 0, for having no keywords.

Then I could play with keyword weights and scores to figure out the best settings for filtering the rss feed.

Most of this I can figure out. I just need to know a way to parse the description of the item, and assign weights to specified keywords to create a ‘score’.

  • 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-05-26T22:14:45+00:00Added an answer on May 26, 2026 at 10:14 pm

    PHP comes with some functions that would help, such as strpos() and preg_match. The former would search for a specific string, and preg_match would search for regular expressions. You should create an array of the keywords and their weights, then run through each one and check to see if the description contains that value. If so, you increment a weight counter. Here’s a simple example:

    $keywords = array(
       'stackoverflow' => 10,
       'very' => 7,
       'helpful' => 8
    );
    $description = $feed->getDescription(); // or wherever
    $total_weight = 0;
    foreach ($keywords as $keyword => $weight) {
      if (strpos($keyword, $description))
          $total_weight += $weight;
    }
    return $total_weight; // total weight of this item
    

    Something like that anyway. There are other ways to do it, but this should get you started.

    Good luck.

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

Sidebar

Related Questions

Ok, so that title probably doesn't explain my question well. Hopefully this makes sense.
This is driving me crazy. Hopefully my question makes sense... I'm using MVC 2
I'm very new to PyQt and Python, so hopefully this question makes sense. I
Hopefully this explanation will make sense, but what is the best way (if it
Hopefully this is simple: I have a relatively long list where each list item
Hopefully this question isn't as subjective as I think it may be. I have
Hopefully this is less complex than I think. I have one table of companies,
I have a stored procedure that uses this select statement: SELECT dbo.VendorProgram.id, dbo.VendorProgram.CODE, dbo.Programs.ProgramName
I have 4 input fields that when numbers are entered into one of the
hopefully this doesn't sound ridiculous, but are some parts of the web.config not required

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.