CN101110812A - Text command analyzing and processing method - Google Patents

Text command analyzing and processing method Download PDF

Info

Publication number
CN101110812A
CN101110812A CNA2007101425526A CN200710142552A CN101110812A CN 101110812 A CN101110812 A CN 101110812A CN A2007101425526 A CNA2007101425526 A CN A2007101425526A CN 200710142552 A CN200710142552 A CN 200710142552A CN 101110812 A CN101110812 A CN 101110812A
Authority
CN
China
Prior art keywords
command
text command
semantic
text
attribute
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
CNA2007101425526A
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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CNA2007101425526A priority Critical patent/CN101110812A/en
Publication of CN101110812A publication Critical patent/CN101110812A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Machine Translation (AREA)

Abstract

The present invention provides a text command analyzing and processing method, which comprises the following procedures: when a character stream which contains text command strings is received, the text command strings are identified one by one from the character stream and are withdrawn, and the text command strings are stored in a buffer; a text command string waiting for processing is taken out of the buffer, and according to the grammar rule of the text command strings, a lexical analyzer makes a lexical analysis for the text command string waiting for processing, to obtain a command vocabulary; a grammar analyzer makes a grammar analysis for each command vocabulary in the command vocabulary, to obtain a grammar parsing tree; a semantic processor traverses the grammar parsing tree, to find a semantic attribute corresponding to each node, thus the accuracy of the command analyzing and the time efficiency are greatly improved through the present invention, and the analysis to the command strings with a complex nested structure can be realized.

Description

Text command analyzing and processing method
Technical field
The present invention relates to morphology, grammar analysis technique and the semantic processes technology of any interface protocol message based on the Text Command mode in the network communicating system, more specifically, relate to a kind of text command analyzing and processing method.
Background technology
Widely-used manmachine command interfacing such as modern data communication equipment such as switch, router etc., it provides the mode of simple strong operation and maintenance equipment to the user; By the also widely-used interface protocol based on the plain text command mode of the communication between the equipment of different vendor's exploitation, this has cross-platform advantage.
The subject matter that present many manmachine command interface systems exist on text command analyzing is not use technique of compiling to come command string is carried out syntactic analysis, and being to use the method for symbol string search to handle, this causes, and the syntactic analysis result's is inaccurate and inefficient.Significant example be during to the order of user's input and too strict, many spaces or Tab key also cause syntax error between the parameter, the time and seem too coarse, the user misses and has added several non-existent parameters, system also can accept unexpectedly.The system that has even have strange phenomenon, for some command parameter that brackets with quotation marks, if the internal character string of quotation marks exists command keyword or some spcial character, system just reports syntax error (and according to command syntax or protocol specification, the internal character string of quotation marks can be the combination of any character).
In addition, also there is not grammer in the prior art at the Text Command of nested structure, the special argumentation of semantic processes technology, yet the Text Command with nested structure has broad application prospects, the protocol communication between the network element device particularly, application product supply data library (the Provisioning DatabaseApplication that provides of Tekelec company for example, PDBA), the system of other companies is if the data among the visit PDBA, must connect the PDBA server as client, by supply data bank interface (Provisioning Database Interface, PDBI) interface protocol communicates with it, and the PDBI interface protocol just is to use the Text Command form with complicated nested structure.
Thereby prior art or method can't correctly be resolved this Text Command string.Text Command with nested structure is meant that the relation that is presented between its different command parameter has at least 1 layer of the superior and the subordinate's membership, as rsp (iid 1, and rc 0, data (dns (...))), order rsp has nested structure, because parameter d ns is under the jurisdiction of parameter d ata.
Summary of the invention
In view of described problem, the present invention proposes a kind of text command analyzing and processing method, it comprises corresponding morphological analysis technology, grammar analysis technique and semantic processes method, overcome the defective that aspect command analysis, exists in the existing processing method of at present a lot of systems, and the present invention makes also the plain text command string consistent with the processing method of nested structure Text Command string.
Text command analyzing and processing method according to the present invention mainly may further comprise the steps: step 1, and when receiving the character stream that comprises the Text Command string, from character stream, discern and extract the Text Command string one by one, and the Text Command string is deposited with in the buffer; Step 2 is taken out a pending Text Command string from buffer, according to the grammar rule of Text Command string, lexical analyzer carries out morphological analysis to described pending Text Command string, to obtain the order vocabulary; Step 3, syntax analyzer carries out syntactic analysis to each the order vocabulary in the described order vocabulary, to obtain parse tree; And step 4, semantic processor traversal parse tree finds the semantic attribute of each node correspondence, thereby obtains the User Defined structure.
Wherein, character stream comprises other Protocol Control Informations.Handle below carrying out in step 2: lexical analyzer scans character by character to pending Text Command string; When running into the character that can not discern, determine the morphological analysis failure, change the text command analyzing failure over to and handle; And when successfully discerning each character, obtain described order vocabulary.
Handle below in step 3, carrying out: drive the state transition of syntax analyzer according to the order vocabulary; And when order vocabulary sky, and syntax analyzer determines the syntactic analysis success when being in state of termination, obtain parse tree, otherwise the syntactic analysis failure changes the text command analyzing failure over to and handles.
Handle below carrying out in step 4: semantic processor carries out preorder traversal to parse tree; When having access to node of parse tree, inquiry semantic attribute table finds corresponding semantic attribute; If do not find corresponding semantic attribute, represent that then text order does not exist or the described keyword of this node does not exist, change the text command analyzing failure over to and handle; If find corresponding semantic attribute, then according to the indication structure User Defined structure of semantic attribute.
The semantic attribute table is the custom data structure, is Hash table, and its hash key is an attribute-name.Semantic attribute is described the semantic feature of a command keyword of a text order, semantic attribute comprises at least: attribute-name, storage class, data type and memory location are used to indicate the command analysis device should how to handle the information representation of the keyword of described Text Command.
Wherein, the text command analyzing failure is handled and is comprised: the misregistration daily record; And generate concrete error message.
Thereby, by the present invention, some defectives and the mistake of (symbolization string way of search) in the standing order analytic technique have been overcome, the accuracy and the time efficiency of command analysis have greatly been improved simultaneously, and can tackle the parsing of command string with complicated nested structure, this is that the standing order analytic technique is difficult to tackle.
In addition, adopt technical solution of the present invention and the command analysis utensil that designs has bigger flexibility and extensibility, can allow the user increase easily, delete and revise existing command set.
Other features and advantages of the present invention will be set forth in the following description, and, partly from specification, become apparent, perhaps understand by implementing the present invention.Purpose of the present invention and other advantages can realize and obtain by specifically noted structure in the specification of being write, claims and accompanying drawing.
Description of drawings
Accompanying drawing is used to provide further understanding of the present invention, and constitutes the part of specification, is used from explanation the present invention with embodiments of the invention one, is not construed as limiting the invention.In the accompanying drawings:
Fig. 1 is the flow chart according to text command analyzing and processing method of the present invention;
Fig. 2 is the text command analyzing device process chart according to the embodiment of the invention;
Fig. 3 is the PDBI morphological analysis DFA state diagram of the embodiment of the invention;
Fig. 4 is that the PDBI command syntax of the embodiment of the invention is analyzed finite state machine figure;
Fig. 5 is PDBI command syntax parsing tree (list of file names is arranged) schematic diagram of the embodiment of the invention;
Fig. 6 is PDBI command syntax parsing tree (anonymous tabulation) schematic diagram of the embodiment of the invention; And
Fig. 7 is that the semantic attribute of the embodiment of the invention is described figure.
Embodiment
Below in conjunction with accompanying drawing the preferred embodiments of the present invention are described, should be appreciated that preferred embodiment described herein only is used for description and interpretation the present invention, and be not used in qualification the present invention.
Fig. 1 is the flow chart according to text command analyzing and processing method of the present invention, and as shown in Figure 1, this method may further comprise the steps:
S102 when receiving the character stream that comprises the Text Command string, discerns and extracts described Text Command string one by one, and described Text Command string is deposited with in the buffer from described character stream;
S104 takes out a pending Text Command string from described buffer, according to the grammar rule of described Text Command string, lexical analyzer carries out morphological analysis to described pending Text Command string, to obtain the order vocabulary;
S106, syntax analyzer carries out syntactic analysis to each the order vocabulary in the described order vocabulary, to obtain parse tree; And
S108, semantic processor travel through described parse tree, find the semantic attribute of each node correspondence, thereby obtain the User Defined structure.
Wherein, character stream comprises other Protocol Control Informations.Handle below carrying out in S104: lexical analyzer scans character by character to pending Text Command string; When running into the character that can not discern, determine the morphological analysis failure, change the text command analyzing failure over to and handle; And when successfully discerning each character, obtain described order vocabulary.
Handle below in step S106, carrying out: drive the state transition of syntax analyzer according to the order vocabulary; And when order vocabulary sky, and syntax analyzer determines the syntactic analysis success when being in state of termination, obtain parse tree, otherwise the syntactic analysis failure changes the text command analyzing failure over to and handles.
Handle below carrying out in S108: semantic processor carries out preorder traversal to parse tree; When having access to node of parse tree, inquiry semantic attribute table finds corresponding semantic attribute; If do not find corresponding semantic attribute, represent that then the keyword that text order does not exist or this node place is described does not exist, change the text command analyzing failure over to and handle; If find corresponding semantic attribute, then according to the indication structure User Defined structure of semantic attribute.
Wherein, when finding corresponding semantic attribute, carry out following operation: whether whether each essential sub-attribute of checking this semantic attribute all exists, have default value to use when not existing; Storage class and data type according to this attribute judge whether to apply for new memory space, and apply for much memory spaces; The position offset of this attribute in father's property store space; And construct above-mentioned User Defined structure according to these indication informations.
The semantic attribute table is the custom data structure, is Hash table, and its hash key is an attribute-name.Semantic attribute is described the semantic feature of a command keyword of a text order, semantic attribute comprises at least: attribute-name, storage class, data type and memory location are used to indicate the command analysis device should how to handle the information representation of the keyword of described Text Command.
Wherein, the text command analyzing failure is handled and is comprised: the misregistration daily record; And generate concrete error message.
Fig. 2 is the text command analyzing device process chart according to the embodiment of the invention.As shown in Figure 2, the present invention is applied to the parsing of Text Command string to technique of compiling, has solved the deficiency of existing processing method effectively, comprises following 6 steps:
S202, communications protocol is handled, and is responsible for receiving the character stream that comprises the Text Command string from Correspondent Node, and this step may relate to pre-operations such as format conversion and deciphering, and its output is the text string of host system native language form;
S204, command recognition and buffer memory, from having comprised other Protocol Control Informations in the character string of client, the task of this step is exactly therefrom to discern and extract order one by one, and they are deposited in the command buffer;
S206, order is extracted, and whether also has still untreated order in the sense command buffer, if then do not finish the command analysis of this batch, otherwise takes out the pending command string of next bar;
S208, morphological analysis, grammar rule according to this order system, lexical analyzer (corresponding one define finite automaton DFA) to whole command string from the beginning to the end one by one character scan and (note, only need a scanning), wherein, when running into the character of current state nonrecognition, just judge the morphological analysis failure, the subsequent processes of this command string stops, changing command analysis failure processing module over to handles, in addition, in the process of morphological analysis, progressively generate syntactic element one by one, promptly order vocabulary, obtain an order vocabulary after the morphological analysis success;
S210, syntactic analysis, with of the input of order vocabulary as this stage, the migration that syntax analyzer (corresponding a finite state machine) comes driving condition with the input of order vocabulary, the state transition in each step all has specified action, up to the order vocabulary is empty, and state machine is in receive status (being state of termination), represent that syntactic analysis passes through this moment, otherwise, as long as running into the order vocabulary of not expecting under arbitrary state just judges syntax error, change command analysis failure processing module over to and handle.Obtain a parse tree after the syntactic analysis success; And
S212, semantic processes, the task of semantic processes are not command execution, but the information that order is transmitted is translated into the data representation of program inside, for further processing, the process of this semantic processes is exactly the process of traversal parse tree simultaneous search semantic attribute table.
Wherein, the semantic attribute table is a user-defined key data structure, is the mutual unique interface of user and command analysis device, is a Hash table.Article one, semantic attribute has been described the semantic feature of certain command keyword of a certain order, comprises information such as attribute-name, storage class, data type, memory location, is used to refer to the information representation how the command analysis device should handle this command keyword.Semantic processes begins preorder traversal from root node, the title of root node is ordered major key exactly, be command name, the title of intermediate node is the general orders keyword, as parameter keyword etc., may there be title yet, be called anonymous command keyword, as the anonymity tabulation, leafy node does not have title, have only value, but not leafy node void value all.When traversing certain non-leafy node, the title of the title of current node and each ancestors' node is contacted according to the order of sequence, separate with " " symbol between each node name is referred to as, as, level1_rootname forms the specification attributes name of this command keyword like this.Search for the semantic attribute table with this specification attributes name, if do not find the attribute that is complementary, just represent that this command keyword is illegal, change command analysis failure processing module over to and handle, otherwise storage is arrived appointed positions according to the requirement of the semantic attribute that retrieves.
In Fig. 2, we suppose that Text Command ganged up certain network communication protocol and carry, there is an assisted process in the text resolution device, being responsible for communication protocol specially handles, from communication message, identify the Text Command string that needs parsing, put into command buffer then one by one, the host process of text resolution device therefrom extracts parsing one by one.Carry out necessary initialization in the text resolution device starts, particularly set constructs a semantic attribute table according to user-defined semantic attribute (referring to Fig. 7), and this is a Hash table, and its hash key is an attribute-name.At first, carry out morphological analysis, the morphological analysis success just obtains an order vocabulary, then, syntax Analysis Module is as input, from the beginning sequential scanning each the order vocabulary, the order vocabulary is converted to a parse tree (referring to Fig. 5 and Fig. 6), at last, the semantic processes module is carried out preorder traversal to parse tree, and node of every visit is just inquired about the semantic attribute table one time, if do not find respective attributes, represent that this order does not exist or this keyword of this order does not exist, certainly also may be that user-defined semantic attribute is imperfect or wrong, find after the corresponding semantic attribute, just the operation that puts rules into practice according to its indication, comprise: whether each essential sub-attribute of checking this attribute all exists, whether there is default value to use when not existing, judges whether to apply for new memory space, apply for much memory spaces according to the storage class and the data type of this attribute, the position offset of this attribute in father's property store space, or the like.No matter morphological analysis, syntactic analysis, or semantic processes, as long as make a mistake, remaining process just all stops, and changes command analysis failure processing module over to, generation error daily record and concrete error message.Because to search semantic attribute is a very frequent operation, so operating efficiency seems and is even more important that the present invention uses Hash list data structure and algorithm, makes the search efficiency optimization.
Fig. 3 is the PDBI morphological analysis DFA state diagram of the embodiment of the invention, Fig. 4 analyzes finite state machine figure according to PDBI command syntax of the present invention, Fig. 5 is according to PDBI command syntax parsing tree of the present invention (list of file names is arranged) schematic diagram, Fig. 6 is according to PDBI command syntax parsing tree of the present invention (anonymous tabulation) schematic diagram, and Fig. 7 describes figure according to semantic attribute of the present invention.Text command analyzing and processing method of the present invention is described in detail to Fig. 7 below with reference to Fig. 3.
Below we illustrate with a specific embodiment how the technical scheme that the present invention proposes is implemented.We are example with the PDBI agreement of Tekelec company, and the PDBI agreement is an application communication agreement based on the Text Command string, and other system comes with PDB mutual by the PDBI agreement, comprise visit data, and additions and deletions change data, and management maintenance PDB etc.What be worth particularly pointing out is that the PDBI protocol command is the Text Command with complicated nested structure.According to morphology, the grammar property of PDBI protocol command system, we have constructed corresponding morphological analysis DFA state diagram (specifically as shown in Figure 3), syntactic analysis finite state machine figure (as shown in Figure 4), and it is described respectively below.
Fig. 3 has described the word-building rule of PDBI protocol command system, comprises the alphabet of acceptance, and special reserved word of this order system is as " (", ") ", " " ", " ' ", ", " etc.It is definite finite automaton (DFA) state diagram of equal value with it that constructs according to the PDBI order system word-building syntax.DFA is driven by the character of command string, filter out the separator between order vocabulary, extract vocabulary (perhaps being called word) one by one, what deserves to be mentioned is if run into the string argument that brackets with quotation marks, the DFA former state keeps whole string argument value (no matter what additional character this parameter value comprises), whole string argument value is put in the order vocabulary as just a vocabulary, is a character string (this in syntactic analysis time useful) indicating it on the flag bit simultaneously.The present invention adopts the method that increases the morphological analysis step, and does not use the employed symbol string search mode of existing a lot of command analysis, has overcome all drawbacks that the latter exists.
Fig. 4 has described the state transition diagram of the syntactic analysis finite state machine of PDBI protocol command system.It in fact also is a finite automaton, but it is not to drive with character, but the migration to order vocabulary to come driving condition.When initial, node pointer pn is initialized as sky, and en and bn are initialized as 0, and pw points to the gauge outfit of order vocabulary, and pw points to Next Command vocabulary after each state transition.During beginning, identify next order vocabulary when being command word, generate root node, pn points to root node, then enters " new command word " state, and (1) enters being operating as behind this state: be the name field assignment of pn node the value of the order vocabulary of pw sensing." new command word " state has the arc of 2 ejaculations, runs into that " when (", generate the binary tree left subtree node (pn points to new node, down with) of pn node, state transition is to " structure begins " state; When running into parameter value, generate the binary tree left subtree node of pn node, state transition is to " reading parameter value " state.(2) enter being operating as behind " structure begins " state: bn adds 1, and this state has the arc of 4 ejaculations, run into " when (", generate the binary tree left subtree node of pn node, state does not move, this be one from encircling arc; When running into parameter value, generate the binary tree left subtree node of pn node, state transition is to " reading parameter value " state; When running into command word, state transition is to " new command word " state; Run into ") " time, pn dates back to its father node, and state transition is to " structural constraint " state.Here produce a differentiation problem, for an order vocabulary, how to judge that it is command word or parameter value, we use this decision principle: every order vocabulary is marked as character string, perhaps ordering vocabulary is the numerical value beginning, be judged to be parameter value without exception, otherwise all think command word.This has just solved the ambiguity problem of order vocabulary, and the discrimination principle under other states is also like this.(3) enter being operating as behind " reading parameter value " state: is the value field assignment of pn node the value of the order vocabulary that points to of pw, and pn dates back to father node simultaneously.State has the arc of 2 ejaculations " to read parameter value ", when running into ", ", generates the binary tree right subtree node of pn node, and state transition is to " next command word " state; Run into ") " time, pn dates back to its father node, and state transition is to " structural constraint " state.(4) do not have extra operation after entering " next command word " state, this state has the arc of 3 ejaculations, and when running into command word, state transition is to " new command word " state; Run into that " when (", generate the binary tree left subtree node of pn node, state transition is to " structure begins " state; When running into parameter value, generate the binary tree left subtree node of pn node, state transition is to " reading parameter value " state.(5) enter being operating as behind " structural constraint " state: en adds 1, this state has the arc of 3 ejaculations, when bn equals en (this must be placed on the first step and judge), the syntactic structure of expression order is complete, if this moment, pw did not have Compass tail (sky), means to have unnecessary syntactic element, the command analysis failure, report syntax error, otherwise expression syntactic analysis success, state transition is to receive status (state of termination); When running into ", ", generate the binary tree right subtree node of pn node, state transition is to " next command word " state; Run into ") " time, pn dates back to its father node, and state does not move.After the syntactic analysis success, we have obtained a parse tree.As can be seen, this PDBI syntax analyzer can very efficiently inerrably be finished the syntactic analysis task, identifies any syntax error (sentence pattern syntax error), also can wrong not kill any correct command string.But should be clear and definite be to say that as aforementioned institute the present invention is this grammatical sentence pattern identification in the task of syntactic analysis phase, rather than sentence identification that should the syntax.
Below we provide the syntactic analysis results diagram of 2 command strings with nested structure, 2 have all comprised identical list parameter value, their difference is, a use has list of file names (Fig. 5), another uses anonymous tabulation (Fig. 6).It is that each list items has a name leading that list of file names is arranged, and as dn (dn 1212, and sp 666), anonymous tabulation does not then have, as (dn1212, sp 666).This syntax analyzer is all supported these 2 kinds of forms.
Fig. 5 has described the syntactic analysis result (parse tree) of following command string
rsp(iid?7,rc?0,
data(
dns(
dn(dn?1212,sp?666),
dn(dn?1213,sp?666),
dn(dn?1214,sp?666)
)
)
)
The title that can be clear that 3 direct descendants of dns node from figure all is dn, that is they are that list of file names is arranged.
Fig. 6 has described the syntactic analysis result (parse tree) of following command string
rsp(iid?7,rc?0,
data(
dns(
(dn?1212,sp?666),
(dn?1213,sp?666),
(dn?1214,sp?666)
)
)
)
Can be clear that from figure 3 direct descendants of dns node do not have title, that is their persons are anonymous tabulations.
Fig. 7 has provided the data structure of semantic attribute, and semantic attribute is unique interface of user and command analysis device, so particular importance.The once concrete implication and the usage of each field are described now: (1) attribute-name, it is a character string type, is the keyword of an attribute of unique identification, has overall uniqueness.In order to guarantee this uniqueness, the present invention has designed a title formation rule cleverly, exist tree type hierarchical relationship between each parameter keyword owing to order with nested structure, their relation is exactly that syntax parsing is set illustrated relation, the semantic attribute name is to construct so so: the title of parameter current keyword, and the back then is the title of his father's parameter keyword immediately following with " _ " underscore, the rest may be inferred, up to command name.Below for the example of famous semantic attribute, as the dn of Fig. 5 the attribute-name of list of file names being arranged is exactly dn_dns_data_rsp, for the example of an anonymous semantic attribute, the attribute-name of tabulating as the dn anonymity of figure five is exactly _ dns_data_rsp (noticing that before the underscore is empty) again.(2) storage class, it has described the storage mode of given command parameter, has defined 4 kinds of storage classes: 0, ultimate data, 1, structure, 2, common list, 3, the net value tabulation.Embodiment with the front illustrates, in the command string as Fig. 5 representative, iid and rc belong to ultimate data, and dns belongs to common list, and (dn 1212 for dn, sp 666) outer dn belong to structure, Fig. 5 and Fig. 6 do not have the net value list type, and we give an example separately, as number (111,222,333) the number parameter in just belongs to the net value tabulation.Here it should be explicitly made clear at this point and have only command word (comprising command name keyword and command parameter keyword) just will describe with semantic attribute, in iid 7, iid is the parameter keyword, need a semantic attribute to describe, 7 only is parameter value, do not need semantic description, so the storage class of iid is that the parameter value 7 that is used for describing it should be stored in which way.If parameter value is numerical value or character string, its storage class is exactly ultimate data so.If comprised the subparameter keyword of at least 2 kinds of different storage classes in the parameter value, it is exactly a structure.If there is and only has a kind of subparameter keyword of identical storage class in the parameter value, it is exactly a common list.Do not comprise any subparameter keyword if only comprise the tabulation of numerical value or character string in the parameter value, it is exactly the net value tabulation.(3) whether optional, described this parameter keyword and whether can lack, have only two kinds of values of true and false.When the semantic processes module traverses father node, whether this field by its each the sub-attribute of semantic attribute inspection under the father node is false, if then search the node that whether has respective name in its direct subparameter node, if do not find, what reexamine this sub-attribute has or not whether default value field (following being about to introduced) is true, if get its default value; If whether Optional Field is false and to have or not the default value field be false, just report semantic error.(4) higher level's attribute is the pointer that points to his father's semantic attribute, keeps in the future and uses.By it all semantic attributes of the same command are connected into one tree, the semantic attribute table is exactly a slice forest like this.(5) have or not default value, whether the parameter keyword that is illustrated in the representative of this attribute does not have the default value of appointment to use when not existing, and the default value field is just meaningful when this field is true.(6) default value, acquiescence designated parameters value when the parameter keyword that is illustrated in the representative of this attribute does not exist, this field is a character string type, the default value of non-character string type such as integer will convert character string type to and represent.(7) subordinate's attribute list, it is the pointer that points to subordinate's semantic attribute pointer list, can find the semantic attribute of all subparameter keywords by this field, thereby carry out some semantic test and processing.The bi-directional chaining that this field has been constructed an order with higher level's attribute field is set.(8) data type is described the data type of this parameter keyword, has defined 6 kinds of data types, and 0, character string, 1, integer, 2, floating type, 3, Boolean type, 4, user-defined type, 5, pointer type.The use of this field should be complementary with the storage class field, if when for example storage class is ultimate data type, data type can only be got any type of 0 to 3, can not get 4 or 5.(9) memory block size has been described the required maximum memory space of parameter value of storing this parameter keyword, in byte.It is identical when if data type is pointer type with the required space of argument of type integer of storage.(10) relative displacement, the side-play amount in the memory block of father's parameter keyword is put in the first place, memory block of having described this parameter keyword, in byte.As dn (dn 1212, and sp 666), suppose the dn of internal layer and the shaping number that sp is 2 bytes, the first place of establishing the memory block of outer dn again is changed to 0x00F0, and the relative displacement of sp is exactly 2 so, and the core position of sp physical memory regions is exactly 0x00F2~0x00F3.
In sum, adopt the description of technical scheme of the present invention, can can locate any morphology that it may exist very accurately to the parsing of any Text Command string, the mistake of grammer or semantic aspect, thereby assisting users corrects wrong spellings, and whole command analysis process adopts a scanning, rather than the method for the used symbol string search of at present a lot of systems, improved the time efficiency of command analysis so greatly, and avoided strange phenomenon on the existing processing method up hill and dale, as permitted a user to increase command string readability and the space of interpolation, Tab key or new line symbol are placed any legal spcial character in the parameter that also allows to bracket with quotation marks.
Can also find that from foregoing description the command analysis utensil that uses the present invention to construct has very strong extensibility and maintainability.In fact, in the present invention, syntactic analysis only is the parse of a sentential form to these order system syntax, and postpones till the semantic analysis stage differentiating the task whether a certain command string belong to this grammatical sentence, is equivalent to that also it is left for the user and decides.The advantage of doing like this is to make the order resolver have very strong extensibility and maintainability, and only additions and deletions change the semantic attribute table and just can increase, delete or change an order or its parameter keyword.
The designed command analysis method of the present invention can be used for resolving the Text Command string with nested structure, and this is to use symbol string search to come resolve command string method to accomplish.In the present invention, to the parsing of Text Command string with nested structure on handling process and the plain text command string do not have difference, their difference only is the complexity difference of syntax analyzer.Have nested structure the order system syntax analyzer than the syntax analyzer complexity of the order system of non-nested structure many.In the present invention, we regard the order system with nested structure as more general order system, and the normal commands system is regarded as its a kind of special case, or perhaps have the order system of zero nested structure.The designed command analysis method of the present invention is not only applicable to the parsing of plain text command string, and is applicable to the parsing to the Text Command string with nested structure too, and this makes general text command analyzing device framework of structure become possibility.
Be the preferred embodiments of the present invention only below, be not limited to the present invention, for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (8)

1. a text command analyzing and processing method is characterized in that, may further comprise the steps:
Step 1 when receiving the character stream that comprises the Text Command string, is discerned and is extracted described Text Command string one by one, and described Text Command string is deposited with in the buffer from described character stream;
Step 2 is taken out a pending Text Command string from described buffer, according to the grammar rule of described Text Command string, lexical analyzer carries out morphological analysis to described pending Text Command string, to obtain the order vocabulary;
Step 3, syntax analyzer carries out syntactic analysis to each the order vocabulary in the described order vocabulary, to obtain parse tree; And
Step 4, semantic processor travel through described parse tree, find the semantic attribute of each node correspondence, thereby obtain the User Defined structure.
2. method according to claim 1 is characterized in that described character stream comprises other Protocol Control Informations.
3. method according to claim 1 is characterized in that, handles below carrying out in described step 2:
Described lexical analyzer scans character by character to described pending Text Command string;
When running into the character that can not discern, determine the morphological analysis failure, change the text command analyzing failure over to and handle; And
When successfully discerning each character, obtain described order vocabulary.
4. method according to claim 1 is characterized in that, handles below carrying out in described step 3:
Drive the state transition of syntax analyzer according to described order vocabulary; And when described order vocabulary sky, and described syntax analyzer determines the syntactic analysis success when being in state of termination, obtain described parse tree, otherwise the syntactic analysis failure changes described text command analyzing failure over to and handles.
5. method according to claim 1 is characterized in that, carries out following the processing in the described step 4:
Described semantic processor carries out preorder traversal to described parse tree;
When having access to node of described parse tree, inquire about the semantic attribute table, find the semantic attribute of described correspondence;
If do not find the semantic attribute of described correspondence, represent that then the keyword that Text Command does not exist or described node place is described does not exist, change described text command analyzing failure over to and handle; And
If find the semantic attribute of described correspondence, then according to described semantic attribute structuring user's self-defined structure body.
6. method according to claim 5 is characterized in that, described semantic attribute table is the custom data structure, is Hash table, and its hash key is an attribute-name.
7. method according to claim 5 is characterized in that, described semantic attribute is described the semantic feature of a command keyword of a text order,
Wherein, described semantic attribute comprises at least: attribute-name, storage class, data type and memory location are used to indicate keyword how to handle described Text Command.
8. according to each described method in the claim 3 to 5, it is characterized in that described text command analyzing failure is handled and comprised:
The misregistration daily record; And
Generate concrete error message.
CNA2007101425526A 2007-08-29 2007-08-29 Text command analyzing and processing method Pending CN101110812A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNA2007101425526A CN101110812A (en) 2007-08-29 2007-08-29 Text command analyzing and processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA2007101425526A CN101110812A (en) 2007-08-29 2007-08-29 Text command analyzing and processing method

Publications (1)

Publication Number Publication Date
CN101110812A true CN101110812A (en) 2008-01-23

Family

ID=39042705

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA2007101425526A Pending CN101110812A (en) 2007-08-29 2007-08-29 Text command analyzing and processing method

Country Status (1)

Country Link
CN (1) CN101110812A (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156704A (en) * 2011-01-26 2011-08-17 北京沃泰丰通信技术有限公司 Method and system for filtering detailed call records
CN102521250A (en) * 2011-11-16 2012-06-27 中国电子科技集团公司第四十一研究所 Method for implementing universal syntactic analysis of intelligent measuring instrument
CN102880471A (en) * 2012-09-24 2013-01-16 中兴通讯股份有限公司 Command execution method based on command line and command line operating system
WO2017016286A1 (en) * 2015-07-24 2017-02-02 中兴通讯股份有限公司 Multi-language semantic parsing method and apparatus
CN107634957A (en) * 2017-09-29 2018-01-26 深圳迪贝守望信息技术有限公司 Data and file operation based on agency by agreement pre- store method and system in real time
CN107704453A (en) * 2017-10-23 2018-02-16 深圳市前海众兴电子商务有限公司 A kind of word semantic analysis, word semantic analysis terminal and storage medium
CN108600030A (en) * 2018-05-10 2018-09-28 武汉虹信通信技术有限责任公司 Notification filter method is ordered in the monitoring of network management system north orientation
CN108920232A (en) * 2018-06-20 2018-11-30 维沃移动通信有限公司 A kind of processing method and terminal device of target object
CN109726185A (en) * 2018-12-28 2019-05-07 杭州安恒信息技术股份有限公司 A kind of log analytic method, system and computer-readable medium based on syntax tree
CN109933786A (en) * 2019-02-13 2019-06-25 卡斯柯信号有限公司 The construction method of transponder message tool based on compiling rule
CN109935230A (en) * 2019-04-01 2019-06-25 北京宇航系统工程研究所 A kind of survey hair password monitoring system and method based on voice driven
CN110851400A (en) * 2018-07-25 2020-02-28 北京国双科技有限公司 Text data processing method and device
CN111026377A (en) * 2019-11-21 2020-04-17 中国航空工业集团公司西安航空计算技术研究所 Calling display list pre-decoding method based on finite-state machine
CN112069788A (en) * 2020-09-10 2020-12-11 杭州安恒信息技术股份有限公司 Method, device and equipment for analyzing yaml file and storage medium
CN114999474A (en) * 2022-05-14 2022-09-02 云知声智能科技股份有限公司 Method and device for updating offline wake-up word or command word, electronic equipment and storage medium
CN115982059A (en) * 2023-03-21 2023-04-18 麒麟软件有限公司 Method for implementing Shell script checking tool

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156704A (en) * 2011-01-26 2011-08-17 北京沃泰丰通信技术有限公司 Method and system for filtering detailed call records
CN102521250A (en) * 2011-11-16 2012-06-27 中国电子科技集团公司第四十一研究所 Method for implementing universal syntactic analysis of intelligent measuring instrument
CN102521250B (en) * 2011-11-16 2014-09-17 中国电子科技集团公司第四十一研究所 Method for implementing universal syntactic analysis of intelligent measuring instrument
CN102880471A (en) * 2012-09-24 2013-01-16 中兴通讯股份有限公司 Command execution method based on command line and command line operating system
WO2014044099A1 (en) * 2012-09-24 2014-03-27 中兴通讯股份有限公司 Command execution method based on command line and command line operating system
WO2017016286A1 (en) * 2015-07-24 2017-02-02 中兴通讯股份有限公司 Multi-language semantic parsing method and apparatus
CN107634957B (en) * 2017-09-29 2021-08-10 深圳迪贝守望信息技术有限公司 Protocol agent-based real-time data and file operation pre-saving method and system
CN107634957A (en) * 2017-09-29 2018-01-26 深圳迪贝守望信息技术有限公司 Data and file operation based on agency by agreement pre- store method and system in real time
CN107704453A (en) * 2017-10-23 2018-02-16 深圳市前海众兴电子商务有限公司 A kind of word semantic analysis, word semantic analysis terminal and storage medium
CN107704453B (en) * 2017-10-23 2021-10-08 深圳市前海众兴科研有限公司 Character semantic analysis method, character semantic analysis terminal and storage medium
CN108600030A (en) * 2018-05-10 2018-09-28 武汉虹信通信技术有限责任公司 Notification filter method is ordered in the monitoring of network management system north orientation
CN108600030B (en) * 2018-05-10 2022-03-04 武汉虹信科技发展有限责任公司 Northbound monitoring ordering notice filtering method for network management system
CN108920232A (en) * 2018-06-20 2018-11-30 维沃移动通信有限公司 A kind of processing method and terminal device of target object
CN108920232B (en) * 2018-06-20 2021-06-22 维沃移动通信有限公司 Target object processing method and terminal equipment
CN110851400B (en) * 2018-07-25 2023-01-17 北京国双科技有限公司 Text data processing method and device
CN110851400A (en) * 2018-07-25 2020-02-28 北京国双科技有限公司 Text data processing method and device
CN109726185A (en) * 2018-12-28 2019-05-07 杭州安恒信息技术股份有限公司 A kind of log analytic method, system and computer-readable medium based on syntax tree
CN109726185B (en) * 2018-12-28 2020-12-25 杭州安恒信息技术股份有限公司 Log parsing method, system and computer readable medium based on syntax tree
CN109933786A (en) * 2019-02-13 2019-06-25 卡斯柯信号有限公司 The construction method of transponder message tool based on compiling rule
CN109933786B (en) * 2019-02-13 2022-08-30 卡斯柯信号有限公司 Method for constructing responder message tool based on compiling rule
CN109935230A (en) * 2019-04-01 2019-06-25 北京宇航系统工程研究所 A kind of survey hair password monitoring system and method based on voice driven
CN111026377A (en) * 2019-11-21 2020-04-17 中国航空工业集团公司西安航空计算技术研究所 Calling display list pre-decoding method based on finite-state machine
CN111026377B (en) * 2019-11-21 2023-03-14 中国航空工业集团公司西安航空计算技术研究所 Calling display list pre-decoding method based on finite-state machine
CN112069788A (en) * 2020-09-10 2020-12-11 杭州安恒信息技术股份有限公司 Method, device and equipment for analyzing yaml file and storage medium
CN114999474A (en) * 2022-05-14 2022-09-02 云知声智能科技股份有限公司 Method and device for updating offline wake-up word or command word, electronic equipment and storage medium
CN115982059A (en) * 2023-03-21 2023-04-18 麒麟软件有限公司 Method for implementing Shell script checking tool

Similar Documents

Publication Publication Date Title
CN101110812A (en) Text command analyzing and processing method
US7552116B2 (en) Method and system for extracting web query interfaces
CN104657440B (en) Structured query statement generation system and method
CN110362597A (en) A kind of structured query language SQL injection detection method and device
CN104850574B (en) A kind of filtering sensitive words method of text-oriented information
US20100023318A1 (en) Method and device for retrieving data and transforming same into qualitative data of a text-based document
CN103365992B (en) Method for realizing dictionary search of Trie tree based on one-dimensional linear space
US9110852B1 (en) Methods and systems for extracting information from text
CN104657439A (en) Generation system and method for structured query sentence used for precise retrieval of natural language
JPH11242676A (en) Method for registering structured document, method for retrieving structured document, and portable medium used in these methods
IES20020647A2 (en) A data quality system
Ferrara et al. Automatic wrapper adaptation by tree edit distance matching
CN112182022A (en) Data query method and device based on natural language and translation model
CN111190873B (en) Log mode extraction method and system for log training of cloud native system
EA037156B1 (en) Method for template match searching in a text
CN117807137A (en) Rule-based SQL (structured query language) to PromQL (PromQL) conversion method
CN116467047A (en) Method and device for detecting container configuration compliance, storage medium and terminal
CN103049434A (en) System and method for identifying anagrams
CN111552856B (en) Microblog public opinion propagation path analysis method
CN108614842B (en) Method and device for querying data
CN113239039A (en) Dynamic data storage method, query method, management method and management system
KR101225333B1 (en) System and method using tree pattern expression for extraction information from syntactically parsed text corpora
JP4866844B2 (en) Efficient extraction of XML content stored in a LOB
CN105956126A (en) XML (X Exrensible Markup Language) query method based on primary and secondary classification of keywords
Truskinger et al. Reconciling folksonomic tagging with taxa for bioacoustic annotations

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20080123