ePrefixMatch = (1 << 0),
77eSuffixMatch = (1 << 1),
78eWholeWordMatch = (ePrefixMatch | eSuffixMatch)
92 unsigned intwhole_word = eSubstrMatch);
109 const string& word_delimeters,
111 boolinvert_delimiters =
false);
121 voidSetWordDelimiters(
const string& word_delimeters,
122 boolinvert_delimiters =
false);
129 voidAddDelimiters(
const string& word_delimeters);
136 voidAddDelimiters(
charch);
140 voidInitCommonDelimiters();
149m_WholeWord = whole_word;
163 returnSearch(
text.c_str(), pos,
text.length());
190 boolIsWholeWord(
const char*
text,
194 voidx_InitPattern(
void);
212 template<
typenameMatchType>
333 template<
typenameMatchType>
335m_Primed(
false), m_CaseSensitive(case_sensitive)
342 template<
typenameMatchType>
346 if( !m_CaseSensitive ) {
352word_len = (
int)temp.length();
355 for(
i= 0;
i< word_len; ++
i) {
356 next= m_States[
state].GetNextState(temp[
i]);
357 if(
next== eFailState )
break;
362 for( ;
i< word_len; ++
i) {
365m_States.push_back(new_state);
375 template<
typenameMatchType>
378 if( m_Primed )
return;
386 template<
typenameMatchType>
389 if(
size_t(
state) >= m_States.size() ) {
392 return&(m_States[
state]);
396 template<
typenameMatchType>
403 template<
typenameMatchType>
406 if(
size_t(
state) >= m_States.size() ) {
411 intinitial = GetInitialState();
412 while( (
next= GetNextState(m_States[
state],
letter)) == eFailState ) {
413 if(
state== initial ) {
424 template<
typenameMatchType>
431in_queue [qbeg] =
val;
433 for( ; in_queue [q] != 0; q = in_queue [q])
continue;
436in_queue [
val] = 0;
440 template<
typenameMatchType>
444vector<int> state_queue(m_States.size());
453m_States[GetInitialState()].GetTransitions() ) {
455m_States[s].SetOnFailure(0);
456QueueAdd(state_queue, qbeg, s);
459 while(state_queue [qbeg] != 0) {
460 r= state_queue [qbeg];
466m_States[
r].GetTransitions() ) {
468QueueAdd(state_queue, qbeg, s);
481 state= m_States[
r].GetOnFailure();
482FindFail(
state, s, it->first);
488 template<
typenameMatchType>
495 while( (
next= GetNextState(
state, ch)) == eFailState) {
504m_States[new_state].SetOnFailure(
next);
508 copy( m_States[
next].GetMatches().begin(),
509m_States[
next].GetMatches().end(),
510back_inserter(m_States[new_state].GetMatches()) );
514 template<
typenameMatchType>
516 returnm_States[
state].GetMatches();
520 template<
typenameMatchType>
523 returnm_States[
state].IsMatchFound();
527 template<
typenameMatchType>
This implemetation uses the Boyer-Moore alg.
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
Include a standard set of the NCBI C++ Toolkit most basic headers.
The NCBI C++ standard methods for dealing with std::string.
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
void FindFail(int state, int new_state, char ch)
void AddWord(const string &word, const MatchType &match)
NStr::ECase m_CaseSensitive
vector< MatchType > & GetMatches(void)
vector< CState > m_States
void QueueAdd(vector< int > &in_queue, int qbeg, int val)
int GetNextState(int state, char letter) const
TMapCharInt m_Transitions
int GetOnFailure(void) const
const TMapCharInt & GetTransitions(void) const
void AddWord(const string &word)
const vector< MatchType > & GetMatches(void) const
void SetOnFailure(int state)
CTextFsa(bool case_sensitive=false)
const vector< MatchType > & GetMatches(int state) const
CTextFsm(bool case_sensitive=false)
void SetWordMatching(unsigned int whole_word=eWholeWordMatch)
Set word matching mode.
int GetNextState(char letter) const
bool IsMatchFound(void) const
bool IsMatchFound(int state) const
map< char, int > TMapCharInt
void AddMatch(const MatchType &match)
vector< MatchType > m_Matches
void AddTransition(char letter, int to)
CState * GetState(int state)
bool IsPrimed(void) const
int GetInitialState(void) const
vector< size_t > m_LastOccurrence
vector< unsigned char > m_WordDelimiters
static const int sm_AlphabetSize
int GetNextState(const CState &from, char letter) const
size_t Search(const string &text, size_t pos=0) const
Search for the pattern over text starting at position pos.
NCBI_NS_STD::string::size_type SIZE_TYPE
ECase
Which type of string comparison.
static string & ToUpper(string &str)
Convert string to upper case â string& version.
@ eNocase
Case insensitive compare.
unsigned int
A callback function used to compare two keys in a database.
static void text(MDB_val *v)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
NCBI_XUTIL_EXPORT
Parameter to control printing diagnostic message about conversion of static array data from a differe...
static Uint4 letter(char c)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4