CN105868113A - Character string look-up method and device - Google Patents
Character string look-up method and device Download PDFInfo
- Publication number
- CN105868113A CN105868113A CN201610196564.6A CN201610196564A CN105868113A CN 105868113 A CN105868113 A CN 105868113A CN 201610196564 A CN201610196564 A CN 201610196564A CN 105868113 A CN105868113 A CN 105868113A
- Authority
- CN
- China
- Prior art keywords
- state
- sub
- string
- status word
- state machine
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3604—Software analysis for verifying properties of programs
- G06F11/3608—Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a character string look-up method and device, and belongs to the field of program development. The method comprises the steps that state machine configuration information is read, wherein the state configuration information comprises at least two sub-states, each sub-state is used for looking up a corresponding character string, and the character strings corresponding to at least two sub-states have a context relation; the target character string according with the predetermined contextual feature is looked up in a target text through a state machine according to the state machine configuration information. According to the method and device, the problems that a code style needs to be audited by a professional auditor, the audit efficiency is low, and the error rate is high are solved; the purpose that when the target character string with the complex contextual feature is looked up, only corresponding state machine configuration needs to be generated according to the target character string, and the state machine is indicated to automatically look up the target character string according to the state machine configuration, so that the look-up error rate is decreased while the look-up efficiency is improved.
Description
Technical field
The present embodiments relate to field of program development, particularly to a kind of string searching method and device.
Background technology
In program development process, in order to improve the readability of code and conveniently carry out follow-up code debugging, team
In each developer need to keep consistent code spice.
Such as, code debugging for convenience, in the code that developer writes, must wrap inside catch statement
The code that the function containing print log is corresponding, i.e. must comprise logth statement inside catch statement.Auditor
When auditing code spice, i.e. check in the catch statement of code whether comprise logth statement, and at catch
Determine when statement does not comprise logth statement that this catch statement does not meets code spice, and be identified.
During realizing the present invention, inventor finds that prior art at least there is problems in that code wind
Lattice need to be audited by special auditor, and review efficiency is relatively low and error rate is higher.
Summary of the invention
Need to be audited by special auditor to solve code spice in prior art, review efficiency
The problem that relatively low and error rate is higher, embodiments provides a kind of string searching method and device.
Described technical scheme is as follows:
First aspect according to embodiments of the present invention, it is provided that a kind of string searching method, described method includes:
Reading state machine configuration information, state machine configuration information includes the sub-state of at least two, every sub-shape
State is used for searching each self-corresponding character string, and at least exists and have between two character strings corresponding to sub-states
Context relation;
Use state machine to search in target text according to state machine configuration information and meet intended context feature
Target string.
Two aspects according to embodiments of the present invention, it is provided that a kind of string searching device, described device includes:
Read module, for reading state machine configuration information, state machine configuration information includes at least two
State, every sub-state is used for searching each self-corresponding character string, and it is corresponding at least to there are two sub-states
There is between character string context relation;
Search module, be used for using state machine search in target text according to state machine configuration information meet pre-
Determine the target string of contextual feature.
Configured by reading state machine, and utilization state machine configures, according to this state machine, the word that neutron state is corresponding
Context relation between symbol string, finds out the target character meeting intended context feature in target text
String;Solving code spice to need to be audited by special auditor, review efficiency is relatively low and error rate
Higher problem;Reach when searching the target string with complicated context feature, it is only necessary to according to
Target string generates the configuration of corresponding state machine, and instruction state machine is carried out automatically according to the configuration of this state machine
Search, reduce while improve search efficiency and find out error rate.
Accompanying drawing explanation
For the technical scheme being illustrated more clearly that in the embodiment of the present invention, institute in embodiment being described below
The accompanying drawing used is needed to be briefly described, it should be apparent that, the accompanying drawing in describing below is only the present invention
Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work,
Other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 shows the method flow diagram of the string searching method that one embodiment of the invention provides;
Fig. 2 A shows the method flow diagram of the string searching method that another embodiment of the present invention provides;
Fig. 2 B is the state transition diagram involved by string searching method that Fig. 2 A provides;
Fig. 3 shows the block diagram of the string searching device that one embodiment of the invention provides;
Fig. 4 shows the block diagram of the string searching device that another embodiment of the present invention provides;
Fig. 5 shows the block diagram of the string searching device that one embodiment of the invention provides.
Detailed description of the invention
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to the present invention
Embodiment is described in further detail.
The string searching approach application that each embodiment of the present invention provides has the electronic equipment of state machine in running
In, such as, this electronic equipment can be personal computer or code detection server etc..
In order to simplify description, the most only perform to illustrate by computer with string searching method, but
This is not constituted restriction.
Refer to Fig. 1, it illustrates the method flow of the string searching method that one embodiment of the invention provides
Figure.The method includes:
Step 102, reading state machine configuration information, state machine configuration information includes the sub-state of at least two,
Every sub-state is used for searching each self-corresponding character string, and at least there is the character string that two sub-states are corresponding
Between there is context relation.
Wherein, each sub-state include status word string corresponding to the status indicator of sub-state, sub-state with
And the transfering state mark that sub-state is corresponding;
Transfering state mark is the status indicator of another sub-state, and the sub-state indicated by transfering state mark
Between the status word string that corresponding status word string is corresponding with current sub-state, there is context relation.
Step 104, use state machine is searched according to state machine configuration information to meet in target text and is made a reservation for up and down
The target string of literary composition feature.
In sum, the string searching method that the present embodiment provides, configured by reading state machine, and profit
The context relation between the character string that neutron state is corresponding is configured according to this state machine, in target with state machine
Text finds out the target string meeting intended context feature;Solve code spice to need by specially
Auditor audit, the problem that review efficiency is relatively low and error rate is higher;Reach to have in lookup
During the target string of complicated context feature, it is only necessary to generate corresponding state machine according to target string and join
Put, and instruction state machine makes a look up automatically according to the configuration of this state machine, drops while improve search efficiency
Low find out error rate.
When the string searching method that the present embodiment provides is applied to code spice detection, developer's root in advance
Concatenate into corresponding state machine configuration information according to the code character not meeting predetermined code style, and pass through state
Machine runs this state machine configuration information, thus all in searching in object code does not meets predetermined code style
Code character string.An embodiment is used to illustrate below.
Refer to Fig. 2 A, the method that it illustrates the string searching method that another embodiment of the present invention provides
Flow chart.The method includes:
Step 201, reading state machine configuration information, state machine configuration information includes the sub-state of at least two,
Every sub-state is used for searching each self-corresponding character string, and at least there is the character string that two sub-states are corresponding
Between there is context relation.
As a example by code spice detects, the target string that developer searches as required in object code,
Draw out state transition diagram when searching this target string by visualization tool, and shift according to this state
Figure generates the configuration of corresponding state machine.After obtaining this state machine configuration information, computer is i.e. machine-readable by state
Take this state machine configuration information so that state machine can carry out target string according to this state machine configuration information
Lookup.
Wherein, comprising the sub-state of at least two in state machine configuration information, every sub-state is used for indicating state
The most corresponding character string searched by machine, and, this state machine configuration information at least exists two sub-states corresponding
Character string between there is context relation.
Concrete, in state machine configuration information, each sub-state includes the status indicator of sub-state, sub-state pair
The status word string answered and sub-state corresponding transfering state mark.Wherein, status word string is sub-state
The character string that instruction state machine is searched, transfering state mark is the status indicator of another sub-state, and transfer shape
Between the status word string that status word string corresponding to sub-state indicated by state mark is corresponding with current sub-state
There is described context relation.
Such as, the status word string of sub-state 1 correspondence is AB, and the status word string of sub-state 2 correspondence is
CD, the status word string of sub-state 3 correspondence is EF, wherein, the status word string AB of sub-state 1 correspondence
There is between the status word string CD corresponding with sub-state 2 context relation, the status word of sub-state 2 correspondence
Between the status word string EF that symbol string CD is corresponding with sub-state 3, there is context relation.Then state machine configuration
In information, the transfering state of sub-state 1 correspondence is designated the status indicator of sub-state 2, and sub-state 2 is corresponding
Transfering state be designated the status indicator of sub-state 3.
In conjunction with a specific embodiment, when developer needs to detect the code spice of object code,
And (catch when must comprise code corresponding to print log function inside code spice instruction catch statement
Logth statement must be comprised inside statement), developer using the catch statement that do not comprises logth statement as
Target string, and draw out state transition diagram as shown in Figure 2 B, wherein, logth according to this target string
Statement is that catch statement is then program development for realizing the code statement of printing function in field of program development
Field is used for the code statement of abnormality code in prize procedure.
Wherein, this state transition diagram includes five sub-states, respectively start, catch, block, log
And end, wherein, sub-state start is initial sub-state, and sub-state end is for terminating sub-state.It is connected
Between the character string (character string that instruction state machine is searched) that two sub-states are corresponding, i.e. there is context relation.
Such as, the character string " } that sub-state start is corresponding character string " catch.*{ " is corresponding with sub-state block " between
There is context relation;The character string that character string " logth " corresponding to sub-state block is corresponding with sub-state log
" } " between there is context relation.
According to the state transition diagram shown in Fig. 2 B, each sub-state in the state machine configuration information of generation is permissible
The most as shown in Table 1.
Table one
Wherein, " .* " represents any character or character string.
Step 202, determines the sub-state that state machine is presently in.
After state machine reads this state machine configuration information, need to initialize, as a kind of possible enforcement
Mode, this step may include steps of.
Step 202A, according to the status indicator of sub-state, determines initial sub-state.
State machine obtains the status indicator of each sub-state in state machine configuration information, so that it is determined that go out initial son
State, wherein, the status indicator of this initial sub-state can be made an appointment.Such as, state machine is permissible
It is pre-configured with and is defined as initial sub-state by reading the sub-state that status indicator is start.
Step 202B, initializes according to initial sub-state.
State machine is according to corresponding configuration (status word string and the transfering state mark of the initial sub-state after determining
Know etc.) initialize.
Step 203, searches the status word string that this sub-state is corresponding in target text.
State machine, according to being presently in sub-state corresponding states character string, starts to look into from the first row of target text
Look for.Such as, as a example by target text is as code, state machine, i.e. from the beginning of code the first row, searches initial son
The status word string that state (start) is corresponding.
Step 204, if finding the status word string that this sub-state is corresponding in target text, then obtains this son
The transfering state mark of state.
When finding status word string corresponding to initial sub-state in target text, at the beginning of state machine i.e. obtains
The transfering state mark that the sub-state that begins is corresponding.
Developer knows the target character found letter such as location in target text for convenience
Breath, each sub-state in this state machine configuration information also includes the processing mode of correspondence, when finding sub-shape
During status word string corresponding to state, state machine i.e. performs corresponding operation according to the processing mode that sub-state is corresponding.
Wherein, this processing mode includes preserving content, the preservation lookup that the status word string found is expert at
To status word string be expert at line number, print preserve content and print preserve line number at least one
Kind.
As shown in above-mentioned table one, processing mode corresponding to sub-state start is Record, represents when find start
During corresponding status word string, state machine preserves content and the line number that this status word string is expert at;Sub-shape
Processing mode corresponding to state log is None, represents when finding status word string corresponding for log, state
Machine does not perform process;Processing mode corresponding to sub-state end is Print, represents corresponding when find end
During status word string, state machine prints all the elements and line number preserved before.
Such as, state machine finds the status word string that initial sub-state is corresponding at the 123rd line code
" catch ", the transfering state i.e. getting correspondence is designated " catch ", preserves line number 123 and preserves the 123rd
The content of line code.
Step 205, if the sub-state indicated by transfering state mark is not to terminate sub-state, is then being positioned at this shape
In text after state character string, search the status word string that the sub-state indicated by transfering state mark is corresponding.
After state machine gets transfering state mark, the detection sub-state indicated by this transfering state is further
No for terminating sub-state, and when the sub-state indicated by this transfering state is not to terminate sub-state, looking into
In text after the status word string found, continue to search for the sub-state indicated by transfering state mark corresponding
Status word string.Wherein, similar to initial sub-state, this terminates status indicator corresponding to sub-state also
Can make an appointment, such as, state machine can be pre-configured with and will read the son that status indicator is end
State is defined as terminating sub-state.
In conjunction with above-mentioned table one, when state machine finds the state that initial sub-state is corresponding at the 123rd line code
During character string " catch ", the transfering state getting correspondence is designated " catch ", and the son indicated by " catch "
State is not to terminate sub-state, and state machine then determines that current sub-state is " catch ", and from the 123rd line code
Place starts, and continues to search for the status word string that " catch " is corresponding.
Step 206, if the sub-state indicated by transfering state mark is to terminate sub-state, it is determined that find mesh
Mark character string.
When detecting that the sub-state indicated by transfering state mark is to terminate sub-state, state machine i.e. determines to be looked into
Have found the target string meeting intended context relation.
In conjunction with above-mentioned table one, such as, when finding catch.*{} under sub-state start, state machine is i.e. protected
Deposit content and line number that catch.*{} is expert at, and jump to sub-state end, owing to sub-state end is knot
Restrainting sub-state, state machine i.e. determines and has found target string, and corresponding according to terminating sub-state end
Processing mode, content and the line number be expert at by the catch.*{} of preservation print.Developer according to
The content printed, can quickly find the code not meeting code spice in object code.
Visible, owing to being only provided with printing function in terminating the processing mode that sub-state end is corresponding, therefore,
When state machine only can print the corresponding contents that target string is expert at when finding target string, right
To not print in non-targeted character string (such as meeting the character string of code spice).
Step 207, according to initial sub-state, continues to search for mesh in the text after being positioned at this status word string
Mark character string.
As shown in Table 1, terminate transfering state corresponding to sub-state and be designated the state mark that initial sub-state is corresponding
Know, after state machine searching a to target string, i.e. determine that initial sub-state is current sub-state, and
In text after the target string found, continue to search for target string, until completing whole mesh
The lookup of mark text.
In sum, the string searching method that the present embodiment provides, configured by reading state machine, and profit
The context relation between the character string that neutron state is corresponding is configured according to this state machine, in target with state machine
Text finds out the target string meeting intended context feature;Solve code spice to need by specially
Auditor audit, the problem that review efficiency is relatively low and error rate is higher;Reach to have in lookup
During the target string of complicated context feature, it is only necessary to generate corresponding state machine according to target string and join
Put, and instruction state machine makes a look up automatically according to the configuration of this state machine, drops while improve search efficiency
Low find out error rate.
In the present embodiment, by configuring corresponding processing mode for each sub-state so that state machine is being searched
To target string location in target text can be printed during target string, facilitate exploit person
Member carries out fault location, improves the efficiency of code spice detection.
It should be noted that the state machine configuration information that state machine reads can be to use json data form
Json file, schematically, the json file that state machine configuration information shown in table one is corresponding can be as follows.
Refer to Fig. 3, it illustrates the structure square frame of the string searching device that one embodiment of the invention provides
Figure.This string searching device can pass through software, hardware or both be implemented in combination with become operation and have shape
The all or part of the electronic equipment of state machine.This string searching device, including:
Read module 310, for reading state machine configuration information, described state machine configuration information includes at least
Two sub-states, every sub-state is used for searching each self-corresponding character string, and at least there are two sub-states
Between corresponding character string, there is context relation;
Search module 320, be used for using state machine to search in target text according to described state machine configuration information
Meet the target string of intended context feature.
In sum, the string searching device that the present embodiment provides, configured by reading state machine, and profit
The context relation between the character string that neutron state is corresponding is configured according to this state machine, in target with state machine
Text finds out the target string meeting intended context feature;Solve code spice to need by specially
Auditor audit, the problem that review efficiency is relatively low and error rate is higher;Reach to have in lookup
During the target string of complicated context feature, it is only necessary to generate corresponding state machine according to target string and join
Put, and instruction state machine makes a look up automatically according to the configuration of this state machine, drops while improve search efficiency
Low find out error rate.
Refer to Fig. 4, it illustrates the structure side of the string searching device that another embodiment of the present invention provides
Block diagram.This string searching device can pass through software, hardware or both be implemented in combination with become operation and have
The all or part of the electronic equipment of state machine.This string searching device, including:
Read module 410, for reading state machine configuration information, described state machine configuration information includes at least
Two sub-states, every sub-state is used for searching each self-corresponding character string, and at least there are two sub-states
Between corresponding character string, there is context relation;
Search module 420, be used for using state machine to search in target text according to described state machine configuration information
Meet the target string of intended context feature.
Alternatively, described sub-state includes the state that the status indicator of described sub-state, described sub-state are corresponding
Character string and described sub-state corresponding transfering state mark;
Wherein, described status word string is the character string that described sub-state indicative of said status machine is searched;
Described transfering state mark is the status indicator of another sub-state, and described transfering state mark is indicated
Status word string corresponding to the sub-state status word string corresponding with current sub-state between have described up and down
Literary composition relation.
Alternatively, search module 420, including:
First determines unit 421, for determining the sub-state that described state machine is presently in;
First searches unit 422, for searching the described state that described sub-state is corresponding in described target text
Character string;
Buanch unit 423, if for finding the described state that described sub-state is corresponding in described target text
Character string, then obtain the described transfering state mark of described sub-state;
Second searches unit 424, if not being to terminate sub-shape for the sub-state indicated by described transfering state mark
State, then being positioned in the text after described status word string, search indicated by described transfering state mark
The status word string that sub-state is corresponding.
Alternatively, search module 420, also include:
Second determines unit 425, if being described end for the sub-state indicated by described transfering state mark
State, it is determined that find described target string.
Alternatively, terminate transfering state corresponding to sub-state and be designated the status indicator that initial sub-state is corresponding,
Search module 420, also include:
3rd searches unit 426, for according to described initial sub-state, after being positioned at described status word string
Text in continue to search for described target string.
Alternatively, first determines unit 421, specifically for:
According to the status indicator of described sub-state, determine initial sub-state;
Initialize according to the carrying out that described initial sub-state is corresponding.
Alternatively, described sub-state also includes that processing mode, described processing mode include preserving the shape found
Content that state character string is expert at, preserve line number that the status word string found is expert at, print and preserve
At least one in the line number that content and printing preserve.
Alternatively, this state machine configuration information uses json data form.
In sum, the string searching device that the present embodiment provides, configured by reading state machine, and profit
The context relation between the character string that neutron state is corresponding is configured according to this state machine, in target with state machine
Text finds out the target string meeting intended context feature;Solve code spice to need by specially
Auditor audit, the problem that review efficiency is relatively low and error rate is higher;Reach to have in lookup
During the target string of complicated context feature, it is only necessary to generate corresponding state machine according to target string and join
Put, and instruction state machine makes a look up automatically according to the configuration of this state machine, drops while improve search efficiency
Low find out error rate.
In the present embodiment, by configuring corresponding processing mode for each sub-state so that state machine is being searched
To target string location in target text can be printed during target string, facilitate exploit person
Member carries out fault location, improves the efficiency of code spice detection.
It should be understood that the string searching device that above-described embodiment provides searches target in target text
During character string, only it is illustrated with the division of above-mentioned each functional module, in actual application, can basis
Need and above-mentioned functions distribution is completed by different functional modules, the electronic equipment of state machine will be run
Internal structure be divided into different functional modules, to complete all or part of function described above.Separately
Outward, the string searching device that above-described embodiment provides and string searching embodiment of the method belong to same design,
It implements process and refers to embodiment of the method, repeats no more here.
Fig. 5 shows the block diagram of the string searching device that one embodiment of the invention provides.This character string is looked into
Looking for device 500 can be the computer applying to run state machine.Specifically:
Device 500 includes CPU (CPU) 501, includes random access memory (RAM) 502
With the system storage 504 of read only memory (ROM) 503, and connection system memorizer 504 and central authorities
The system bus 505 of processing unit 501.Device 500 also includes passing between each device in help computer
The basic input/output (I/O system) 506 of transmission information, and be used for storing operating system 513, application
Program 514 and the mass-memory unit 507 of other program modules 515.
Basic input/output 506 includes the display 508 for showing information and inputs for user
The input equipment 509 of such as mouse, keyboard etc of information.Wherein display 508 and input equipment 509 are all
It is connected to CPU 501 by being connected to the IOC 510 of system bus 505.Substantially
Input/output 506 can also include IOC 510 for receive and process from keyboard,
The input of other equipment multiple such as mouse or electronic touch pen.Similarly, IOC 510 is also
Provide output to display screen, printer or other kinds of outut device.
Mass-memory unit 507 (does not shows by being connected to the bulk memory controller of system bus 505
Go out) it is connected to CPU 501.Mass-memory unit 507 and the computer-readable being associated thereof are situated between
Matter provides non-volatile memories for device 500.It is to say, mass-memory unit 507 can include all
Computer-readable medium (not shown) such as hard disk or CD-ROM drive etc.
Without loss of generality, computer-readable medium can include computer-readable storage medium and communication media.Calculate
Machine storage medium include for store such as computer-readable instruction, data structure, program module or other
Volatibility that any method of the information such as data or technology realize and Jie non-volatile, removable and irremovable
Matter.Computer-readable storage medium includes RAM, ROM, EPROM, EEPROM, flash memory or other solid-states
Store its technology, CD-ROM, DVD or other optical storage, cartridge, tape, disk storage or its
His magnetic storage apparatus.Certainly, skilled person will appreciate that computer-readable storage medium is not limited to above-mentioned several
Kind.Above-mentioned system storage 504 and mass-memory unit 507 may be collectively referred to as memorizer.
According to various embodiments of the present invention, device 500 can also be connected to by networks such as such as the Internets
Remote computer on network runs.Namely device 500 can be by being connected to the net on system bus 505
Network interface unit 511 is connected to network 512, in other words, it is possible to use NIU 511 connects
To other kinds of network or remote computer system (not shown).
Above-mentioned memorizer also includes one or more than one program, one or the storage of more than one program
In memorizer, it is configured to be performed by CPU.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can be passed through
Hardware completes, it is also possible to instructing relevant hardware by program and complete, described program can be stored in
In a kind of computer-readable recording medium, storage medium mentioned above can be read only memory, disk or
CD etc..
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all the present invention's
Within spirit and principle, any modification, equivalent substitution and improvement etc. made, should be included in the present invention's
Within protection domain.
Claims (16)
1. a string searching method, it is characterised in that described method includes:
Reading state machine configuration information, described state machine configuration information includes the sub-state of at least two, each
Sub-state is used for searching each self-corresponding character string, and at least exists between two character strings corresponding to sub-state
There is context relation;
Use state machine to search in target text according to described state machine configuration information and meet intended context spy
The target string levied.
Method the most according to claim 1, it is characterised in that described sub-state includes described sub-state
Transfering state mark corresponding to status indicator, status word string corresponding to described sub-state and described sub-state
Know;
Wherein, described status word string is the character string that described sub-state indicative of said status machine is searched;
Described transfering state mark is the status indicator of another sub-state, and described transfering state mark is indicated
Status word string corresponding to the sub-state status word string corresponding with current sub-state between have described up and down
Literary composition relation.
Method the most according to claim 2, it is characterised in that described use state machine is according to described shape
State machine configuration information searches the target string meeting intended context feature in target text, including:
Determine the sub-state that described state machine is presently in;
The described status word string that described sub-state is corresponding is searched in described target text;
If finding the described status word string that described sub-state is corresponding in described target text, then obtain institute
State the described transfering state mark of sub-state;
If the sub-state indicated by described transfering state mark is not to terminate sub-state, then it is being positioned at described state
In text after character string, search the status word that the sub-state indicated by described transfering state mark is corresponding
String.
Method the most according to claim 3, it is characterised in that the described sub-state of described acquisition described
After transfering state mark, also include:
If the sub-state indicated by described transfering state mark is the sub-state of described end, it is determined that find institute
State target string.
Method the most according to claim 4, it is characterised in that the transfer that the sub-state of described end is corresponding
Status indicator is the status indicator that initial sub-state is corresponding,
Described determine find described target string after, also include:
According to described initial sub-state, the text after being positioned at described status word string continue to search for described
Target string.
6. according to the arbitrary described method of claim 3 to 5, it is characterised in that described determine described state
The sub-state that machine is presently in, including:
According to the status indicator of described sub-state, determine initial sub-state;
Initialize according to described initial sub-state.
7. according to the arbitrary described method of claim 2 to 6, it is characterised in that described sub-state also includes
Processing mode, described processing mode includes preserving content that the status word string found is expert at, preserves and look into
In the line number that the line number that the status word string found is expert at, the content printing preservation and printing preserve at least
A kind of.
8. according to the arbitrary described method of claim 1 to 7, it is characterised in that described state machine configuration letter
Breath uses json data form.
9. a string searching device, it is characterised in that described device includes:
Read module, for reading state machine configuration information, described state machine configuration information includes at least two
Individual sub-state, every sub-state is used for searching each self-corresponding character string, and at least there are two sub-states pair
Between the character string answered, there is context relation;
Search module, be used for using state machine to search symbol in target text according to described state machine configuration information
Close the target string of intended context feature.
Device the most according to claim 9, it is characterised in that described sub-state includes described sub-shape
Status word string that the status indicator of state, described sub-state are corresponding and transfering state corresponding to described sub-state
Mark;
Wherein, described status word string is the character string that described sub-state indicative of said status machine is searched;
Described transfering state mark is the status indicator of another sub-state, and described transfering state mark is indicated
Status word string corresponding to the sub-state status word string corresponding with current sub-state between have described up and down
Literary composition relation.
11. devices according to claim 10, it is characterised in that described lookup module, including:
First determines unit, for determining the sub-state that described state machine is presently in;
First searches unit, for searching the described status word that described sub-state is corresponding in described target text
Symbol string;
Buanch unit, if for finding the described status word that described sub-state is corresponding in described target text
Symbol string, then obtain the described transfering state mark of described sub-state;
Second searches unit, if not being to terminate sub-state for the sub-state indicated by described transfering state mark,
Then being positioned in the text after described status word string, search the sub-shape indicated by described transfering state mark
The status word string that state is corresponding.
12. devices according to claim 11, it is characterised in that described lookup module, also include:
Second determines unit, if being the sub-shape of described end for the sub-state indicated by described transfering state mark
State, it is determined that find described target string.
13. devices according to claim 12, it is characterised in that corresponding the turning of the sub-state of described end
Shifting state is designated the status indicator that initial sub-state is corresponding,
Described lookup module, also includes:
3rd searches unit, for according to described initial sub-state, after being positioned at described status word string
Text continues to search for described target string.
14. according to the arbitrary described device of claim 11 to 13, it is characterised in that described first determines
Unit, is used for:
According to the status indicator of described sub-state, determine initial sub-state;
Initialize according to the carrying out that described initial sub-state is corresponding.
15. according to the arbitrary described device of claim 10 to 14, it is characterised in that described sub-state is also
Including processing mode, described processing mode includes preserving content, the guarantor that the status word string found is expert at
In the line number that the line number that the status word string found of filing for reference is expert at, the content printing preservation and printing preserve
At least one.
16. according to the arbitrary described device of claim 9 to 15, it is characterised in that described state machine configures
Information uses json data form.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610196564.6A CN105868113B (en) | 2016-03-31 | 2016-03-31 | String searching method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610196564.6A CN105868113B (en) | 2016-03-31 | 2016-03-31 | String searching method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105868113A true CN105868113A (en) | 2016-08-17 |
CN105868113B CN105868113B (en) | 2019-05-31 |
Family
ID=56627749
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610196564.6A Active CN105868113B (en) | 2016-03-31 | 2016-03-31 | String searching method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105868113B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109683897A (en) * | 2018-12-29 | 2019-04-26 | 广州华多网络科技有限公司 | Program processing method, device and equipment |
CN112307167A (en) * | 2020-10-30 | 2021-02-02 | 广州华多网络科技有限公司 | Text sentence cutting method and device, computer equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040064807A1 (en) * | 2002-09-30 | 2004-04-01 | Ibm Corporation | Validating content of localization data files |
CN101174261A (en) * | 2006-11-03 | 2008-05-07 | 北京航空航天大学 | Extended finite state machine and search method for multiple regular expression associated search |
CN102902664A (en) * | 2012-08-15 | 2013-01-30 | 中山大学 | Artificial intelligence natural language operation system on intelligent terminal |
CN103984688A (en) * | 2013-04-28 | 2014-08-13 | 百度在线网络技术(北京)有限公司 | Method and equipment for providing input candidate vocabulary entries based on local word bank |
CN104753916A (en) * | 2013-12-30 | 2015-07-01 | 凯为公司 | Method and apparatus for processing of finite automata |
CN104820666A (en) * | 2014-01-31 | 2015-08-05 | 凯为公司 | Finite Automata Processing Based on a Top of Stack (TOS) Memory |
-
2016
- 2016-03-31 CN CN201610196564.6A patent/CN105868113B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040064807A1 (en) * | 2002-09-30 | 2004-04-01 | Ibm Corporation | Validating content of localization data files |
CN101174261A (en) * | 2006-11-03 | 2008-05-07 | 北京航空航天大学 | Extended finite state machine and search method for multiple regular expression associated search |
CN102902664A (en) * | 2012-08-15 | 2013-01-30 | 中山大学 | Artificial intelligence natural language operation system on intelligent terminal |
CN103984688A (en) * | 2013-04-28 | 2014-08-13 | 百度在线网络技术(北京)有限公司 | Method and equipment for providing input candidate vocabulary entries based on local word bank |
CN104753916A (en) * | 2013-12-30 | 2015-07-01 | 凯为公司 | Method and apparatus for processing of finite automata |
CN104820666A (en) * | 2014-01-31 | 2015-08-05 | 凯为公司 | Finite Automata Processing Based on a Top of Stack (TOS) Memory |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109683897A (en) * | 2018-12-29 | 2019-04-26 | 广州华多网络科技有限公司 | Program processing method, device and equipment |
CN109683897B (en) * | 2018-12-29 | 2022-05-10 | 广州华多网络科技有限公司 | Program processing method, device and equipment |
CN112307167A (en) * | 2020-10-30 | 2021-02-02 | 广州华多网络科技有限公司 | Text sentence cutting method and device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN105868113B (en) | 2019-05-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8041652B2 (en) | Measuring web site satisfaction of information needs using page traffic profile | |
US9773010B1 (en) | Information-driven file system navigation | |
US20150324457A1 (en) | Ordering a Set of Regular Expressions for Matching Against a String | |
CN107644286A (en) | Workflow processing method and device | |
CN104899016B (en) | Allocating stack Relation acquisition method and device | |
CN107844567A (en) | A kind of business experience bag commending system and method | |
CN108427731A (en) | Processing method, device, terminal device and the medium of page code | |
Van Ham et al. | Centrality based visualization of small world graphs | |
US10956747B2 (en) | Creating sparsely labeled video annotations | |
WO2019100645A1 (en) | Method for realizing multilevel interactive drop-down box, electronic device, and storage medium | |
CN107102908A (en) | Data verification method, data fault tolerance method and device | |
Kalenkova et al. | Discovery of cancellation regions within process mining techniques | |
CN108460068A (en) | Method, apparatus, storage medium and the terminal that report imports and exports | |
CN104321753B (en) | For the method for usage amount that monitoring resource is presented, computing device and record has the recording medium of the program for execution thereon | |
CN105868113A (en) | Character string look-up method and device | |
CN103152212B (en) | A kind of alarm correlation analysis method, device and network management system | |
CN108153465A (en) | Label setting method and device based on enterprise SaaS applications | |
CN107480056A (en) | A kind of method for testing software and device | |
CN104573132B (en) | Song lookup method and device | |
CN107291486A (en) | The installation method and device of a kind of operating system | |
CN106358220A (en) | Detection method of abnormal contact person information, device and system | |
CN108897522A (en) | Data processing method, data processing equipment and electronic equipment | |
CN109542904A (en) | Business data processing method, device, server and medium | |
US20140267293A1 (en) | Visualizing data transfers in distributed file system | |
CN108388463A (en) | Icon processing method, device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |