473,320 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What is the best way to qualify text from logic code?

VvDtSsCoder
I'm using Python 3.8 but the language doesn't matter here. I just need to work out the logic.
Txt = (a paragraph or so of text)
Code (a string): (desert or sweets not (cookies or cake or candy) and sprinkles) near3near (ice_cream or sherbet or frozen_yogurt not spaghetti) and dinner near3 (meat_loaf or steak or pasta not (fish or crabs or clams))

The code is an example. It could be anything using the rules as described below.
The word near3 means the word (or paren) before near3 must be at most 3 words before the word (or paren) after the number 3. near3near is the same but it can be before or after the word after near3near. The number for near can be any integer below 10.
Parens represent priority just like math. Inner most calculated first. The operators are and, or and not.

What is the best way to programmatically determine whether or not Txt meets the requirements set in Code?
Feb 4 '22 #1
1 5026
dev7060
633 Expert 512MB
I'm using Python 3.8 but the language doesn't matter here. I just need to work out the logic.
Txt = (a paragraph or so of text)
Code (a string): (desert or sweets not (cookies or cake or candy) and sprinkles) near3near (ice_cream or sherbet or frozen_yogurt not spaghetti) and dinner near3 (meat_loaf or steak or pasta not (fish or crabs or clams))

The code is an example. It could be anything using the rules as described below.
The word near3 means the word (or paren) before near3 must be at most 3 words before the word (or paren) after the number 3. near3near is the same but it can be before or after the word after near3near. The number for near can be any integer below 10.
Parens represent priority just like math. Inner most calculated first. The operators are and, or and not.

What is the best way to programmatically determine whether or not Txt meets the requirements set in Code?
What have you done so far?
Feb 12 '22 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Niklaus | last post by:
Hi, Can someone point out what is wrong with this code ? How can i make it better optimize it. When run it gives me seg fault in linux. But windows it works fine(runs for a long time). Do we...
0
by: Michael Rogers | last post by:
I wrote a simple file transfer, but it doesn't work! When I try to open the transferred file it says: "The end of file cropped" or "the file header cropped". what's wrong with this code? IS there a...
2
by: VB Programmer | last post by:
What do you think is the best rich text editor for ASP.NET? Full editing capabilities preferred, including ability to insert images, hyperlinks, tables, etc... Do any of these allow database...
6
by: Lelle | last post by:
Hello ! how can i insert text containg code examples from a textbox into a database using SQL insert statment. i have no problem to just add text that dont contains code and script examples...
4
by: xenophon | last post by:
I have a class that is used in an ASP.NET app, a WinForms app, and a Win32 Service. What is the best way to tell what environment the code is currently instanced in? Thanks.
6
by: doncee | last post by:
This is the set up: is a date field on a form. Its control source is the field "date_entered" in"Table1". If there is a date showing in the date_entered field (Text6) & the status in Combo box2...
3
by: shapper | last post by:
Hello, I need to loop though each row in a GridView and if the checkbox is a Template Field is checked I want to display the value of an invisible column named "LevelName". I tried everything...
2
by: Matt B | last post by:
This seems like it has probably been covered many times before, but I'm having a hard time finding any discussion about it (probably just searching the wrong terms). Is there a way to capture...
3
by: rayda | last post by:
i was doing a an ASP.net web page with vb. i m putting the login and sign up form in the same web page. i tried the sign up form. after i filled up all the required fields, when i press the Enter...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.