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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:21:44+00:00 2026-06-12T04:21:44+00:00

Setup: 1) a string trie database formed from linked nodes and a vector array

  • 0

Setup: 1) a string trie database formed from linked nodes and a vector array linking to the next node terminating in a leaf, 2) a recursive regular expression function that if A) char ‘*’ continues down all paths until string length limit is reached, then continues down remaining string paths if valid, and B) char ‘?’ continues down all paths for 1 char and then continues down remaining string paths if valid. 3) after reg expression the candidate strings are measured for edit distance against the ‘try’ string.

Problem: the reg expression works fine for adding chars or swapping ? for a char but if the remaining string has an error then there is not a valid path to a terminating leaf; making the matching function redundant. I tried adding a ‘step-over’ ? char if the end of the node vector was reached and then followed every path of that node – allowing this step-over only once; resulted in a memory exception; I cannot find logically why it is accessing the vector out of range – bactracking?

Questions: 1) how can the regular expression step over an invalid char and continue with the path? 2) why is swapping the ‘sticking’ char for ‘?’ resulting in an overflow?

Function:

void Ontology::matchRegExpHelper(nodeT *w, string inWild, Set<string> &matchSet, string out, int level, int pos, int stepover)
{   
    if (inWild=="") {
        matchSet.add(out);
    } else {
        if (w->alpha.size() == pos) {
            int testLength = out.length() + inWild.length(); 
            if (stepover == 0 && matchSet.size() == 0 && out.length() > 8 && testLength == tokenLength) {//candidate generator
                inWild[0] = '?';
                matchRegExpHelper(w, inWild,  matchSet, out, level, 0, stepover+1);
            } else 
                return; //giveup on this path
        }
        if (inWild[0] == '?' || (inWild[0] == '*' && (out.length() + inWild.length() ) == level ) ) { //wild
            matchRegExpHelper(w->alpha[pos].next, inWild.substr(1), matchSet, out+w->alpha[pos].letter, level, 0, stepover);//follow path -> if ontology is full, treat '*' like a '?'
        } else if (inWild[0] == '*')
            matchRegExpHelper(w->alpha[pos].next, '*'+inWild.substr(1), matchSet, out+w->alpha[pos].letter, level, 0, stepover); //keep adding chars
        if (inWild[0] == w->alpha[pos].letter) //follow self
            matchRegExpHelper(w->alpha[pos].next, inWild.substr(1), matchSet, out+w->alpha[pos].letter, level, 0, stepover); //follow char 
        matchRegExpHelper(w, inWild, matchSet, out, level, pos+1, stepover);//check next path
    }
}

Error Message:

+str    "Attempt to access index 1 in a vector of size 1." std::basic_string<char,std::char_traits<char>,std::allocator<char> >
+err    {msg="Attempt to access index 1 in a vector of size 1." } ErrorException

Note: this function works fine for hundreds of test strings with ‘*’ wilds if the extra stepover gate is not used

Semi-Solved: I place a pos < w->alpha.size() condition on each path that calls w->alpha[pos]... – this prevented the backtrack calls from attempting to access the vector with an out of bounds index value. Still have other issues to work out – it loops infinitely adding the ? and backtracking to remove it, then repeat. But, moving forward now.

Revised question: why during backtracking is the position index accumulating and/or not deincrementing – so at somepoint it calls w->alpha[pos]... with an invalid position that is either remaining from the next node or somehow incremented pos+1 when passing upward?

  • 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-12T04:21:45+00:00Added an answer on June 12, 2026 at 4:21 am

    SOLVED: combine the regular expression wilds function as loops in the matching function

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

Sidebar

Related Questions

In my current setup, I have a typedef std::function<void (MyClass&, std::vector<std::string>) MyFunction; std::map<std::string, MyFunction>
we have the following setup: We have a array of objects with a string
I have a recursive function that parses a trie string database replacing with all
Setup Mac OSX 10.6.7, Eclipse, Tomcat 1.6 I am trying to call a string
If I have a simple class setup like this: class MyClass { private string
I'm using the following setup: public MySQLProcessWriter(Connection con) throws SQLException { String returnNames[] =
Hi I'm trying to setup a RegexpValidator that only accepts a string of alphanumeric
Lets say there is setup like this: public class MyClass { public void DoSomething(string
I have the following setup: Class A property x as string property y as
Using Glassfish, I can setup a string jndi entry: JNDI name: com/xyzcompany/echo/EchoServiceBean/viewName Factory Class:

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.