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 587219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:11:23+00:00 2026-05-13T15:11:23+00:00

I am seeking direction and attempting to label this problem: I am attempting to

  • 0

I am seeking direction and attempting to label this problem:

I am attempting to build a simple inference engine (is there a better name?) in Python which will take a string and –

1 – create a list of tokens by simply creating a list of white space separated values

2 – categorise these tokens, using regular expressions

3 – Use a higher level set of rules to make decisions based on the categorisations

Example:

“90001” – one token, matches the zipcode regex, a rule exists for a string containing just a zipcode causes a certain behaviour to occur

“30 + 14” – three tokens, regexs for numerical value and mathematical operators match, a rule exists for a numerical value followed by a mathematical operator followed by another numerical value causes a certain behaviour to occur

I’m struggling with how best to do step #3, the higher level set of rules. I’m sure that some framework must exist. Any ideas? Also, how would you characterise this problem? Rule based system, expert system, inference engine, something else?

Thanks!

  • 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-13T15:11:23+00:00Added an answer on May 13, 2026 at 3:11 pm

    I’m very surprised that step #3 is the one giving you trouble…

    Assuming you can label/categorize properly each token (and that prior to categorization you can find the proper tokens, as there may be many ambiguous cases…), the “Step #3” problem seems one that could easily be tackled with a context free grammar where each of the desired actions (such as ZIP code lookup or Mathematical expression calculation…) would be symbols with their production rule itself made of the possible token categories. To illustrate this in BNF notation, we could have something like

    <SimpleMathOperation> ::= <NumericalValue><Operator><NumericalValue>
    

    Maybe your concern is that when things get complicated, it will become difficult to express the whole requirement in terms of non-conflicting grammar rules. Or maybe your concern is that one could add rules dynamically, hence forcing the grammar “compilation” logic to be integrated with the program ? Whatever the concern, I think that this 3rd step will comparatively be trivial.

    On the other hand, and unless the various categories (and underlying input text) are such that they can be described with a regular language as well (as you seem to hint in the question), a text parser and classifier (Steps #1 and #2…) is typically a less than trivial affair..

    Some example Python libraries that simplify writing and evaluating grammars:

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

Sidebar

Related Questions

I'm seeking a solution to splitting a string which contains text in the following
I am seeking to use ViewPager 's getCurrentItem() method I've encountered this issue before
stuck at this, seeking advice. What i did and my Project: i make a
I am seeking pointers to assist the direction of my research into providing assessements
Seeking your help to get off .epub(s) sea in iPhone world... I am trying
Seeking help to design a layout as shown here: http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185MTd0eGdyZmc&hl=en The major challenge I
Seeking means to get Fabric to automatically (instead of user-interactively) interact with shell commands
Just seeking confirmation here : apache Thrift protocol does not seem to support running
I'm seeking a library, technique or advice on how to read an EAN-13 barcode
I'm seeking further clarification after seeing What is responsible for releasing NSWindowController objects? I'm

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.