CN111435406A - Method and device for correcting database statement spelling errors - Google Patents

Method and device for correcting database statement spelling errors Download PDF

Info

Publication number
CN111435406A
CN111435406A CN201910031911.3A CN201910031911A CN111435406A CN 111435406 A CN111435406 A CN 111435406A CN 201910031911 A CN201910031911 A CN 201910031911A CN 111435406 A CN111435406 A CN 111435406A
Authority
CN
China
Prior art keywords
keyword
name
metadata
table name
names
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
CN201910031911.3A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910031911.3A priority Critical patent/CN111435406A/en
Publication of CN111435406A publication Critical patent/CN111435406A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

The invention discloses a method and a device for correcting a database statement spelling error, and relates to the technical field of computers. One embodiment of the method comprises: obtaining a table name behind a first keyword in a target sentence; determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata; and displaying the table names in the metadata in a prompt page of the table names behind the first keyword according to the sequence of the comprehensive similarity from high to low so as to correct the spelling error of the target sentence. Because the implementation mode adopts the technical means of performing the association prompt based on the similarity of the table names, the technical problem that a non-relational distributed database does not have a formed pre-prompt function is solved, and meanwhile, the condition that the association prompt is performed on the relational database based on the alphabetical order of the table names or the field names to cause result errors is avoided, so that a more accurate error correction effect is achieved.

Description

Method and device for correcting database statement spelling errors
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for correcting spelling errors of database sentences.
Background
The traditional relational data is gradually replaced by the current distributed database, and the most typical distributed database is the hive database. In terms of statement error correction, a development tool of a relational database can well prompt table names or field names in the development process, and after inputting a library name or dotting after the table name is input, a query analyzer can prompt all tables under the library name and all fields under the table. The function of the pre-prompting avoids grammar errors caused by spelling errors to a certain extent. However, when the statement development on the distributed database encounters syntax errors, the error correction is not facilitated by the relational database, and the problem can be solved only after errors are reported during compiling.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
1. at present, the pre-prompting function appears in a relational database, and a non-relational distributed database is not formed at present.
2. Although the function of pre-prompting of the relational database can avoid word spelling errors finally, similar words exist, prompting is performed on the basis of letter sequences of table names/field names, if developers memorize fuzzy table names or field names and cannot accurately memorize the sequence of each letter, the developers can also select errors finally when selecting the table names or the field names, finally, the errors are not spelling errors but result errors, and the queried results are not actually required data.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for correcting a database statement spelling error, which can provide a method for performing pre-hint error correction on statements during SQ L development for a non-relational distributed database, and meanwhile, a resultant error will not occur as if the relational database performs associative hints based on alphabetic order of table names or field names.
To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a method for correcting a spelling error of a database statement, including: obtaining a table name behind a first keyword in a target sentence; determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata; and displaying the table names in the metadata in a prompt page of the table names behind the first keyword according to the sequence of the comprehensive similarity from high to low so as to correct the spelling error of the target sentence.
Optionally, the determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata includes: determining letters and the number thereof contained in the table name after the first keyword and letters and the number thereof contained in the table name in the metadata; determining the letter type similarity between the table name after the first keyword and the table name in the metadata according to letters and the number thereof contained in the table name, and sequencing the table name in the metadata according to the sequence of the letter type similarity from high to low to obtain a first sequence; determining the alphabetic sequence similarity between the table names after the first keyword and the table names in the metadata according to the order of letters in the table names, and sequencing the table names in the metadata according to the order of the alphabetic sequence similarity from high to low to obtain a second sequence; and performing weighted summation processing on the table names in the metadata in the first sequence and the second sequence, and taking the obtained sum as the comprehensive similarity between the table name after the first keyword and the table name in the database metadata.
Optionally, the determining letters and the number thereof included in the table name after the first keyword and the letters and the number thereof included in the table name in the metadata includes: determining letters and the number thereof contained in the table name after the first keyword, and taking the letters as screening letters; screening the table names containing any screening letters from the table names in the metadata, and determining the letters and the number thereof contained in the screened table names; and taking the screened table name as the table name in the new metadata.
Optionally, after the table name after the first keyword in the target sentence is obtained, the method further includes: judging whether the table name after the first keyword is the same as the table name in the metadata, if so, then: acquiring a field name behind a second keyword in the target sentence; determining a field name of the surface and the back surface corresponding to the table name behind the first keyword from database metadata, and taking the field name as a first field name to be matched; determining the overall similarity between the field name after the second keyword and the first field name to be matched; and displaying the first field name to be matched in a prompt page of the field names behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field names of the target sentences.
Optionally, after the table names in the metadata are displayed in the prompt page of the table names after the first keyword in order from high to low of the comprehensive similarity, to correct the spelling error of the target sentence, the method further includes: selecting any table name from table names in the metadata displayed in a prompt page as a target table name; acquiring a field name behind a second keyword in the target sentence; determining a field name of the surface and the inside corresponding to the target table name from database metadata, and taking the field name as a second field name to be matched;
determining the overall similarity between the field name after the second keyword and the second field name to be matched;
and displaying the second field name to be matched in a prompt page of the field name behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field name of the target sentence.
Optionally, the obtaining the table name after the first keyword in the target sentence includes: judging whether the number of the first keywords in the target sentence is 1 or not; if so, acquiring a table name behind the first keyword in the target sentence; if not, ending the error correction process of the target statement.
According to another aspect of the embodiments of the present invention, there is provided an apparatus for correcting spelling errors of database sentences, including: an acquisition module to: obtaining a table name behind a first keyword in a target sentence; a similarity matching module to: determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata; a result output module to: and displaying the table names in the metadata in a prompt page of the table names behind the first keyword according to the sequence of the comprehensive similarity from high to low so as to correct the spelling error of the target sentence.
Optionally, the similarity matching module is further configured to: determining letters and the number thereof contained in the table name after the first keyword and letters and the number thereof contained in the table name in the metadata; determining the letter type similarity between the table name after the first keyword and the table name in the metadata according to letters and the number thereof contained in the table name, and sequencing the table name in the metadata according to the sequence of the letter type similarity from high to low to obtain a first sequence; determining the alphabetic sequence similarity between the table names after the first keyword and the table names in the metadata according to the order of letters in the table names, and sequencing the table names in the metadata according to the order of the alphabetic sequence similarity from high to low to obtain a second sequence; and performing weighted summation processing on the table names in the metadata in the first sequence and the second sequence, and taking the obtained sum as the comprehensive similarity between the table name after the first keyword and the table name in the database metadata.
Optionally, the similarity matching module is further configured to: determining letters and the number thereof contained in the table name after the first keyword, and taking the letters as screening letters; screening the table names containing any screening letters from the table names in the metadata, and determining the letters and the number thereof contained in the screened table names; and taking the screened table name as the table name in the new metadata.
Optionally, the apparatus further comprises a word judgment module, configured to: judging whether the table name after the first keyword is the same as the table name in the metadata, if so, then: acquiring a field name behind a second keyword in the target sentence; determining a field name of the surface and the back surface corresponding to the table name behind the first keyword from database metadata, and taking the field name as a first field name to be matched; determining the overall similarity between the field name after the second keyword and the first field name to be matched; and displaying the first field name to be matched in a prompt page of the field names behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field names of the target sentences.
Optionally, the apparatus further includes a field name error correction module, configured to: selecting any table name from table names in the metadata displayed in a prompt page as a target table name; acquiring a field name behind a second keyword in the target sentence; determining a field name of the surface and the inside corresponding to the target table name from database metadata, and taking the field name as a second field name to be matched; determining the overall similarity between the field name after the second keyword and the second field name to be matched; and displaying the second field name to be matched in a prompt page of the field name behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field name of the target sentence.
Optionally, the obtaining module is further configured to: judging whether the number of the first keywords in the target sentence is 1 or not; if so, acquiring a table name behind the first keyword in the target sentence; if not, ending the error correction process of the target statement.
According to still another aspect of an embodiment of the present invention, there is provided an electronic apparatus including: one or more processors; a storage device, configured to store one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for correcting a spelling error of a database statement as provided by an embodiment of the present invention.
According to still another aspect of the embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements a method for correcting a spelling error of a database statement according to the embodiments of the present invention.
The embodiment of the invention has the advantages that the technical means of performing association prompt based on the similarity of the table names is adopted, so that the technical problem that a non-relational distributed database has no formed pre-prompt function is solved, the method for performing pre-prompt error correction on sentences during SQ L development is provided for the non-relational distributed database, and meanwhile, the condition that the association prompt based on the letter sequence of the table names or the field names of the relational database is performed to cause result errors is avoided, and further, a more accurate error correction effect is achieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a basic flow of a method for correcting a spelling error of a database statement according to an embodiment of the present invention;
FIG. 2 is a flowchart of a preferred embodiment of table name determination after table names after a first keyword are obtained;
FIG. 3 is a flowchart diagram of a preferred embodiment of determining the integrated similarity of table names after a first keyword to table names in database metadata;
FIG. 4 is a flowchart illustrating a preferred embodiment of obtaining a table name after a first keyword in a target sentence;
FIG. 5 is a schematic diagram of a preferred flow of a method of correcting a database statement spelling error according to an embodiment of the invention;
FIG. 6 is a diagram illustrating basic modules of an apparatus for correcting misspelling of a database statement according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a diagram illustrating a basic flow of a method for correcting spelling errors of database sentences according to an embodiment of the present invention. As shown in fig. 1, an embodiment of the present invention provides a method for correcting a spelling error of a database statement, including:
s101, obtaining a table name after a first keyword in a target sentence;
s102, determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata;
and S103, according to the sequence of the comprehensive similarity from high to low, displaying the table names in the metadata in a prompt page of the table names behind the first keyword so as to correct the spelling errors of the target sentence.
The keywords comprise but are not limited to three words of select, from and where, but are only common and inherent keywords in the query function.
The embodiment of the invention adopts the technical means of performing association prompt based on the similarity of table names, so the technical problem that a non-relational distributed database has no formed pre-prompt function is solved, and the method for performing pre-prompt error correction on sentences during SQ L development is provided for the non-relational distributed database, and meanwhile, the condition that the association prompt is performed on the relational database based on the alphabetic sequence of the table names or the field names to cause result errors can not occur, so that a more accurate error correction effect is achieved.
In step S102 of the embodiment of the present invention, the determining the comprehensive similarity between the table name after the first keyword and the table name in the metadata of the database includes: determining letters and the number thereof contained in the table name after the first keyword and letters and the number thereof contained in the table name in the metadata; determining the letter type similarity between the table name after the first keyword and the table name in the metadata according to letters and the number thereof contained in the table name, and sequencing the table name in the metadata according to the sequence of the letter type similarity from high to low to obtain a first sequence; determining the alphabetic sequence similarity between the table names after the first keyword and the table names in the metadata according to the order of letters in the table names, and sequencing the table names in the metadata according to the order of the alphabetic sequence similarity from high to low to obtain a second sequence; and performing weighted summation processing on the table names in the metadata in the first sequence and the second sequence, and taking the obtained sum as the comprehensive similarity between the table name after the first keyword and the table name in the database metadata.
Based on the above embodiment, the determining of the first keyword includes determining the number of the letters included in the table name after the first keyword is determined, and determining the number of the letters included in the table name in the metadata, including: determining letters and the number thereof contained in the table name after the first keyword, and taking the letters as screening letters; screening the table names containing any screening letters from the table names in the metadata, and determining the letters and the number thereof contained in the screened table names; and taking the screened table name as the table name in the new metadata.
Determining the letter type similarity between the table name after the first keyword and the table name in the new metadata according to letters and the number thereof contained in the table name, and sequencing the table names in the new metadata according to the sequence of the letter type similarity from high to low to obtain a first sequence; determining the alphabetic sequence similarity between the table name after the first keyword and the table name in the new metadata according to the alphabetic sequence in the table names, and sequencing the table names in the new metadata according to the sequence from high to low of the alphabetic sequence similarity to obtain a second sequence; and performing weighted summation processing on the table names in the new metadata in the first sequence and the second sequence, and taking the obtained sum as the comprehensive similarity between the table name after the first keyword and the table name in the database metadata.
In this embodiment of the present invention, after the step S101 of obtaining the table name after the first keyword in the target sentence, the method further includes: judging whether the table name behind the first keyword is the same as the table name in the metadata or not; if the same, the table name after the first keyword is described to be correct, and error correction is not needed, the method is to correct the field name under the table, and specifically includes: acquiring a field name behind a second keyword in the target sentence; determining a field name of the surface and the back surface corresponding to the table name behind the first keyword from database metadata, and taking the field name as a first field name to be matched; determining the overall similarity between the field name after the second keyword and the first field name to be matched; and displaying the first field name to be matched in a prompt page of the field names behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field names of the target sentences. If the table names after the first keyword are different, it is described that the table names after the first keyword are wrong, and error correction processing needs to be performed on the table names after the first keyword according to the foregoing embodiment. The logic for determining the overall similarity between the field name after the second keyword and the second field name to be matched is the same as the logic for determining the comprehensive similarity of the table names, and it can be understood by those skilled in the art that the description is omitted here.
Specifically, an example is provided for error correction of table names and field names in a target sentence:
1) fig. 2 is a flowchart of a preferred embodiment of determining the table name after acquiring the table name after the first keyword, and as shown in fig. 2, acquiring the table name tableA after the first keyword from, determining whether the table exists from the metadata, if the table name tableA is not wrong, executing step 3), and if the table name tableA exists, entering step 2).
2) Fig. 3 is a schematic flowchart of a preferred embodiment of determining the comprehensive similarity between the table name after the first keyword and the table name in the metadata of the database, as shown in fig. 3, when the table name is already correct, a field name is obtained from behind the second keywords select and where, the table corresponding to the table structure is found from the metadata for comparing the field names, and if no description exists, the field name needs to be corrected, the process proceeds to 7); if yes, the target statement has no error, spelling error correction is directly finished, the statement operation log is printed, and the execution condition of the statement is monitored.
3) Counting letters and the number of letters contained in the wrong table name "tableA", wherein the letters can be called screening letters; then, table names of any screened letters appear in the matched table names in the metadata, the table names form an array for storage, and the number of each letter of the table names in the array tablelist is counted.
4) The letter type number and letter number of the screened letters are compared with the table name in the numerical value tablelist, 20 letters with the closest letter type number and letter number are selected, and a ranking is given to serve as the first sequence. This "20" is adjustable, depending on the number of tables in each library.
5) And comparing the selected 20 closest table names with the wrong table name 'tableA' in alphabetical order, matching the sequence similarity, and giving a ranking as a second sequence.
6) And (3) combining and ranking the two ranks according to the weight of 50% and 50% to obtain a new rank as a third sequence. These 20, possibly correct table names are displayed on the prompt page in the order of the third sequence for selection by the developer.
7) Field name similarity matching and table name similarity matching 3) -6), one more process is to find all field names in the correct table name (or table name selected by developer) from the metadata, and then perform the following matching logic.
In step S103 of the embodiment of the present invention, after the table names in the metadata are displayed in the prompt page of the table names after the first keyword in order from high to low of the comprehensive similarity, so as to correct the spelling error of the target sentence, the method further includes: selecting any table name from table names in the metadata displayed in a prompt page as a target table name; acquiring a field name behind a second keyword in the target sentence; determining a field name of the surface and the inside corresponding to the target table name from database metadata, and taking the field name as a second field name to be matched; determining the overall similarity between the field name after the second keyword and the second field name to be matched; and displaying the second field name to be matched in a prompt page of the field name behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field name of the target sentence.
Fig. 4 is a schematic flowchart of a preferred embodiment of obtaining a table name after a first keyword in a target sentence, and as shown in fig. 4, in step S101 in the embodiment of the present invention, the obtaining a table name after a first keyword in a target sentence includes: judging whether the number of the first keywords in the target sentence is 1 or not; if so, acquiring a table name behind the first keyword in the target sentence; if not, ending the error correction process of the target statement.
FIG. 5 is a diagram illustrating a preferred flow of a method for correcting spelling errors of database statements according to an embodiment of the present invention. As shown in fig. 5, the flow of all the above embodiments is summarized, and will not be described in detail here.
An embodiment of the present invention provides an apparatus 600 for correcting a spelling error of a database statement, including: an obtaining module 601, configured to: obtaining a table name behind a first keyword in a target sentence; a similarity matching module 602 configured to: determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata; a result output module 603 configured to: and displaying the table names in the metadata in a prompt page of the table names behind the first keyword according to the sequence of the comprehensive similarity from high to low so as to correct the spelling error of the target sentence.
In this embodiment of the present invention, the similarity matching module is further configured to: determining letters and the number thereof contained in the table name after the first keyword and letters and the number thereof contained in the table name in the metadata; determining the letter type similarity between the table name after the first keyword and the table name in the metadata according to letters and the number thereof contained in the table name, and sequencing the table name in the metadata according to the sequence of the letter type similarity from high to low to obtain a first sequence; determining the alphabetic sequence similarity between the table names after the first keyword and the table names in the metadata according to the order of letters in the table names, and sequencing the table names in the metadata according to the order of the alphabetic sequence similarity from high to low to obtain a second sequence; and performing weighted summation processing on the table names in the metadata in the first sequence and the second sequence, and taking the obtained sum as the comprehensive similarity between the table name after the first keyword and the table name in the database metadata.
In this embodiment of the present invention, the similarity matching module is further configured to: determining letters and the number thereof contained in the table name after the first keyword, and taking the letters as screening letters; screening the table names containing any screening letters from the table names in the metadata, and determining the letters and the number thereof contained in the screened table names; and taking the screened table name as the table name in the new metadata.
In an embodiment of the present invention, the apparatus further includes a word judgment module, configured to: judging whether the table name after the first keyword is the same as the table name in the metadata, if so, then: acquiring a field name behind a second keyword in the target sentence; determining a field name of the surface and the back surface corresponding to the table name behind the first keyword from database metadata, and taking the field name as a first field name to be matched; determining the overall similarity between the field name after the second keyword and the first field name to be matched; and displaying the first field name to be matched in a prompt page of the field names behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field names of the target sentences.
In an embodiment of the present invention, the apparatus further includes a field name error correction module, configured to: selecting any table name from table names in the metadata displayed in a prompt page as a target table name; acquiring a field name behind a second keyword in the target sentence; determining a field name of the surface and the inside corresponding to the target table name from database metadata, and taking the field name as a second field name to be matched; determining the overall similarity between the field name after the second keyword and the second field name to be matched; and displaying the second field name to be matched in a prompt page of the field name behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field name of the target sentence.
In the embodiment of the present invention, the obtaining module is further configured to: judging whether the number of the first keywords in the target sentence is 1 or not; if so, acquiring a table name behind the first keyword in the target sentence; if not, ending the error correction process of the target statement.
And displaying the table names and the field names which are possibly correct on the prompt page according to the similarity matching result and the ranking order, so that the error correction range of developers is greatly reduced, and the table names or the field names in the sentences can be quickly corrected through the output result. The table name and the field name corresponding to the wrong table name or field name with high correlation are found through a character string matching algorithm (namely, a method for calculating similarity), and the table name and the field name which are most possibly needed by a developer are guessed to the greatest extent through the high correlation matching.
FIG. 7 illustrates an exemplary system architecture 700 for a method of correcting a database statement spelling error or an apparatus for correcting a database statement spelling error to which embodiments of the present invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. Various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like, may be installed on the terminal devices 701, 702, and 703.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 701, 702, and 703. The background management server can analyze and process the received data such as the product information query request and feed back the processing result such as the target push information to the terminal equipment.
It should be noted that the method for correcting spelling errors of database sentences provided in the embodiments of the present invention is generally executed by the server 705, and accordingly, the apparatus for correcting spelling errors of database sentences is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The invention also provides an electronic device and a readable storage medium according to the embodiment of the invention.
The electronic device of the present invention includes: one or more processors; a storage device, configured to store one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for correcting a spelling error of a database statement as provided by an embodiment of the present invention.
The computer readable medium of the present invention stores thereon a computer program, which when executed by a processor implements a method for correcting a spelling error of a database statement as provided by an embodiment of the present invention.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
To the I/O interface 805, AN input section 806 including a keyboard, a mouse, and the like, AN output section 807 including a network interface card such as a Cathode Ray Tube (CRT), a liquid crystal display (L CD), and the like, a speaker, and the like, a storage section 808 including a hard disk, and the like, and a communication section 809 including a network interface card such as a L AN card, a modem, and the like are connected, the communication section 809 performs communication processing via a network such as the internet, a drive 810 is also connected to the I/O interface 805 as necessary, a removable medium 811 such as a magnetic disk, AN optical disk, a magneto-optical disk, a semiconductor memory, and the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted into the storage section 808 as.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, 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 or flowchart illustration, and combinations of blocks in the block diagrams 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.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprising: the device comprises an acquisition module, a similarity matching module and a result output module. The names of these modules do not in some cases form a limitation on the modules themselves, and for example, the business unit obtaining module may also be described as a "module for obtaining a table name after the first keyword in the target sentence".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: obtaining a table name behind a first keyword in a target sentence; determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata; and displaying the table names in the metadata in a prompt page of the table names behind the first keyword according to the sequence of the comprehensive similarity from high to low so as to correct the spelling error of the target sentence.
The embodiment of the invention adopts the technical means of performing association prompt based on the similarity of table names, so the technical problem that a non-relational distributed database has no formed pre-prompt function is solved, and the method for performing pre-prompt error correction on sentences during SQ L development is provided for the non-relational distributed database, and meanwhile, the condition that the association prompt is performed on the relational database based on the alphabetic sequence of the table names or the field names to cause result errors can not occur, so that a more accurate error correction effect is achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and 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 method for correcting a database statement misspelling, comprising:
obtaining a table name behind a first keyword in a target sentence;
determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata;
and displaying the table names in the metadata in a prompt page of the table names behind the first keyword according to the sequence of the comprehensive similarity from high to low so as to correct the spelling error of the target sentence.
2. The method of claim 1, wherein determining the integrated similarity between the table name after the first keyword and the table name in the database metadata comprises:
determining letters and the number thereof contained in the table name after the first keyword and letters and the number thereof contained in the table name in the metadata;
determining the letter type similarity between the table name after the first keyword and the table name in the metadata according to letters and the number thereof contained in the table name, and sequencing the table name in the metadata according to the sequence of the letter type similarity from high to low to obtain a first sequence;
determining the alphabetic sequence similarity between the table names after the first keyword and the table names in the metadata according to the order of letters in the table names, and sequencing the table names in the metadata according to the order of the alphabetic sequence similarity from high to low to obtain a second sequence;
and performing weighted summation processing on the table names in the metadata in the first sequence and the second sequence, and taking the obtained sum as the comprehensive similarity between the table name after the first keyword and the table name in the database metadata.
3. The method of claim 2, wherein the determining of the letters and the number thereof contained in the table name after the first keyword and the letters and the number thereof contained in the table name in the metadata comprises:
determining letters and the number thereof contained in the table name after the first keyword, and taking the letters as screening letters;
screening the table names containing any screening letters from the table names in the metadata, and determining the letters and the number thereof contained in the screened table names;
and taking the screened table name as the table name in the new metadata.
4. The method of claim 1, wherein after obtaining the table name after the first keyword in the target sentence, the method further comprises:
judging whether the table name after the first keyword is the same as the table name in the metadata, if so, then:
acquiring a field name behind a second keyword in the target sentence;
determining a field name of the surface and the back surface corresponding to the table name behind the first keyword from database metadata, and taking the field name as a first field name to be matched;
determining the overall similarity between the field name after the second keyword and the first field name to be matched;
and displaying the first field name to be matched in a prompt page of the field names behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field names of the target sentences.
5. The method according to claim 1, wherein after displaying the table names in the metadata in the prompt page of the table names after the first keyword in order from high to low of the comprehensive similarity, so as to correct spelling errors of the target sentence, further comprising:
selecting any table name from table names in the metadata displayed in a prompt page as a target table name;
acquiring a field name behind a second keyword in the target sentence;
determining a field name of the surface and the inside corresponding to the target table name from database metadata, and taking the field name as a second field name to be matched;
determining the overall similarity between the field name after the second keyword and the second field name to be matched;
and displaying the second field name to be matched in a prompt page of the field name behind the second keyword according to the sequence of the overall similarity from high to low so as to correct the spelling error of the field name of the target sentence.
6. The method of claim 1, wherein the obtaining the table name after the first keyword in the target sentence comprises:
judging whether the number of the first keywords in the target sentence is 1 or not;
if so, acquiring a table name behind the first keyword in the target sentence;
if not, ending the error correction process of the target statement.
7. An apparatus for correcting spelling errors in database statements, comprising:
an acquisition module to: obtaining a table name behind a first keyword in a target sentence;
a similarity matching module to: determining the comprehensive similarity between the table name after the first keyword and the table name in the database metadata;
a result output module to: and displaying the table names in the metadata in a prompt page of the table names behind the first keyword according to the sequence of the comprehensive similarity from high to low so as to correct the spelling error of the target sentence.
8. The apparatus of claim 7, wherein the similarity matching module is further configured to:
determining letters and the number thereof contained in the table name after the first keyword and letters and the number thereof contained in the table name in the metadata;
determining the letter type similarity between the table name after the first keyword and the table name in the metadata according to letters and the number thereof contained in the table name, and sequencing the table name in the metadata according to the sequence of the letter type similarity from high to low to obtain a first sequence;
determining the alphabetic sequence similarity between the table names after the first keyword and the table names in the metadata according to the order of letters in the table names, and sequencing the table names in the metadata according to the order of the alphabetic sequence similarity from high to low to obtain a second sequence;
and performing weighted summation processing on the table names in the metadata in the first sequence and the second sequence, and taking the obtained sum as the comprehensive similarity between the table name after the first keyword and the table name in the database metadata.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN201910031911.3A 2019-01-14 2019-01-14 Method and device for correcting database statement spelling errors Pending CN111435406A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910031911.3A CN111435406A (en) 2019-01-14 2019-01-14 Method and device for correcting database statement spelling errors

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910031911.3A CN111435406A (en) 2019-01-14 2019-01-14 Method and device for correcting database statement spelling errors

Publications (1)

Publication Number Publication Date
CN111435406A true CN111435406A (en) 2020-07-21

Family

ID=71580518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910031911.3A Pending CN111435406A (en) 2019-01-14 2019-01-14 Method and device for correcting database statement spelling errors

Country Status (1)

Country Link
CN (1) CN111435406A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112084947A (en) * 2020-09-09 2020-12-15 上海肇观电子科技有限公司 Method, circuit, device and storage medium for processing optical character recognition result
CN112148748A (en) * 2020-09-16 2020-12-29 上海中通吉网络技术有限公司 Method, device and equipment for automatically prompting alias of SQL (structured query language) field
CN113657098A (en) * 2021-08-24 2021-11-16 平安科技(深圳)有限公司 Text error correction method, device, equipment and storage medium
CN114091426A (en) * 2020-10-19 2022-02-25 北京沃东天骏信息技术有限公司 Method and device for processing field data in data warehouse

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112084947A (en) * 2020-09-09 2020-12-15 上海肇观电子科技有限公司 Method, circuit, device and storage medium for processing optical character recognition result
CN112148748A (en) * 2020-09-16 2020-12-29 上海中通吉网络技术有限公司 Method, device and equipment for automatically prompting alias of SQL (structured query language) field
CN114091426A (en) * 2020-10-19 2022-02-25 北京沃东天骏信息技术有限公司 Method and device for processing field data in data warehouse
CN113657098A (en) * 2021-08-24 2021-11-16 平安科技(深圳)有限公司 Text error correction method, device, equipment and storage medium
CN113657098B (en) * 2021-08-24 2024-03-01 平安科技(深圳)有限公司 Text error correction method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112860866B (en) Semantic retrieval method, device, equipment and storage medium
CN111435406A (en) Method and device for correcting database statement spelling errors
CN110069698B (en) Information pushing method and device
CN112100396B (en) Data processing method and device
CN113204621B (en) Document warehouse-in and document retrieval method, device, equipment and storage medium
CN111126045A (en) Text error correction method and device
CN114091426A (en) Method and device for processing field data in data warehouse
CN107609192A (en) The supplement searching method and device of a kind of search engine
CN114861889A (en) Deep learning model training method, target object detection method and device
CN107291835B (en) Search term recommendation method and device
CN111753029A (en) Entity relationship extraction method and device
CN113836316B (en) Processing method, training method, device, equipment and medium for ternary group data
CN112148841B (en) Object classification and classification model construction method and device
CN114116997A (en) Knowledge question answering method, knowledge question answering device, electronic equipment and storage medium
CN113590756A (en) Information sequence generation method and device, terminal equipment and computer readable medium
CN113761565B (en) Data desensitization method and device
CN111666417A (en) Method and device for generating synonyms, electronic equipment and readable storage medium
EP4116889A2 (en) Method and apparatus of processing event data, electronic device, and medium
CN110852078A (en) Method and device for generating title
CN113868373A (en) Word cloud generation method and device, electronic equipment and storage medium
CN109597873B (en) Corpus data processing method and device, computer readable medium and electronic equipment
CN112579673A (en) Multi-source data processing method and device
CN110851438A (en) Database index optimization suggestion and verification method and device
CN112016017A (en) Method and device for determining characteristic data
CN111737571A (en) Searching method and device and electronic equipment

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