CN115858907A - Statement processing method, device, equipment and medium - Google Patents

Statement processing method, device, equipment and medium Download PDF

Info

Publication number
CN115858907A
CN115858907A CN202211616581.2A CN202211616581A CN115858907A CN 115858907 A CN115858907 A CN 115858907A CN 202211616581 A CN202211616581 A CN 202211616581A CN 115858907 A CN115858907 A CN 115858907A
Authority
CN
China
Prior art keywords
lexical
sentence
list
regular expression
processing
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
Application number
CN202211616581.2A
Other languages
Chinese (zh)
Inventor
张事林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Branch Of Beijing Know Future Information Technology Co ltd
Original Assignee
Chengdu Branch Of Beijing Know Future Information Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Chengdu Branch Of Beijing Know Future Information Technology Co ltd filed Critical Chengdu Branch Of Beijing Know Future Information Technology Co ltd
Priority to CN202211616581.2A priority Critical patent/CN115858907A/en
Publication of CN115858907A publication Critical patent/CN115858907A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Machine Translation (AREA)

Abstract

The embodiment of the invention provides a statement processing method, a statement processing device, statement processing equipment and a statement processing medium, which relate to the technical field of data processing, and the method comprises the following steps: and responding to the sentence character string processing request, and performing lexical analysis on the sentence character string based on a regular expression in a preset lexical analyzer list to obtain each lexical analysis result, wherein the lexical analyzer list comprises a plurality of regular expressions obtained through disassembly. And then, arranging and combining the lexical analysis results according to the semantic order, thereby obtaining processing result data and realizing the optimization of statement processing.

Description

Statement processing method, device, equipment and medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a statement processing method, apparatus, device, and medium.
Background
The search grammar parsing processing is a processing scheme for disassembling a string of character strings input by a user during network retrieval, obtaining relevant retrieval keywords and retrieval values from the character strings, and performing retrieval operation. Since the user input is usually indeterminable and irregular, the common processing method is to adapt the currently encountered user input value by continuously expanding the regular expression, and in the past, the regular expression becomes difficult to maintain and the grammar parsing becomes very slow. Thus, today's search syntax parsing process is to be optimized.
Disclosure of Invention
One of the objects of the present invention includes, for example, providing a statement processing method, apparatus, device and medium to at least partially optimize a statement processing scheme.
Embodiments of the invention may be implemented as follows:
in a first aspect, the present invention provides a statement processing method, including:
in response to the sentence character string processing request, carrying out lexical analysis on the sentence character string based on a regular expression in a preset lexical analyzer list to obtain each lexical analysis result; the lexical resolver list comprises a plurality of regular expressions obtained through disassembly;
and arranging and combining the lexical analysis results according to the semantic sequence to obtain processing result data.
In an alternative embodiment, the method further comprises the step of building a list of lexical resolvers, comprising:
according to character types, unit disassembling is carried out on complete regular expressions to obtain regular expressions corresponding to each character type, and the obtained regular expressions form a lexical analyzer list; wherein the character types comprise space characters, operational characters, search content separators and Chinese and English characters; or,
according to the word definition, unit disassembly is carried out on the complete regular expressions to obtain the regular expressions for processing a single word, and the obtained regular expressions form a lexical resolver list.
In an optional embodiment, the lexical parsing is performed on the sentence character string based on a regular expression in a preset lexical parser list to obtain each lexical parsing result, including:
determining each target regular expression related to the sentence character string from a preset lexical analyzer list;
performing lexical analysis on the sentence character strings based on the target regular expressions to obtain lexical analysis results; or,
and respectively carrying out lexical analysis on the sentence character strings based on each regular expression in a preset lexical analyzer list to obtain each lexical analysis result.
In an optional embodiment, the arranging and combining the lexical analysis results according to the semantic order to obtain processing result data includes:
in the process of performing lexical analysis on the sentence character string, performing semantic analysis on the lexical analysis result every time one lexical analysis result is obtained, so as to obtain a semantic analysis result;
and under the condition of obtaining all the semantic analysis results aiming at the sentence character string, arranging and combining all the semantic analysis results to obtain processing result data.
In an optional embodiment, the responding to the sentence character string processing request, and performing lexical analysis on the sentence character string based on a regular expression in a preset lexical analyzer list to obtain each lexical analysis result includes:
inputting the sentence character string requested to be processed into a lexical analyzer based on a calling logic provided by a Chain function scheduling center;
and analyzing and disassembling the sentence character string based on a regular expression in a lexical analyzer list preset in the lexical analyzer, and outputting the complete word as a lexical analysis result when one complete word is disassembled.
In an optional embodiment, the step of arranging and combining the lexical analysis results according to the semantic order to obtain processing result data is implemented by a syntax parser;
the structure of the retrieval character string in the grammar resolver comprises: operation separators and arbitrary words; operators, search fields and words; operators and words; the grammar parser is used for arranging and combining the defined grammar parsing method based on the characteristic that the Chain function can be combined with other sub-functions at will;
the Chain function scheduling center is used for defining a lexical analyzer list according to a lexical analysis rule; defining a grammar parser based on a grammar parsing order and rules; creating a Chain function dispatching center class, and registering a defined grammar parser in the Chain function dispatching center class; the registered parser is instantiated to provide an interface for parsing the sentence string.
In an alternative embodiment, the method further comprises:
acquiring a lexical analyzer list adjustment request; the lexical resolver list adjustment request comprises object adding, object modifying and object deleting;
under the condition that the lexical analyzer list adjustment request is an object newly added, determining whether a character type or a word definition corresponding to the object which is requested to be newly added exists in the lexical analyzer list, if so, adding the object which is requested to be newly added to a regular expression corresponding to the character type or the word definition; if not, creating a character type or a word definition corresponding to the newly-added object, and taking the newly-added object as a regular expression corresponding to the created character type or word definition;
under the condition that the lexical analyzer list adjustment request is object modification, determining a regular expression requesting modification from the lexical analyzer list, and performing corresponding modification;
and under the condition that the lexical analyzer list adjustment request is object deletion, determining a regular expression requested to be deleted from the lexical analyzer list, and deleting the regular expression.
In a second aspect, an embodiment of the present invention provides a statement processing apparatus, including:
the lexical analysis module is used for responding to the sentence character string processing request, and carrying out lexical analysis on the sentence character strings based on a regular expression in a preset lexical analyzer list to obtain each lexical analysis result; the lexical resolver list comprises a plurality of regular expressions obtained through disassembly;
and the data processing module is used for arranging and combining the lexical analysis results according to the semantic sequence to obtain processing result data.
In a third aspect, the present invention provides an electronic device comprising: the system comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the statement processing method of any one of the preceding embodiments when executing the program.
In a fourth aspect, the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a computer program, and the computer program controls, when running, an electronic device in which the computer-readable storage medium is located to execute the statement processing method according to any of the foregoing embodiments.
The beneficial effects of the embodiment of the invention include, for example: the lexical analysis of the sentence character strings is realized by presetting a lexical analyzer list comprising a plurality of regular expressions obtained by disassembly, so that processing result data is obtained, the convenience and flexibility of sentence processing are improved, and the optimization of a sentence processing scheme is realized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 shows a schematic diagram of an application scenario provided in an embodiment of the present invention.
Fig. 2 is a flowchart illustrating a statement processing method according to an embodiment of the present invention.
Fig. 3 is a schematic diagram illustrating a statement processing method according to an embodiment of the present invention.
Fig. 4 shows an exemplary structural block diagram of a statement processing apparatus according to an embodiment of the present invention.
An icon: 100-an electronic device; 110-a memory; 120-a processor; 130-a communication module; 140-sentence processing means; 141-lexical analysis module; 142-a data processing module.
Detailed Description
At present, in a common search grammar parsing process, a search grammar character string is parsed and disassembled mainly by maintaining an oversized regular expression, and after the grammar character string is disassembled through the regular expression, attribution of a parsing result is determined through a plurality of branch judgments.
The research shows that the treatment mode has the following problems:
regular expressions for analysis are abnormally overstaffed and not easy to maintain. When the regular expression cannot be analyzed, developers are required to expand the regular expression and add new branch judgment according to the input of users. If the service is a small service, the scheme is better realized under the conditions of low user quantity and low search. However, once the search scope is enlarged and the search concurrency becomes larger, the scheme becomes very chicken-costed, and developers need to maintain and expand regular expressions at any time. In the past, codes parsed by the grammar become difficult to maintain. The method and the grammar device cannot be configured and input, the processing logic can only be built in, and the flexibility is lacked.
In order to optimize syntax parsing processing, embodiments of the present invention provide a statement processing scheme, where in a node js based on a Chain function programming mode, a syntax parsing regular expression is disassembled and assembled to parse a syntax string, so that various and/or and non-various retrieval operations can be supported, a sequence of calling the syntax string can be arranged and assembled according to service requirements, and convenience and flexibility of statement processing are improved.
The defects existing in the above solutions are the results obtained after the inventor has practiced and studied carefully, so the discovery process of the above problems and the solutions proposed by the embodiments of the present invention below to the above problems should be the contributions of the inventor in the invention process.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It is to be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
Referring to fig. 1, a block diagram of an electronic device 100 provided in this embodiment is shown, where the electronic device 100 in this embodiment may be a server, a processing device, a processing platform, and the like capable of performing data interaction and processing, such as providing a statement retrieval and analysis interface. The electronic device 100 includes a memory 110, a processor 120, and a communication module 130. The memory 110, the processor 120, and the communication module 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 110 is used to store programs or data. The Memory 110 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 120 is used to read/write data or programs stored in the memory 110 and perform corresponding functions.
The communication module 130 is configured to establish a communication connection between the electronic device 100 and another communication terminal through the network, and to transmit and receive data through the network.
It should be understood that the structure shown in fig. 1 is merely a schematic diagram of the structure of the electronic device 100, and that the electronic device 100 may include more or less components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Referring to fig. 2, a flowchart of a statement processing method according to an embodiment of the present invention may be executed by the electronic device 100 shown in fig. 1, for example, may be executed by the processor 120 in the electronic device 100. The sentence processing method includes S110 and S120.
S110, responding to the sentence character string processing request, and carrying out lexical analysis on the sentence character strings based on the regular expressions in the preset lexical analyzer list to obtain each lexical analysis result.
The lexical resolver list comprises a plurality of regular expressions obtained through disassembly.
And S120, arranging and combining the lexical analysis results according to the semantic sequence to obtain processing result data.
Based on the scheme, the sentence character strings are analyzed lexically through the regular expressions obtained through disassembly, processing result data are obtained, convenience and flexibility of sentence processing are guaranteed, and optimization of the sentence processing scheme is achieved.
In S110, the sentence string processing request can be flexibly obtained, for example, the sentence string processing request can be generated for a string of sentence strings input by the user, for example, in a search syntax parsing processing scenario.
The list of lexical resolvers may be obtained in a variety of ways. For example, according to the character types, the complete regular expressions can be subjected to unit decomposition to obtain the regular expressions respectively corresponding to each character type, and the obtained regular expressions form a lexical parser list. The character types may include space character, operator and search content separator, chinese and English characters, etc.
For another example, the complete regular expression may be unit decomposed according to the term definitions to obtain a regular expression for processing a single term, and the obtained regular expressions form a lexical parser list.
The whole regular expression is disassembled into a plurality of regular expressions, so that the convenience of maintenance and expansion is improved, and the required workload is reduced. For example, in the case of acquiring a lexical parser list adjustment request, the regular expressions requesting adjustment can be processed separately without involving all the regular expressions.
For example, the lexical parser list adjustment request may include object addition, object modification, object deletion, and the like. And under the condition that the lexical analyzer list adjustment request is an object addition, determining whether a character type or a word definition corresponding to the object requesting the addition exists in the lexical analyzer list, and if so, adding the object requesting the addition to a regular expression corresponding to the character type or the word definition. And if not, creating a character type or a word definition corresponding to the newly-added object, and taking the newly-added object as a regular expression corresponding to the created character type or word definition.
And under the condition that the lexical analyzer list adjustment request is object modification, determining a regular expression requested to be modified from the lexical analyzer list, and performing corresponding modification.
And under the condition that the lexical resolver list adjustment request is object deletion, determining a regular expression requested to be deleted from the lexical resolver list, and deleting the regular expression.
Therefore, under the condition of reducing the influence on each regular expression, the adjustment of the lexical analyzer list is completed.
And performing lexical analysis on the sentence character strings based on a regular expression in a preset lexical analyzer list, wherein the mode of obtaining each lexical analysis result can be flexibly set.
For example, each target regular expression related to a sentence character string may be determined from a preset lexical analyzer list, and then, the sentence character string is lexically analyzed based on each target regular expression to obtain each lexical analysis result. Illustratively, each target regular expression related to the sentence character string can be determined through semantic analysis.
For another example, the sentence character string may be lexically analyzed based on each regular expression in a preset lexical analyzer list, so as to obtain each lexical analysis result. It can be understood that the regular expression related to the sentence character string may be only a part of the lexical parser list, and then the regular expression related to the sentence character string may output specific parsing contents, and the regular expression not related to the sentence character string is output as null, and when a subsequent semantic meaning is processed, the specific parsing contents are processed.
In S120, the lexical analysis results are arranged and combined according to the semantic order, and the processing result data can be obtained in various ways.
For example, in the process of performing lexical analysis on the sentence character string, whenever a lexical analysis result is obtained, the lexical analysis result is subjected to semantic analysis to obtain a semantic analysis result.
For example, in the lexical analysis of the sentence character string, a predetermined number (two or more) of lexical analysis results are obtained, and then the predetermined number of lexical analysis results are subjected to semantic analysis to obtain semantic analysis results.
For another example, after all the lexical analysis results are obtained in the lexical analysis process of the sentence character string, the semantic analysis result may be obtained by performing semantic analysis on all the lexical analysis results.
And then under the condition of obtaining all the semantic analysis results aiming at the sentence character string, arranging and combining all the semantic analysis results to obtain processing result data.
In one implementation, S110 may be implemented by: and inputting the sentence character string requested to be processed into a lexical analyzer based on calling logic provided by a Chain function scheduling center, analyzing and disassembling the sentence character string based on a regular expression in a lexical analyzer list preset in the lexical analyzer, and outputting the complete word as a lexical analysis result when each complete word is disassembled.
Accordingly, S120 may be implemented by a parser. The structure of the search string in the parser may include: operation delimiters and arbitrary words; operators, search fields and words; operators and words. The grammar parser is used for arranging and combining the defined grammar parsing method based on the characteristic that the Chain function can be combined with other sub-functions at will.
The Chain function scheduling center is used for defining a lexical analyzer list according to a lexical analysis rule; defining a grammar parser based on a grammar parsing order and rules; creating a Chain function dispatching center class, and registering a defined grammar parser in the Chain function dispatching center class; the registered parser is instantiated to provide an interface for parsing the sentence string.
In order to more clearly illustrate the implementation of the present embodiment, the following scenario is taken as an example to illustrate the implementation principle of the present embodiment.
As shown in fig. 3, a lexical parser list, a syntactic parser function, and a Chain function scheduling center are integrated in the electronic device. The lexical resolver list, the syntactic resolver function and the Chain function scheduling center can be integrated in a software module component to expose calling methods to the outside.
The lexical analyzer list comprises a plurality of word analysis rules. The method is characterized in that a huge regular expression in the prior art is subjected to unit decomposition, for example, a space character, an operator (and, or and not), an operator and a search content separator (such as colon:) and other types of characters are subjected to unit decomposition. Accordingly, each regular expression corresponds to a class of words, such as: spaces, operators, chinese and English characters, and the like.
Based on the setting, the lexical resolver list is quoted through enumeration, and each quote is independent and only processes specific characters, so that the lexical resolver list can be arbitrarily expanded according to word classification.
Illustratively, a certain lexical resolver List custom Lexer List is as follows:
Figure BDA0004000435200000131
/>
Figure BDA0004000435200000141
the regular expression is disassembled according to the word definition, so that a single word processing regular expression which is independent and indirect is obtained, a lexical analyzer list is formed, and convenience can be provided for subsequent addition and maintenance. What lexical resolution is applied to what lexical resolution is required. The regular expressions applied to are characterized in fig. 3 by lexical resolvers 1, 2, 3.
And the grammar resolver function is used for arranging and combining the lexical methods according to the search semantic order aiming at the result output by the lexical resolver and outputting a correct search condition block. The search service will then perform a result search through these search criteria blocks.
The grammar parser is an operation carrier of the lexical parser list, and the grammar parser completes semantic parsing actions by selecting and quoting different lexical rules in the lexical parser list, so that different semantic parsing is realized.
Combining the lexical resolver List custom Lexer List, constructing a syntactic resolver as follows:
Figure BDA0004000435200000151
/>
Figure BDA0004000435200000161
/>
Figure BDA0004000435200000171
the call logic for the parser is as follows:
taking a lexical resolver List as the custom Lexer List, taking a field name which is required to be searched by a user as fields, taking the example that a corresponding lexical resolution method from a lexical resolution type name to the lexical resolver List is findLexer, and setting three structures of retrieval character strings in a grammar resolver:
{ operation delimiter } { arbitrary word }, { operator } { search field } { word } and { operator } { word }. For example: word, + ip word and + word. Three parser types isExpr, conditionExpr, and prefixExpr are implemented. The word structure is contained in the + ip: word, so that the property that the Chain function can be combined with other sub-functions at will in conditionExpr is utilized, and the isExpr is arranged in the word. And combining all defined grammar resolver methods in the root function by using the characteristics of other subfunctions which can be randomly combined by the Chain function, thereby completing the definition of the grammar resolver.
The semantic meaning is analyzed by referring to a lexical analyzer through a grammar analyzer, the semantic meaning of a single word is analyzed, and then the semantic meaning of the whole sentence is analyzed by scheduling through a Chain function scheduling center. In fig. 3, syntax parsers 1, 2, and 3 represent syntax parsing schemes of the respective structures applied thereto.
The scheduling process of the Chain function scheduling center is as follows:
and determining a lexical analysis rule, and defining a lexical analyzer list.
Figure BDA0004000435200000181
/>
Figure BDA0004000435200000191
/>
Figure BDA0004000435200000201
And determining a grammar parsing sequence and rules, and defining a grammar parsing function based on the chain function.
Figure BDA0004000435200000202
/>
Figure BDA0004000435200000211
/>
Figure BDA0004000435200000221
A Chain dispatch center class is created into which the syntax parsing functions defined above are registered.
Figure BDA0004000435200000222
/>
Figure BDA0004000435200000231
And combining the registered grammar parsing functions by utilizing the characteristic that Chain can combine and arrange the subfunctions, and outputting a static method for external calling.
And instantiating a Chain scheduling center class, and analyzing the retrieval character string by using an exposed static analysis method.
In this embodiment, the Chain function scheduling center is configured to provide a bottom-level call logic for executing a grammar parser function, and includes a sequence, and secondary processing (such as recursion, callback, and the like) and grammar parsing in a result flow process may be optionally plugged and replaced to handle different search statements and the like. And searching sentence character strings to enter a lexical analyzer through a Chain function scheduling center, analyzing and disassembling sentences by a lexical regular expression in the lexical analyzer, flowing results to a grammar analyzer function after a complete word is disassembled, and performing semantic analysis on the words by the grammar analyzer function and then outputting the words. And obtaining a complete search condition after all the analyses are completed.
The characteristics of random combination and plugging of subfunctions can be realized through the Chain function, and the grammar analysis of the search sentence character string is completed by combining the modularized lexical method and the grammar analyzer. Compared with the processing scheme of branch judgment and super-large regular expression in the prior art, the method has great progress in code maintenance, secondary iteration and free expansion. Research personnel can adapt to new semanteme by newly adding lexical and grammar, and search semanteme under different conditions can be dealt with by randomly combining and plugging in and out grammar resolvers. The function is also developed from a single process to a plurality of processes combined by various permutations. The character string is analyzed by using an oversized regular expression, so that the performance is very consumed, and the problem can be avoided by calling related lexical methods according to the modular lexical analysis in the scheme.
In order to execute the corresponding steps in the above embodiments and various possible manners, an implementation manner of the statement processing apparatus is given below. Referring to fig. 4, fig. 4 is a functional block diagram of a sentence processing apparatus 140 according to an embodiment of the present invention, where the sentence processing apparatus 140 can be applied to the electronic device 100 shown in fig. 1. It should be noted that the basic principle and the generated technical effect of the sentence processing apparatus 140 provided in the present embodiment are the same as those of the above method embodiment, and for the sake of brief description, no part of the present embodiment is mentioned, and reference may be made to the corresponding contents in the above method embodiment. The sentence processing apparatus 140 includes a lexical analysis module 141 and a data processing module 142.
The lexical analysis module 141, in response to the sentence character string processing request, performs lexical analysis on the sentence character strings based on the regular expressions in the preset lexical analyzer list to obtain lexical analysis results.
The lexical resolver list comprises a plurality of regular expressions obtained through disassembly.
The data processing module 142 is configured to perform permutation and combination on the lexical analysis results according to the semantic order to obtain processing result data.
On the basis, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a computer program, and when the computer program runs, the electronic device in which the computer-readable storage medium is located is controlled to execute the above statement processing method.
By adopting the scheme in the embodiment of the invention, the regular expressions are classified according to the semanteme expressed by the grammar, a plurality of regular expressions are arranged and combined in a plugging mode, and then the search grammar character string input by the user is disassembled. When the search character string reaches a certain regular processing module, corresponding results can be extracted from the search character string, and all the results are packaged and combined, so that the parsed grammar results can be obtained. Therefore, the problems of difficult maintenance and low analysis efficiency of the regular expression in the prior art are solved, and the statement processing scheme is optimized.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A sentence processing method, comprising:
in response to the sentence character string processing request, carrying out lexical analysis on the sentence character string based on a regular expression in a preset lexical analyzer list to obtain each lexical analysis result; the lexical resolver list comprises a plurality of regular expressions obtained through disassembly;
and arranging and combining the lexical analysis results according to the semantic sequence to obtain processing result data.
2. The sentence processing method of claim 1, wherein the method further comprises a step of constructing a lexical parser list, the step comprising:
according to character types, performing unit disassembly on complete regular expressions to obtain regular expressions respectively corresponding to each character type, and forming a lexical resolver list by each obtained regular expression; wherein the character types comprise space characters, operational characters, search content separators and Chinese and English characters; or,
according to the word definition, unit disassembly is carried out on the complete regular expression to obtain a regular expression for processing a single word, and the obtained regular expressions form a lexical analyzer list.
3. The sentence processing method according to claim 1 or 2, wherein the lexical parsing is performed on the sentence character strings based on regular expressions in a preset lexical parser list to obtain lexical parsing results, and the method comprises:
determining each target regular expression related to the sentence character string from a preset lexical analyzer list;
performing lexical analysis on the sentence character strings based on the target regular expressions to obtain lexical analysis results; or,
and respectively carrying out lexical analysis on the sentence character strings based on each regular expression in a preset lexical analyzer list to obtain each lexical analysis result.
4. The sentence processing method of claim 3, wherein the arranging and combining the lexical analysis results according to the semantic order to obtain processing result data comprises:
in the process of performing lexical analysis on the sentence character string, performing semantic analysis on the lexical analysis result every time one lexical analysis result is obtained, so as to obtain a semantic analysis result;
and under the condition of obtaining all the semantic analysis results aiming at the sentence character string, arranging and combining all the semantic analysis results to obtain processing result data.
5. The sentence processing method of claim 4, wherein the lexical parsing of the sentence character strings based on the regular expressions in the preset lexical parser list to obtain the lexical parsing results in response to the sentence character string processing request comprises:
inputting the sentence character string requested to be processed into a lexical analyzer based on a calling logic provided by a Chain function scheduling center;
and analyzing and disassembling the sentence character string based on a regular expression in a lexical analyzer list preset in the lexical analyzer, and outputting the complete word as a lexical analysis result when one complete word is disassembled.
6. The sentence processing method of claim 5, wherein the step of arranging and combining the lexical analysis results in the semantic order to obtain the processing result data is implemented by a parser;
the structure of the retrieval character string in the grammar resolver comprises the following steps: operation delimiters and arbitrary words; operators, search fields and words; operators and words; the grammar parser is used for arranging and combining the defined grammar parsing method based on the characteristic that the Chain function can be combined with other sub-functions at will;
the Chain function scheduling center is used for defining a lexical analyzer list according to a lexical analysis rule; defining a grammar parser based on a grammar parsing order and rules; creating a Chain function dispatching center class, and registering a defined grammar parser in the Chain function dispatching center class; the registered parser is instantiated to provide an interface for parsing the sentence string.
7. The sentence processing method according to claim 2, wherein the method further comprises:
acquiring a lexical analyzer list adjustment request; the lexical resolver list adjustment request comprises object addition, object modification and object deletion;
under the condition that the lexical analyzer list adjustment request is an object newly added, determining whether a character type or a word definition corresponding to the object which is requested to be newly added exists in the lexical analyzer list, if so, adding the object which is requested to be newly added to a regular expression corresponding to the character type or the word definition; if not, creating a character type or a word definition corresponding to the newly-added object, and taking the newly-added object as a regular expression corresponding to the created character type or word definition;
under the condition that the lexical analyzer list adjustment request is object modification, determining a regular expression requesting modification from the lexical analyzer list, and performing corresponding modification;
and under the condition that the lexical analyzer list adjustment request is object deletion, determining a regular expression requested to be deleted from the lexical analyzer list, and deleting the regular expression.
8. A sentence processing apparatus, comprising:
the lexical analysis module responds to the sentence character string processing request, and performs lexical analysis on the sentence character strings based on a regular expression in a preset lexical analyzer list to obtain each lexical analysis result; the lexical resolver list comprises a plurality of regular expressions obtained through disassembly;
and the data processing module is used for arranging and combining the lexical analysis results according to the semantic sequence to obtain processing result data.
9. An electronic device, comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the statement processing method of any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium, comprising a computer program, wherein the computer program controls an electronic device on which the computer-readable storage medium is executed to perform the sentence processing method according to any one of claims 1 to 7.
CN202211616581.2A 2022-12-15 2022-12-15 Statement processing method, device, equipment and medium Pending CN115858907A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211616581.2A CN115858907A (en) 2022-12-15 2022-12-15 Statement processing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211616581.2A CN115858907A (en) 2022-12-15 2022-12-15 Statement processing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN115858907A true CN115858907A (en) 2023-03-28

Family

ID=85673318

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211616581.2A Pending CN115858907A (en) 2022-12-15 2022-12-15 Statement processing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115858907A (en)

Similar Documents

Publication Publication Date Title
US11221832B2 (en) Pruning engine
CN107644323B (en) Intelligent auditing system for business flow
US9223777B2 (en) Self-learning semantic search engine
US20120117053A1 (en) Techniques for knowledge discovery by constructing knowledge correlations using concepts or terms
CN109522341B (en) Method, device and equipment for realizing SQL-based streaming data processing engine
US20140156282A1 (en) Method and system for controlling target applications based upon a natural language command string
US20130125098A1 (en) Transformation of Computer Programs
EP3846089A1 (en) Generating a knowledge graph of multiple application programming interfaces
CN116483850A (en) Data processing method, device, equipment and medium
US9208134B2 (en) Methods and systems for tokenizing multilingual textual documents
Monteiro et al. Combining natural language processing and blockchain for smart contract generation in the accounting and legal field
CN113204593A (en) ETL job development system and computer equipment based on big data calculation engine
Bais et al. A model of a generic natural language interface for querying database
CN115858907A (en) Statement processing method, device, equipment and medium
CN113868138A (en) Method, system, equipment and storage medium for acquiring test data
KR20020027088A (en) Korean natural language processing technology based on syntax analysis and applications thereof
CN112527880B (en) Method, device, equipment and medium for collecting metadata information of big data cluster
US11150955B2 (en) Generation and usage of a task-based programming platform
US20240104297A1 (en) Analysis of spreadsheet table in response to user input
US20240143928A1 (en) Generation of interactive utterances of code tasks
Bhadauria et al. Design and Implementation of HSQL: A SQL-like language for Data Analysis in Distributed Systems
CN115544134A (en) Data access method, device, computer equipment and storage medium
Tao Ontology-based active repository system
Dimopoulos et al. A generic platform for the soc implementation of grammar-based applications
WO2024102449A1 (en) Systems and methods for enhanced machine learning techniques for knowledge map generation and user interface presentation

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