CN109800339A - Regular expression generation method, device, computer equipment and storage medium - Google Patents
Regular expression generation method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN109800339A CN109800339A CN201811527535.9A CN201811527535A CN109800339A CN 109800339 A CN109800339 A CN 109800339A CN 201811527535 A CN201811527535 A CN 201811527535A CN 109800339 A CN109800339 A CN 109800339A
- Authority
- CN
- China
- Prior art keywords
- regular
- regular expression
- chinese
- grammar
- chinese keyword
- 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.)
- Pending
Links
Landscapes
- Document Processing Apparatus (AREA)
Abstract
The embodiment of the present application provides a kind of regular expression generation method, device, computer equipment and storage medium.Method includes: the first regular expression obtained using Chinese keyword statement, and Chinese keyword is by obtaining the description of character in regular grammar;Obtain the description of the character style of the corresponding regular grammar of each Chinese keyword in the first regular expression;According to the description of the character style of the acquired corresponding regular grammar of Chinese keyword, each Chinese keyword in the first regular expression is converted into the corresponding character of Chinese keyword, to generate the second regular expression of character style.The invention relates to the exploitation auxiliary in computer technology exploitation, the first regular expression is stated by Chinese keyword, Chinese keyword in first regular expression is replaced into corresponding character in regular grammar, generate the second regular expression of character style, it realizes the character amount reduced when generating regular expression, improves the efficiency for generating regular expression.
Description
Technical field
This application involves field of computer technology more particularly to a kind of regular expression generation method, device, computer to set
Standby and computer readable storage medium.
Background technique
Regular expression is usually used to retrieval or replacement meets the text of preset mode or rule, and many programs are set
Meter language all supports that regular expression is in text based editing machine and search work using regular expression progress string operation
In occupation of a very important status in tool.
In traditional technology, regular expression is used in the industry, typically manually oneself writes regular expression.Due to not being
Commonly using regular expression, the regular grammar that causes regular expression to be related to is forgotten, simultaneously because originals such as regular grammar are more
Cause, when writing regular expression, it is often necessary to check regular grammar again, when problem complexity need to take a significant amount of time, to lead
Cause with inefficiency when regular expression.
Summary of the invention
The embodiment of the present application provides a kind of regular expression generation method, device, computer equipment and computer-readable
Storage medium, the problem of being able to solve in traditional technology using regular expression low efficiency.
In a first aspect, the embodiment of the present application provides a kind of regular expression generation method, which comprises acquisition makes
The first regular expression stated with Chinese keyword, the Chinese keyword is by obtaining the description of character in regular grammar;
Obtain the description of the character style of the corresponding regular grammar of each Chinese keyword in first regular expression;According to institute
The description of the character style of the corresponding regular grammar of Chinese keyword of acquisition, will be each described in first regular expression
Chinese keyword is converted to the corresponding character of Chinese keyword, to generate the second regular expression of character style.
Second aspect, the embodiment of the present application also provides a kind of regular expression generating means, comprising: first obtains list
Member, for obtaining the first regular expression using Chinese keyword statement, the Chinese keyword by regular grammar to word
The description of symbol obtains;Second acquisition unit, it is corresponding for obtaining each Chinese keyword in first regular expression
The description of the character style of regular grammar;Converting unit, for according to the acquired corresponding regular grammar of Chinese keyword
It is corresponding to be converted to Chinese keyword by the description of character style for each Chinese keyword in first regular expression
Character, to generate the second regular expression of character style.
The third aspect, the embodiment of the present application also provides a kind of computer equipments comprising memory and processor, it is described
Computer program is stored on memory, the processor realizes that the regular expression generates when executing the computer program
Method.
Fourth aspect, the embodiment of the present application also provides a kind of computer readable storage medium, the storage medium storage
There is computer program, the computer program makes the processor execute the regular expression generation side when being executed by processor
Method.
The embodiment of the present application provides a kind of regular expression generation method, device, computer equipment and computer-readable
Storage medium.The described method includes: obtain the first regular expression using Chinese keyword statement, the Chinese keyword by
The description of character is obtained in regular grammar;Obtain the corresponding canonical of each Chinese keyword in first regular expression
The description of the character style of grammer;It, will according to the description of the character style of the acquired corresponding regular grammar of Chinese keyword
Each Chinese keyword in first regular expression is converted to the corresponding character of Chinese keyword, to generate character shape
Second regular expression of formula.The invention relates to the exploitation auxiliary in computer technology exploitation, are closed by using Chinese
Key word description regular grammar is stating first just by easy-to-use Chinese keyword to improve the service efficiency of regular grammar
Then expression formula improves the formation efficiency of regular expression, then the Chinese keyword in the first regular expression is replaced into canonical
Corresponding character style in grammer, so that the second regular expression of character style is obtained, thus by the way that regular grammar is refined
At Chinese keyword, the time that regular expression expends directly is generated using character to reduce, to improve generation regular expressions
The efficiency of formula solves the problems, such as to use regular expression low efficiency in traditional technology.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application, below will be to needed in embodiment description
Attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is some embodiments of the present application, general for this field
For logical technical staff, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the application scenarios schematic diagram of regular expression generation method provided by the embodiments of the present application;
Fig. 2 is the flow diagram of regular expression generation method provided by the embodiments of the present application;
Fig. 3 is the flow diagram for the regular expression generation method that another embodiment of the application provides;
Fig. 4 is the schematic block diagram of regular expression generating means provided by the embodiments of the present application;
Fig. 5 is another schematic block diagram of regular expression generating means provided by the embodiments of the present application;And
Fig. 6 is the schematic block diagram of computer equipment provided by the embodiments of the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation description, it is clear that described embodiment is some embodiments of the present application, instead of all the embodiments.Based on this Shen
Please in embodiment, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall in the protection scope of this application.
It should be appreciated that ought use in this specification and in the appended claims, term " includes " and "comprising" instruction
Described feature, entirety, step, operation, the presence of element and/or component, but one or more of the other feature, whole is not precluded
Body, step, operation, the presence or addition of element, component and/or its set.
It is also understood that mesh of the term used in this present specification merely for the sake of description specific embodiment
And be not intended to limit the application.As present specification and it is used in the attached claims, unless on
Other situations are hereafter clearly indicated, otherwise " one " of singular, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in present specification and the appended claims is
Refer to any combination and all possible combinations of one or more of associated item listed, and including these combinations.
Referring to Fig. 1, Fig. 1 is the application scenarios schematic diagram of regular expression generation method provided by the embodiments of the present application.
The application scenarios include:
(1) terminal.Terminal shown in Fig. 1 is the computer equipment used when programmer etc. manually writes regular expression.Institute
Stating terminal can be the electronic equipments such as smart phone, smartwatch, laptop, tablet computer or desktop computer, terminal
Artificial input is received by input equipments such as keyboards.
Each body of work process in Fig. 1 is as follows: in carrying out programming, when needing to write regular expression, and meter
Calculate machine equipment and obtain the first regular expression using Chinese keyword statement, the Chinese keyword by regular grammar to word
The description of symbol obtains;Computer equipment obtains the corresponding regular grammar of each Chinese keyword in first regular expression
Character style description;Computer equipment is retouched according to the character style of the acquired corresponding regular grammar of Chinese keyword
It states, each Chinese keyword in first regular expression is converted into the corresponding character of Chinese keyword, to generate
Second regular expression of character style, to obtain the regular expression of computer needs.
It should be noted that only illustrating desktop computer as terminal, in the actual operation process, type in Fig. 1
It can be not limited to shown in Fig. 1, the terminal can also set for electronics such as smartwatch, laptop or tablet computers
Standby, the application scenarios of above-mentioned regular expression generation method are merely illustrative technical scheme, are not used to limit this
Apply for technical solution.
Fig. 2 is the schematic flow chart of regular expression generation method provided by the embodiments of the present application.The regular expression
Generation method is applied in the computer equipment in Fig. 1, to complete all or part of function of regular expression generation method.
Referring to Fig. 2, Fig. 2 is the flow diagram of regular expression generation method provided by the embodiments of the present application.Such as Fig. 2
It is shown, this approach includes the following steps S210-S230:
S210, the first regular expression stated using Chinese keyword is obtained, the Chinese keyword is by regular grammar
In the description of character is obtained.
Wherein, to the description of character in regular grammar, refer to the description in regular grammar to the meaning of the character, due to just
The then different meaning of character representation different in grammer participates in different logical operation, and therefore, different characters is corresponding with accordingly
Meaning explanation and illustration, that is, the character meaning description.Table 1 is please referred to, for example, the meaning of " b " is exactly corresponding
Character description " one word boundary of matching, that is, (i.e. " matching " of regular expression has for the position that refers between word and space
Two conceptions of species, one is matching character, one is matching positions, here b be exactly matching position) ".Character " ?=" contain
The corresponding character of justice is described as that " non-acquisition matching, forward direction are looked into advance certainly, at the character string beginning of any matching pattern
With character string is searched, which does not need to obtain for using later ".
Chinese keyword refers to that the Chinese meaning by character each in regular grammar carries out refining the Chinese keyword of acquisition, with
It will pass through the corresponding Chinese keyword of each character to be broadly described meaning of the character in regular grammar, the Chinese closes
Key character root, which summarize according to the Chinese meaning of character each in regular grammar, respectively corresponds acquisition.Please continue to refer to table 1, for example,
Character " b ", corresponding meaning are character description " one word boundary of matching, that is, refer to position between word and space (i.e.
" matching " of regular expression is there are two types of concept, and one is matching characters, and one is matching positions, here b be exactly match bit
Set) ", the corresponding Chinese keyword extracted is " word boundary ", and character " b " is indicated by Chinese keyword " word boundary "
Meaning in regular grammar.For another example, character " ?=", corresponding meaning is that " non-acquisition matching, forward direction is certainly for character description
It looks into advance, in the character string beginning matched and searched character string of any matching pattern, which does not need to obtain for making later
With ", the corresponding Chinese keyword extracted is " with ", indicates character " with " in regular grammar by Chinese keyword " with "
In meaning.
Regular expression, also known as regular expression, English RegularExpression, in computer program code
Often it is abbreviated as regex, regexp or RE.Regular expression is a kind of logical formula to string operation, is to use predefined
The combination of good character and these characters, forms one " regular character string ", is somebody's turn to do " regular character string " and is used to express to character string
A kind of filter logic, wherein character string includes general character and spcial character.Wherein, general character, for example, between a to z
Letter, spcial character, also known as " metacharacter " are that some have specific use in regular expression but do not represent itself
One group of character of character meaning, such as: ^,?:,?=,?!Equal characters.
Regular grammar refers to the grammer of regular expression.Regular grammar refers to the operation logic to character string.Regular expressions
Formula is a kind of Text Mode, and matched one or more character strings are wanted in mode description when searching for text.Regular expression is logical
Often it is used to retrieval, replacement meets the text of the mode of presetting or rule.
One regular expression structure mainly includes:
1), want matched character set, comprising: w, d, D, b, s etc., such as: d indicate number 0-9;
2), quantifier, comprising:+, *,? Deng such as: d+ indicate at least one number;
3), bracket, comprising: braces { }, same amount word indicate matching how many times;Bracket [] indicates one group of character set;It is small
Bracket () indicates sub- regular expression;
4), other spcial characters, comprising: ^,?:,?=,?!, | etc.;
5) modifier, for example include:
1. i, English be ignore, case-insensitive, such as :/abc/i can match abc, aBC, Abc;
2. g, English is global, global search or global registration, if character string is from a left side in regular process without g
To right matching, first qualified i.e. successful match is found, is returned;If character string from left to right, is found every with g
It is a it is qualified all record, until character string end position;
3. m, English be more, inter-bank search or multirow matching, if it exists line feed n and have start ^ or terminate $ symbol
In the case where realization global registration is used together with g because exist line feed when default can be using newline as a character task
Matched character string is a uniline, and g only matches the first row, multirow is realized after addition m, is exactly to start after each newline.
Chinese generates regular expression and regular grammar therein is mainly converted to Chinese, such as:
1) character set is indicated with Chinese, and such as ' number ' indicates number 0 to 9, and ' Chinese character ' indicates all Chinese characters, ' empty ' table
All blank characters including showing including space, entering a new line, skip etc., ' letter ' indicate a to z word letter, ' line feed ' expression
Newline.
2) spcial character is indicated with Chinese:
' non-' indicates to negate, other keywords need to be cooperated to use, and such as ' non-empty ' indicates matching appointing other than blank
What character;
‘ or ' indicate or relationship such as ' number or Chinese character ' indicate matching number or Chinese character;
' with ' indicates the meaning and then, such as ' number is with Chinese character ', and expression is matched with number and number is followed by Chinese character
Character set.
3) escape character ' ', if it is desired to using the original meaning of Chinese keyword, as long as not adding escape character ' ' in the front,
Such as ' number ' expression two word of Chinese figure, rather than 0 to 9.
Referring to Fig. 3, Fig. 3 is the process signal for the regular expression generation method that another embodiment of the application provides
Figure.In this embodiment, each Chinese keyword in the first regular expression corresponding regular grammar of obtaining
Include: before the step of description of character style
S200, the corresponding relationship for obtaining regular grammar and Chinese keyword.
Specifically, the corresponding Chinese keyword of regular grammar is obtained in advance, and the Chinese keyword root is according to the grammer pair
The description answered is refined, and the corresponding relationship of the regular grammar and Chinese keyword can be by passing through external input after manually refining
Equipment input, can also be refined by computer equipment by software program, to facilitate program staff writing regular expression
When, write out the first regular expression using Chinese keyword statement rapidly according to Chinese keyword, wherein regular grammar with
The corresponding relationship of Chinese keyword can be found in table 1.
Further, the step of corresponding relationship for obtaining regular grammar and Chinese keyword includes:
Obtain the note of the Chinese keyword;
Based on the corresponding relationship for explaining the determining regular grammar and Chinese keyword.
Wherein, the note of the Chinese keyword refers to that the character of the corresponding regular grammar meaning of the Chinese keyword is retouched
It states, the note lays down a definition or prompts to the meaning of the correspondence character of Chinese keyword, so that personnel understand that the Chinese closes
The meaning of the corresponding character of the corresponding regular grammar of key word, to write out accurate regular expression.
The note for obtaining the Chinese keyword, based on pair for explaining the determining regular grammar and Chinese keyword
It should be related to, the corresponding Chinese keyword of regular grammar be extracted according to regular grammar to realize, the note of the Chinese keyword can
To be described referring to the character in table 1, specifically please with further reference to table 1.
Table 1
Specifically, computer equipment obtains the corresponding Chinese keyword of regular grammar in advance and is stored, the Chinese
Keyword root is refined according to the corresponding description of the grammer, and the Chinese keyword can be by inputting after manually being refined
It is obtained automatically onto equipment, or by equipment by algorithm, regular grammar by being refined into Chinese key by the embodiment of the present application
Word makes manually when writing regular expression, sees that word knows meaning, using simple.
S220, the character style for obtaining the corresponding regular grammar of each Chinese keyword in first regular expression
Description.
Specifically, after obtaining the first regular expression using Chinese keyword statement, first regular expressions are obtained
The description of the character style of the corresponding regular grammar of each Chinese keyword in formula.For example, the Chinese regular expression obtained
Are as follows: '/digital { 2,5 } with Chinese character+/ it is global '.The Chinese regular expression description are as follows: 2 to 5 numbers of matching, and number
At least one Chinese character must be followed below.Please continue to refer to table 1, it is known that, in the Chinese regular expression, each Chinese is crucial
The description of the character style of the corresponding regular grammar of word are as follows: ‘ number ' corresponding ‘ d ', ‘ with ' it is corresponding '?=', ' Chinese character ' it is corresponding
' u4e00- u9fa5 ', '/global ' corresponding '/g '.
S230, the description according to the character style of the acquired corresponding regular grammar of Chinese keyword, by described first
Each Chinese keyword in regular expression is converted to the corresponding character of Chinese keyword, to generate the second of character style
Regular expression.
Specifically, since the first regular expression for using Chinese keyword to state is intended merely to conveniently manually according to reality
Need to write regular expression involved in program language, it is therefore desirable to which first regular expression is converted into program language
Second regular expression of the character style of use.Computer equipment passes through pair that is converted into Chinese keyword in regular grammar
Character is answered, first regular expression is converted to the second regular expression of character style, is realized through Chinese keyword
Generate regular expression workable for program language.For example, regular expression '/number { 2, the 5 } that Chinese keyword is stated
With Chinese character+/ it is global ', the statement of the corresponding character style of Chinese keyword, the character after conversion can be converted to according to table 1
Second expression formula of form are as follows: '/d { 2,5 } (?=[u4e00- u9fa5]+)/g ', that is, computer programming language is usual
The regular expression of the character style of use.
In the embodiment of the present application, by the way that regular grammar is refined into Chinese keyword, is write out according to Chinese keyword
One regular expression, by first regular expression according to corresponding relationship corresponding conversion when being refined into Chinese keyword at word
Second regular expression of symbol form, may be implemented to quickly generate regular expression, avoid due to personnel not being commonly using just
Then expression formula, the regular grammar that causes regular expression to be related to are forgotten, simultaneously because the reasons such as regular grammar is more, write canonical table
Up to formula when, it is often necessary to check regular grammar again, when problem complexity need to take a significant amount of time, so as to cause canonical table is used
Inefficiency when up to formula, to improve the efficiency for completing regular expression.
In one embodiment, the step of corresponding relationship for obtaining regular grammar and Chinese keyword includes: to receive
The corresponding relationship of the externally input regular grammar and the Chinese keyword.
Specifically, the corresponding relationship of the regular grammar and the Chinese keyword is by being input to meter after manually being refined
Machine equipment is calculated, regular grammar extracts the corresponding Chinese keyword of regular grammar, specifically continuing with referring to table 1.
It is described obtain regular grammar with Chinese keyword corresponding relationship the step of include:
The corresponding relationship model of regular grammar and Chinese keyword is established based on neural network learning;
Corresponding relationship model after the training corresponding relationship model training;
The corresponding relationship of the regular grammar and Chinese keyword is determined based on the corresponding relationship model after training.
Specifically, the corresponding relationship model of regular grammar and Chinese keyword, training institute are established by neural network learning
Corresponding relationship model after stating corresponding relationship model training determines the canonical language based on the corresponding relationship model after training
The corresponding relationship of method and Chinese keyword realizes the corresponding pass for establishing regular grammar with Chinese keyword by neural network learning
It is model, and by the accuracy of corresponding relationship model described in the corresponding relationship model training, based on the corresponding pass after training
It is the corresponding relationship that model determines the regular grammar and Chinese keyword, to improve, regular grammar is corresponding with Chinese keyword to be closed
The accuracy of system.Continuing with referring to table 1, for example, by multiple corpus, if " b " description is word boundary in multiple corpus
Feature, training " b " corresponding Chinese keyword is " word boundary " etc..
It specifically,, can be with relative to the regular grammar of various character styles since regular grammar is refined into Chinese keyword
Convenient artificial writing regular expression, first regular expression can be through keyboard by being manually entered, obtain in use
First regular expression of literary keyword statement.For example, a Chinese regular expression, matches 2 to 5 numbers, and after number
Face must follow at least one Chinese character, regular expression are as follows:
'/digital { 2,5 } with Chinese character+/ it is global '.
In one embodiment, the regular grammar and the corresponding Chinese of the regular grammar are stored with tabular form
Keyword.
Specifically, Chinese keyword is made into the list that can be dragged, and is the program for realizing Chinese regular expression, refers to
The Chinese keyword is made into a list, the Chinese keyword in the list can be replicated stickup or dragging, use
Family can generate regular expression by replicating and pasting or dragging Chinese keyword, while these keywords have note side
Just user understands, described to explain as the description of the Chinese keyword.Regular grammar is refined into Chinese keyword, personnel use
When see that word knows meaning, using simple, while Chinese keyword being made into the list that can be dragged, receive the character of input and through dragging plus
Entry keyword generates regular expression, that is, inputs a small amount of character by personnel, and dragging is added keyword and generates regular expressions
Formula, it is convenient and efficient.
Please continue to refer to Fig. 3, in this embodiment, it is described obtain character style the second regular expression the step of after
Further include:
S240, verify whether second regular expression includes mistake according to pre-set specifications;
If S241, second regular expression include mistake, the mistake is prompted;
If S242, second regular expression do not include mistake, prompt second regular expression correct.
Specifically, after computer equipment gets the second regular expression of character style, regular expression can be passed through
Pre-set specifications verify whether second regular expression includes mistake, whether just to judge second regular expression
Really, the pre-set specifications include whether the logic of regular expression and regular expression meet presets, for example, successive
Whether logic is correct, and whether regular expression is complete, if lacks necessary character etc., such as '+' or '/' etc., if described
Second regular expression include mistake, according to pre-set specifications prompt it is described mistake be specifically what, mistake somewhere, so as to
It modifies to second regular expression, if second regular expression does not include mistake, prompts second canonical
Expression formula is correct, completes writing for second regular expression.
It should be noted that regular expression generation method described in above-mentioned each embodiment, can according to need will not
Re-start combination with the technical characteristic for including in embodiment, with obtain combination after embodiment, but all this application claims
Protection scope within.
Referring to Fig. 4, Fig. 4 is the schematic block diagram of regular expression generating means provided by the embodiments of the present application.It is corresponding
In above-mentioned regular expression generation method, the embodiment of the present application also provides a kind of regular expression generating means.Referring to Fig. 4,
The regular expression generating means include the unit for executing above-mentioned regular expression generation method, which can be configured
In the computer equipments such as laptop.Specifically, referring to Fig. 4, the regular expression generating means 400 are obtained including first
Take unit 401, second acquisition unit 402 and converting unit 403.
Wherein, first acquisition unit 401, it is described for obtaining the first regular expression using Chinese keyword statement
Chinese keyword is by obtaining the description of character in regular grammar;
Second acquisition unit 402, it is corresponding just for obtaining each Chinese keyword in first regular expression
The then description of the character style of grammer;
Converting unit 403, for the description according to the character style of the acquired corresponding regular grammar of Chinese keyword,
Each Chinese keyword in first regular expression is converted into the corresponding character of Chinese keyword, to generate character
Second regular expression of form.
Referring to Fig. 5, Fig. 5 is another schematic frame of regular expression generating means provided by the embodiments of the present application
Is schemed as shown in figure 5, described device 400 further include:
Third acquiring unit 404, for obtaining the corresponding relationship of regular grammar and Chinese keyword.
In one embodiment, third acquiring unit 404, for obtaining the note of the Chinese keyword;Based on described
Explain the corresponding relationship for determining the regular grammar and Chinese keyword.
In one embodiment, the third acquiring unit 404, for receiving the externally input regular grammar and institute
State the corresponding relationship of Chinese keyword.
Please continue to refer to Fig. 5, as shown in figure 5, in this embodiment, the third acquiring unit 404 includes:
Subelement 4041 is established, for establishing the corresponding relationship of regular grammar and Chinese keyword based on neural network learning
Model;
Training subelement 4042, for training the corresponding relationship model after the corresponding relationship model training;
Subelement 4043 is determined, for determining that the regular grammar and Chinese are crucial based on the corresponding relationship model after training
The corresponding relationship of word.
Please continue to refer to Fig. 5, as shown in figure 5, described device 400 further include:
Storage unit 405, for tabular form store the regular grammar and the regular grammar it is corresponding it is described in
Literary keyword.
Please continue to refer to Fig. 5, as shown in figure 5, described device 400 further include:
Verification unit 406, for verifying whether second regular expression includes mistake according to pre-set specifications;
First prompt unit 407 prompts the mistake if including mistake for second regular expression;
Second prompt unit 408 prompts the second canonical table if not including mistake for second regular expression
It is correct up to formula.
It should be noted that it is apparent to those skilled in the art that, above-mentioned regular expression generates dress
Set the specific implementation process with each unit, can with reference to the corresponding description in preceding method embodiment, for convenience of description and
Succinctly, details are not described herein.
Meanwhile in above-mentioned regular expression generating means the division of each unit and connection type be only used for for example,
In other embodiments, regular expression generating means can be divided into as required to different units, it can also be by regular expressions
Each unit takes the different order of connection and mode in formula generating means, to complete the whole of above-mentioned regular expression generating means
Or partial function.
Above-mentioned regular expression generating means can be implemented as a kind of form of computer program, which can be with
It is run in computer equipment as shown in FIG. 6.
Referring to Fig. 6, Fig. 6 is a kind of schematic block diagram of computer equipment provided by the embodiments of the present application.The computer
Equipment 600 can be server, the component or component being also possible in other equipment.
Refering to Fig. 6, which includes processor 602, memory and the net connected by system bus 601
Network interface 605, wherein memory may include non-volatile memory medium 603 and built-in storage 604.
The non-volatile memory medium 603 can storage program area 6031 and computer program 6032.The computer program
6032 are performed, and processor 602 may make to execute a kind of above-mentioned regular expression generation method.
The processor 602 is for providing calculating and control ability, to support the operation of entire computer equipment 600.
The built-in storage 604 provides environment for the operation of the computer program 6032 in non-volatile memory medium 603, should
When computer program 6032 is executed by processor 602, processor 602 may make to execute a kind of above-mentioned regular expression generation side
Method.
The network interface 605 is used to carry out network communication with other equipment.It will be understood by those skilled in the art that in Fig. 6
The structure shown, only the block diagram of part-structure relevant to application scheme, does not constitute and is applied to application scheme
The restriction of computer equipment 600 thereon, specific computer equipment 600 may include more more or fewer than as shown in the figure
Component perhaps combines certain components or with different component layouts.For example, in some embodiments, computer equipment can
Only to include memory and processor, in such embodiments, reality shown in the structure and function and Fig. 6 of memory and processor
It is consistent to apply example, details are not described herein.
Wherein, the processor 602 is for running computer program 6032 stored in memory, to realize following step
It is rapid: obtain the first regular expression using Chinese keyword statement, the Chinese keyword by regular grammar to character
Description obtains;Obtain retouching for the character style of the corresponding regular grammar of each Chinese keyword in first regular expression
It states;According to the description of the character style of the acquired corresponding regular grammar of Chinese keyword, by first regular expression
In each Chinese keyword be converted to the corresponding character of Chinese keyword, to generate the second regular expressions of character style
Formula.
In one embodiment, it is described to obtain first regular expression when processor 602 states step in realization
In the corresponding regular grammar of each Chinese keyword character style description the step of before include: obtain regular grammar with
The corresponding relationship of Chinese keyword.
In one embodiment, when the processor 602 states step in realization, the acquisition regular grammar and Chinese are crucial
The step of corresponding relationship of word includes:
Obtain the note of the Chinese keyword;
Based on the corresponding relationship for explaining the determining regular grammar and Chinese keyword.
In one embodiment, when the processor 602 states step in realization, the acquisition regular grammar and Chinese are crucial
The step of corresponding relationship of word includes: the corresponding relationship for receiving the externally input regular grammar and the Chinese keyword.
In one embodiment, when the processor 602 states step in realization, the acquisition regular grammar and Chinese are crucial
The step of corresponding relationship of word includes:
The corresponding relationship model of regular grammar and Chinese keyword is established based on neural network learning;
Corresponding relationship model after the training corresponding relationship model training;
The corresponding relationship of the regular grammar and Chinese keyword is determined based on the corresponding relationship model after training.
In one embodiment, when the processor 602 states step in realization, the method also includes:
The regular grammar and the corresponding Chinese keyword of the regular grammar are stored with tabular form.
In one embodiment, when the processor 602 states step in realization, second canonical for generating character style
After the step of expression formula further include:
Verify whether second regular expression includes mistake according to pre-set specifications;
If second regular expression includes mistake, the mistake is prompted;
If second regular expression does not include mistake, prompt second regular expression correct.
It should be appreciated that in the embodiment of the present application, processor 602 can be central processing unit (Central
ProcessingUnit, CPU), which can also be other general processors, digital signal processor (Digital
Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit,
ASIC), ready-made programmable gate array (Field-Programmable GateArray, FPGA) or other programmable logic devices
Part, discrete gate or transistor logic, discrete hardware components etc..Wherein, general processor can be microprocessor or
The processor is also possible to any conventional processor etc..
Those of ordinary skill in the art will appreciate that be realize above-described embodiment method in all or part of the process,
It is that can be completed by computer program, which can be stored in a computer readable storage medium.The computer
Program is executed by least one processor in the computer system, to realize the process step of the embodiment of the above method.
Therefore, the application also provides a kind of storage medium.The storage medium computer-readable can be deposited to be non-volatile
Storage media, the storage medium are stored with computer program, which execute processor when being executed by processor as follows
Step:
A kind of computer program product, when run on a computer, so that computer executes in the above various embodiments
The step of described regular expression generation method.
The storage medium can be the internal storage unit of aforementioned device, such as the hard disk or memory of equipment.It is described to deposit
Storage media is also possible to the plug-in type hard disk being equipped on the External memory equipment of the equipment, such as the equipment, intelligent storage
Block (SmartMedia Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Into
One step, the storage medium can also both internal storage units including the equipment or including External memory equipment.
It is apparent to those skilled in the art that for convenience of description and succinctly, foregoing description is set
The specific work process of standby, device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
The storage medium can be USB flash disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), magnetic disk
Or the various computer readable storage mediums that can store program code such as CD.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware
With the interchangeability of software, each exemplary composition and step are generally described according to function in the above description.This
A little functions are implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Specially
Industry technical staff can use different methods to achieve the described function each specific application, but this realization is not
It is considered as beyond scope of the present application.
In several embodiments provided herein, it should be understood that disclosed device and method can pass through it
Its mode is realized.For example, the apparatus embodiments described above are merely exemplary.For example, the division of each unit, only
Only a kind of logical function partition, there may be another division manner in actual implementation.Such as multiple units or components can be tied
Another system is closed or is desirably integrated into, or some features can be ignored or not executed.
Step in the embodiment of the present application method can be sequentially adjusted, merged and deleted according to actual needs.This Shen
Please the unit in embodiment device can be combined, divided and deleted according to actual needs.In addition, in each implementation of the application
Each functional unit in example can integrate in one processing unit, is also possible to each unit and physically exists alone, can also be with
It is that two or more units are integrated in one unit.
If the integrated unit is realized in the form of SFU software functional unit and when sold or used as an independent product,
It can store in one storage medium.Based on this understanding, the technical solution of the application is substantially in other words to existing skill
The all or part of part or the technical solution that art contributes can be embodied in the form of software products, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that an electronic equipment (can be individual
Computer, terminal or network equipment etc.) execute each embodiment the method for the application all or part of the steps.
The above, the only specific embodiment of the application, but the bright protection scope of the application is not limited thereto, and is appointed
What those familiar with the art within the technical scope of the present application, can readily occur in various equivalent modifications or
Replacement, these modifications or substitutions should all cover within the scope of protection of this application.Therefore, the protection scope Ying Yiquan of the application
Subject to the protection scope that benefit requires.
Claims (10)
1. a kind of regular expression generation method, which is characterized in that the described method includes:
Obtain the first regular expression using Chinese keyword statement, the Chinese keyword by regular grammar to character
Description obtains;
Obtain the description of the character style of the corresponding regular grammar of each Chinese keyword in first regular expression;
According to the description of the character style of the acquired corresponding regular grammar of Chinese keyword, by first regular expression
In each Chinese keyword be converted to the corresponding character of Chinese keyword, to generate the second regular expressions of character style
Formula.
2. regular expression generation method according to claim 1, which is characterized in that described to obtain first regular expressions
In formula the step of the description of the character style of the corresponding regular grammar of each Chinese keyword before include:
Obtain the corresponding relationship of regular grammar and Chinese keyword.
3. regular expression generation method according to claim 2, which is characterized in that the acquisition regular grammar and Chinese close
The step of corresponding relationship of key word includes:
Obtain the note of the Chinese keyword;
Based on the corresponding relationship for explaining the determining regular grammar and Chinese keyword.
4. regular expression generation method according to claim 2, which is characterized in that the acquisition regular grammar and Chinese close
The step of corresponding relationship of key word includes:
Receive the corresponding relationship of the externally input regular grammar and the Chinese keyword.
5. regular expression generation method according to claim 2, which is characterized in that the acquisition regular grammar and Chinese close
The step of corresponding relationship of key word includes:
The corresponding relationship model of regular grammar and Chinese keyword is established based on neural network learning;
Corresponding relationship model after the training corresponding relationship model training;
The corresponding relationship of the regular grammar and Chinese keyword is determined based on the corresponding relationship model after training.
6. according to any one of the claim 2-5 regular expression generation method, which is characterized in that the method also includes:
The regular grammar and the corresponding Chinese keyword of the regular grammar are stored with tabular form.
7. regular expression generation method according to claim 1, which is characterized in that the second of the generation character style is just
Then after the step of expression formula further include:
Verify whether second regular expression includes mistake according to pre-set specifications;
If second regular expression includes mistake, the mistake is prompted;
If second regular expression does not include mistake, prompt second regular expression correct.
8. a kind of regular expression generating means characterized by comprising
First acquisition unit, for obtaining the first regular expression using Chinese keyword statement, the Chinese keyword by
The description of character is obtained in regular grammar;
Second acquisition unit, for obtaining the corresponding regular grammar of each Chinese keyword in first regular expression
The description of character style;
Converting unit will be described for the description according to the character style of the acquired corresponding regular grammar of Chinese keyword
Each Chinese keyword in first regular expression is converted to the corresponding character of Chinese keyword, to generate character style
Second regular expression.
9. a kind of computer equipment, which is characterized in that the computer equipment includes memory and is connected with the memory
Processor;The memory is for storing computer program;The processor is based on running and storing in the memory
Calculation machine program, to execute as described in claim any one of 1-7 the step of regular expression generation method.
10. a kind of computer storage medium, which is characterized in that the storage medium is stored with computer program, the computer
The processor is set to execute the regular expression generation method as described in any one of claim 1-7 when program is executed by processor
The step of.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811527535.9A CN109800339A (en) | 2018-12-13 | 2018-12-13 | Regular expression generation method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811527535.9A CN109800339A (en) | 2018-12-13 | 2018-12-13 | Regular expression generation method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109800339A true CN109800339A (en) | 2019-05-24 |
Family
ID=66556621
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811527535.9A Pending CN109800339A (en) | 2018-12-13 | 2018-12-13 | Regular expression generation method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109800339A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111341293A (en) * | 2020-03-09 | 2020-06-26 | 广州市百果园信息技术有限公司 | Text voice front-end conversion method, device, equipment and storage medium |
CN112100366A (en) * | 2020-09-17 | 2020-12-18 | 广联达科技股份有限公司 | Pavement structure layer display method and device, computer equipment and storage medium |
CN112398809A (en) * | 2020-09-29 | 2021-02-23 | 曙光网络科技有限公司 | Protocol rule conversion method, device, computer equipment and storage medium |
WO2021068683A1 (en) * | 2019-10-11 | 2021-04-15 | 平安科技(深圳)有限公司 | Method and apparatus for generating regular expression, server, and computer-readable storage medium |
WO2021072872A1 (en) * | 2019-10-16 | 2021-04-22 | 平安科技(深圳)有限公司 | Name storage method and apparatus based on character conversion, and computer device |
CN113268246A (en) * | 2021-05-28 | 2021-08-17 | 大箴(杭州)科技有限公司 | Regular expression generation method and device and computer equipment |
CN113626593A (en) * | 2021-07-13 | 2021-11-09 | 深圳希施玛数据科技有限公司 | Excel file verification method, device and equipment |
CN114003782A (en) * | 2021-09-29 | 2022-02-01 | 深圳优美创新科技有限公司 | Bluetooth equipment filtering method, system, device and computer readable storage medium |
CN115130023A (en) * | 2022-07-08 | 2022-09-30 | 阿里巴巴(中国)有限公司 | Regular expression generation method, device, equipment and storage medium |
CN115269939A (en) * | 2022-09-28 | 2022-11-01 | 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) | Regular expression generation method and device, intelligent terminal and computer storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20020021182A (en) * | 2000-09-08 | 2002-03-20 | 류충구 | Method and apparatus for inputting Chinese characters using information of tone |
US20060167873A1 (en) * | 2005-01-21 | 2006-07-27 | Degenaro Louis R | Editor for deriving regular expressions by example |
CN102789391A (en) * | 2012-05-16 | 2012-11-21 | 北京像素软件科技股份有限公司 | Computer game logic generating method |
CN105868166A (en) * | 2015-01-22 | 2016-08-17 | 阿里巴巴集团控股有限公司 | Regular expression generation method and system |
-
2018
- 2018-12-13 CN CN201811527535.9A patent/CN109800339A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20020021182A (en) * | 2000-09-08 | 2002-03-20 | 류충구 | Method and apparatus for inputting Chinese characters using information of tone |
US20060167873A1 (en) * | 2005-01-21 | 2006-07-27 | Degenaro Louis R | Editor for deriving regular expressions by example |
CN102789391A (en) * | 2012-05-16 | 2012-11-21 | 北京像素软件科技股份有限公司 | Computer game logic generating method |
CN105868166A (en) * | 2015-01-22 | 2016-08-17 | 阿里巴巴集团控股有限公司 | Regular expression generation method and system |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021068683A1 (en) * | 2019-10-11 | 2021-04-15 | 平安科技(深圳)有限公司 | Method and apparatus for generating regular expression, server, and computer-readable storage medium |
WO2021072872A1 (en) * | 2019-10-16 | 2021-04-22 | 平安科技(深圳)有限公司 | Name storage method and apparatus based on character conversion, and computer device |
CN111341293B (en) * | 2020-03-09 | 2022-11-18 | 广州市百果园信息技术有限公司 | Text voice front-end conversion method, device, equipment and storage medium |
CN111341293A (en) * | 2020-03-09 | 2020-06-26 | 广州市百果园信息技术有限公司 | Text voice front-end conversion method, device, equipment and storage medium |
CN112100366A (en) * | 2020-09-17 | 2020-12-18 | 广联达科技股份有限公司 | Pavement structure layer display method and device, computer equipment and storage medium |
CN112100366B (en) * | 2020-09-17 | 2023-10-27 | 广联达科技股份有限公司 | Pavement structure layer display method and device, computer equipment and storage medium |
CN112398809A (en) * | 2020-09-29 | 2021-02-23 | 曙光网络科技有限公司 | Protocol rule conversion method, device, computer equipment and storage medium |
CN113268246A (en) * | 2021-05-28 | 2021-08-17 | 大箴(杭州)科技有限公司 | Regular expression generation method and device and computer equipment |
CN113268246B (en) * | 2021-05-28 | 2022-05-13 | 大箴(杭州)科技有限公司 | Regular expression generation method and device and computer equipment |
CN113626593A (en) * | 2021-07-13 | 2021-11-09 | 深圳希施玛数据科技有限公司 | Excel file verification method, device and equipment |
CN113626593B (en) * | 2021-07-13 | 2024-04-19 | 深圳希施玛数据科技有限公司 | Excel file verification method, device and equipment |
CN114003782A (en) * | 2021-09-29 | 2022-02-01 | 深圳优美创新科技有限公司 | Bluetooth equipment filtering method, system, device and computer readable storage medium |
CN115130023A (en) * | 2022-07-08 | 2022-09-30 | 阿里巴巴(中国)有限公司 | Regular expression generation method, device, equipment and storage medium |
CN115269939A (en) * | 2022-09-28 | 2022-11-01 | 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) | Regular expression generation method and device, intelligent terminal and computer storage medium |
CN115269939B (en) * | 2022-09-28 | 2023-02-17 | 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) | Regular expression generation method and device, intelligent terminal and computer storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109800339A (en) | Regular expression generation method, device, computer equipment and storage medium | |
JP6714024B2 (en) | Automatic generation of N-grams and conceptual relationships from language input data | |
WO2018040899A1 (en) | Error correction method and device for search term | |
CN111026470B (en) | System and method for verification and conversion of input data | |
CN102141889B (en) | Typewriting auxiliary for editor | |
CN101208689B (en) | Method and apparatus for creating a language model and kana-kanji conversion | |
US20140156282A1 (en) | Method and system for controlling target applications based upon a natural language command string | |
KR20190095099A (en) | Transaction system error detection method, apparatus, storage medium and computer device | |
WO2020149959A1 (en) | Conversion of natural language query | |
CN108388547A (en) | Character string parsing method, apparatus, equipment and computer readable storage medium | |
CN103914296A (en) | Method and system for native language IDE code assistance | |
Bhaire et al. | Spell checker | |
CN112948400A (en) | Database management method, database management device and terminal equipment | |
CN116360763A (en) | Method and device for rapidly generating RPA application | |
CN113343674B (en) | Method, device, equipment and medium for generating text error correction model training corpus | |
CN105630761B (en) | Formula processing method and device | |
US11568858B2 (en) | Transliteration based data augmentation for training multilingual ASR acoustic models in low resource settings | |
EP3255558A1 (en) | Syntax analyzing device, learning device, machine translation device and recording medium | |
KR101989960B1 (en) | Real-time handwriting recognition method using plurality of machine learning models, computer-readable medium having a program recorded therein for executing the same and real-time handwriting recognition system | |
CN112835494A (en) | Voice recognition result error correction method and device | |
WO2020048416A1 (en) | Graphic processing method and device for domain-specific language (dsl) | |
CN108509057B (en) | Input method and related equipment | |
CN110309062A (en) | Case generation method, device, electronic equipment and storage medium | |
CN110018828A (en) | Source code inspection method, device and terminal device | |
US11494551B1 (en) | Form field prediction service |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |