Text recognition method and device, electronic equipment and storage medium

By introducing a multi-database query mechanism into the large model, the problem of no results returned when the user input text is not defined in the indicator library is solved, improving the user experience and achieving better interaction with users.

CN118536498APending Publication Date: 2024-08-23QINGDAO HAIER TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410655311.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the field of data analysis for existing large models, if the text query input by the user is not defined in the indicator library, relevant results cannot be returned, resulting in poor user experience.

Method used

By obtaining the text to be recognized, first query whether there is a corresponding result in the indicator database, if not, query in the subject database, knowledge information database and language model database, and generate an application program interface to obtain the text recognition results.

Benefits of technology

When there is no matching result in the indicator database, relevant results are provided through multiple database queries, which improves user interactivity and experience and avoids the problem of no result return.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118536498A
    Figure CN118536498A
Patent Text Reader

Abstract

The invention relates to the technical field of smart home / smart home, particularly provides a text recognition method and device, electronic equipment and a storage medium, and aims to solve the technical problem of poor user experience caused by low text recognition efficiency of an existing method. In order to achieve the purpose, the text recognition method comprises the steps that a to-be-recognized text is obtained; determining whether a first text recognition result corresponding to the to-be-recognized text exists in a first database based on the to-be-recognized text; if yes, obtaining and outputting a first text recognition result; if not, a second text recognition result corresponding to the to-be-recognized text is obtained in a second database and output, and the second database comprises at least one of a theme database, a knowledge information base and a language model database. According to the method, the purpose of better interaction with the user can be achieved, and the use experience of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart home / intelligent family technology, and specifically provides a text recognition method, device, electronic device and storage medium. Background Art

[0002] With the development of big model technology, big models are constantly being applied in various business fields. Some products have also been implemented in the field of data analysis. Most products combine their own data indicators and provide a dialogue interaction interface. Users can ask questions by text or voice through the input box. The product interprets the semantics of the big model, matches the indicator name in the internal indicator library, and returns the corresponding indicator value. However, for indicators that are not defined in the indicator library, it is often impossible to return indicator data to users. After a simple reply such as "the indicator you asked does not exist", it is impossible to interact with users in a deeper way.

[0003] Most existing methods use large models to interpret user intent, extract keywords, match indicator names with keywords, or query the data of the indicator wide table in the indicator library to return the execution results of the indicator wide table. This method completely depends on whether the indicator is defined in the indicator library. If it is defined, the result can be returned. If it is not defined, the result cannot be returned, and ultimately an unfriendly prompt is given, resulting in a poor user experience.

[0004] To this end, the present application proposes a text recognition method, device, electronic device and storage medium. Summary of the invention

[0005] In order to overcome the above defects, this application is proposed to provide a solution or at least partially solve the technical problem that the low efficiency of text recognition in the existing method leads to poor user experience. This application provides a text recognition method, device, electronic device and storage medium.

[0006] In a first aspect, the present application provides a text recognition method, characterized in that the method comprises:

[0007] Get the text to be recognized;

[0008] Determine whether there is a first text recognition result corresponding to the text to be recognized in a first database based on the text to be recognized, wherein the first database is an indicator database storing the text to be recognized and the text recognition result corresponding to the text to be recognized;

[0009] If yes, obtain and output the first text recognition result;

[0010] If not, a second text recognition result corresponding to the text to be recognized is obtained in a second database and outputted, wherein the second database includes at least one of a subject database, a knowledge information database, and a language model database.

[0011] In one embodiment of the present application, determining whether there is a first text recognition result corresponding to the text to be recognized in the first database based on the text to be recognized includes:

[0012] Determining a text intent corresponding to the text to be recognized based on the text to be recognized;

[0013] The first database is queried to determine whether there is a first text recognition result corresponding to the text intent.

[0014] In one implementation of the present application, obtaining the first text recognition result includes:

[0015] Obtaining text identification information and text dimension information corresponding to the text recognition result;

[0016] Generate an application program interface based on the text identification information and the text dimension information;

[0017] The first text recognition result is obtained based on the application programming interface.

[0018] In one embodiment of the present application, the second database includes a subject database, and obtaining a second text recognition result corresponding to the text to be recognized in the second database includes:

[0019] Determining subject information corresponding to the text to be recognized based on the text to be recognized;

[0020] Based on the subject information, query in the subject database whether there is a text recognition result matching the subject information;

[0021] If yes, convert the text to be recognized into SQL statements;

[0022] The SQL statement is executed to obtain the text recognition result, thereby obtaining the second text recognition result.

[0023] In one embodiment of the present application, determining the subject information corresponding to the text to be recognized based on the text to be recognized includes:

[0024] Preprocessing the text to be recognized;

[0025] Acquire a text entity based on a preprocessing result of the text to be recognized;

[0026] Mapping the text entities to a topic space;

[0027] Determining the similarity between the text entity and all subject features in a preset database;

[0028] The subject information corresponding to the text to be recognized is obtained based on the similarity result.

[0029] In one embodiment of the present application, the second database includes a subject database and a knowledge information base, wherein the knowledge information base includes a plurality of knowledge sub-bases;

[0030] The step of acquiring a second text recognition result corresponding to the text to be recognized in the second database includes:

[0031] Determining whether there is a text recognition result corresponding to the text to be recognized in the subject database based on the text to be recognized;

[0032] If not, obtaining the text type corresponding to the text to be recognized;

[0033] Acquire a knowledge sub-base based on the text type;

[0034] A second text recognition result corresponding to the text to be recognized is obtained from the knowledge sub-base.

[0035] In one embodiment of the present application, the second database includes a subject database, a knowledge information database and a language model database, wherein the knowledge information database includes a plurality of knowledge sub-databases, and the language model database includes at least one language model;

[0036] The step of acquiring a second text recognition result corresponding to the text to be recognized in the second database includes:

[0037] Determining whether there is a text recognition result corresponding to the text to be recognized in the subject database based on the text to be recognized;

[0038] If not, obtaining the text type corresponding to the text to be recognized;

[0039] Determining a knowledge sub-base based on the text type;

[0040] Determining whether there is a text recognition result corresponding to the text to be recognized in the knowledge sub-base based on the text to be recognized;

[0041] If not, the text to be recognized is input into the language model database, and a second text recognition result corresponding to the text to be recognized is output.

[0042] In a second aspect, a text recognition device is provided, the device comprising:

[0043] An acquisition module, wherein the acquisition module is configured to acquire text to be recognized;

[0044] A determination module, the determination module being configured to determine whether there is a first text recognition result corresponding to the text to be recognized in a first database based on the text to be recognized, the first database being an indicator database storing the text to be recognized and the text recognition results corresponding to the text to be recognized;

[0045] a first output module, the first output module being configured to output the first text recognition result when a first text recognition result corresponding to the text to be recognized exists in the first database;

[0046] A second output module, wherein the second output module is configured to obtain and output a second text recognition result corresponding to the text to be recognized in a second database when there is no first text recognition result corresponding to the text to be recognized in the first database, wherein the second database includes at least one of a subject database, a knowledge information base and a language model database.

[0047] In a third aspect, an electronic device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the aforementioned text recognition method through the computer program.

[0048] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein the program executes the aforementioned text recognition method when running.

[0049] The above one or more technical solutions of this application have at least one or more of the following Beneficial effects:

[0050] The text recognition method in the present application first obtains the text to be recognized; based on the text to be recognized, it is determined whether there is a first text recognition result corresponding to the text to be recognized in the first database; if so, the first text recognition result is obtained and output, and the first database is an indicator database that stores the text to be recognized and the text recognition result corresponding to the text to be recognized; if not, the second text recognition result corresponding to the text to be recognized is obtained and output in the second database, wherein the second database includes at least one of a subject database, a knowledge information database, and a language model database. In this way, when no text result related to the text to be recognized can be found in the first database, the text result related to the text to be recognized can be further obtained in the second database, thereby avoiding the problem in the prior art that the result cannot be returned if no relevant text result is found in the first database. This method can achieve the purpose of better interaction with the user and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0052] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0053] Figure 1 is a schematic diagram of the hardware environment of the text recognition method according to an embodiment of the present application;

[0054] Figure 2 It is a schematic diagram of the main process of a text recognition method in one embodiment of the present application;

[0055] Figure 3 This is a complete flowchart of a text recognition method in one embodiment of the present application;

[0056] Figure 4 is a flowchart of a text recognition method in another embodiment of the present application;

[0057] Figure 5 is a schematic diagram of the structure of a text recognition device in one embodiment of the present application;

[0058] Figure 6 It is a schematic diagram of the structure of an electronic device in one embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0060] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0061] At present, the traditional method completely depends on whether the indicator is defined in the indicator library. If it is defined, the result can be returned. If it is not defined, the result cannot be returned, and finally an unfriendly prompt is given, resulting in a poor user experience.

[0062] To this end, the present application proposes a text recognition method, device, electronic device and storage medium.

[0063] According to one aspect of an embodiment of the present application, a text recognition method is provided. The text recognition method is widely used in smart home (Smart Home), smart home, smart home device ecology, smart residence (Intelligence House) ecology and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the above text recognition method can be applied to Figure 1 In the hardware environment composed of the terminal device 10 and the server 20 shown in FIG. Figure 1 As shown, the server 20 is connected to the terminal device 10 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 20. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data computing services for the server 20.

[0064] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 10 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing device, a smart dishwasher, a smart projection device, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart fresh air device, a smart kitchen and bathroom device, a smart bathroom device, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification device, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.

[0065] See attached Figure 2 , Figure 2 It is a flowchart of the main steps of a text recognition method according to an embodiment of the present application.

[0066] like Figure 2 As shown, the text recognition method in the embodiment of the present application mainly includes the following steps S101 to S104.

[0067] Step S101: Obtain text to be recognized.

[0068] Specifically, the text to be recognized may be obtained through user interface input, or by monitoring user voice, which is not limited.

[0069] Step S102: determining whether there is a first text recognition result corresponding to the text to be recognized in a first database based on the text to be recognized, where the first database is an indicator database storing the text to be recognized and the text recognition results corresponding to the text to be recognized.

[0070] The first database may be a knowledge database related to the text to be recognized, and the first database may be obtained by pre-construction. Specifically, in the process of constructing the first database, the text to be recognized, the text result corresponding to the text to be recognized, and the mapping relationship between the text to be recognized and the text result may be stored in the first database according to the text to be recognized and the text result corresponding thereto.

[0071] Step S103: If yes (ie, there is a first text recognition result corresponding to the text to be recognized in the first database), the first text recognition result is obtained and outputted.

[0072] Step S104: If not (i.e., there is no first text recognition result corresponding to the text to be recognized in the first database), obtain and output the second text recognition result corresponding to the text to be recognized in the second database, wherein the second database includes at least one of a subject database, a knowledge information database, and a language model database.

[0073] The subject database is a subject database related to the text to be recognized, and the subject database can be obtained by pre-construction. Specifically, in the process of constructing the subject database, different texts to be recognized and their corresponding subjects can be obtained according to different usage scenarios, and the mapping relationship between the text to be recognized, the subject corresponding to the text to be recognized, and the text to be recognized and the text subject can be stored in the subject database.

[0074] A knowledge information base is a database that collects, organizes, stores, analyzes and publishes information in a specific field. It contains a large amount of professional information, data and research literature in certain specific disciplines or industries, and provides all-round and multi-level information services for relevant personnel. For example, a business data proprietary knowledge base can be used as an example of the knowledge information base, but it is not limited to this.

[0075] The language model database includes at least one language model. The language model can be a deep learning model based on the Transformer architecture, which is good at understanding and generating text data. Exemplarily, the GPT (Generative Pre-trained Transformer) model is a series of advanced natural language processing (NLP) models developed by OpenAI, which can be used as an example of the language model.

[0076] Based on the above steps S101 to S104, first obtain the text to be recognized; determine whether there is a first text recognition result corresponding to the text to be recognized in the first database based on the text to be recognized; if so, obtain the first text recognition result and output it; if not, obtain the second text recognition result corresponding to the text to be recognized in the second database and output it, wherein the second database includes at least one of a subject database, a knowledge information database, and a language model database. In this way, when no text result related to the text to be recognized can be found in the first database, text results related to the text to be recognized can be further obtained in the second database, thereby avoiding the problem of the prior art that no relevant text result can be found in the first database and the result cannot be returned. This method can achieve the purpose of better interaction with users and improve the user experience.

[0077] The above steps S102 to S104 are further explained below.

[0078] The above step S102 can be specifically implemented through the following steps S1021 to S1022.

[0079] Step S1021: Determine the text intent corresponding to the text to be recognized based on the text to be recognized.

[0080] The text intent corresponding to the text to be recognized can be obtained by using the intent recognition model, which can be achieved through the following steps:

[0081] First, the text to be recognized is cleaned to remove irrelevant characters, punctuation marks, numbers, etc. Then the text to be recognized is segmented into words or vocabulary units, and the vocabulary is restored to its basic form for easy comparison.

[0082] Secondly, feature extraction is performed on the text to be recognized to obtain the word vector corresponding to the text to be recognized. For example, Word2Vec, G loVe or BERT embedding is used to map the vocabulary to a vector in a high-dimensional space, thereby capturing the semantic relationship between multiple words.

[0083] Then, the intent recognition model is used to predict the intent of the word vector to obtain the text intent corresponding to the text to be recognized. Any of the machine learning models (such as SVM, logistic regression, random forest, etc.) and deep learning models (such as RNN, LSTM, GRU and more advanced BERT, GPT models, etc.) can be used as examples of intent recognition models.

[0084] Step S1022: Query the first database to determine whether there is a first text recognition result corresponding to the text intent.

[0085] Specifically, after obtaining the text intent, it is possible to query in the first database whether there is a text recognition result corresponding to the text intent.

[0086] Obtaining the text intent through the text to be recognized is conducive to obtaining text results that are closer to the intent of the text to be recognized from the first database, effectively improving the accuracy of the text results.

[0087] The above is a further description of step S102 , and the following is a further description of step S103 .

[0088] The above step S103 can be specifically implemented through the following steps S1031 to S1033.

[0089] Step S1031: Obtain text identification information and text dimension information corresponding to the text recognition result.

[0090] The text identification information refers to a code or label that uniquely identifies the text recognition result in the first database. For example, a text identification number (text ID) can be used as an example of the text identification information.

[0091] Text dimension information refers to attribute information related to the text to be recognized in the first database, which is used to describe or subdivide the different aspects or perspectives of the text recognition results. Simply put, dimensions are different directions or classification standards based on which the text to be recognized is observed and analyzed. For example, if the keyword of a text to be recognized is "sales", then possible text dimension information includes time (such as year, month, day), region (such as country, city), product category, sales channel, etc. These dimensions allow users to conduct in-depth analysis of the indicator "sales" from different angles, such as viewing changes in sales in different time periods, or comparing the sales performance of each product line.

[0092] Step S1032: Generate an application program interface based on the text identification information and the text dimension information.

[0093] Specifically, first specify an access address for the application program interface (API) to be created, which will contain text identification information and text dimension information as parameters, for example, https: / / api.example.com / text-analysis / {text_id} / {dimension}, where {text_id} and {dimension} are parameters to be dynamically replaced.

[0094] Determine the request type. Usually, an API that obtains data uses the HTTP GET method, which means that the client obtains information by sending a GET request to the specified endpoint.

[0095] Define the request parameters and response format, clarify which parameters the client needs to pass through the URL (such as text ID and dimension information), and define the format of the server response, such as JSON, which contains the results of the first text recognition.

[0096] Use programming languages ​​(such as Python, Java, or Node.js) and frameworks (Django, Spring Boot, Express) to write backend logic. Specifically, you need to query the database or call the corresponding text analysis service to obtain the recognition results based on the incoming text identifier and dimension information, that is, you get the application interface.

[0097] Step S1033: Obtain a first text recognition result based on the application programming interface.

[0098] Specifically, the aforementioned application program interface is called to obtain the first text recognition result and output it to the user interface.

[0099] By directly associating the text recognition results with the text identification information and dimension information, the specific category and attributes of the required data can be quickly located, enabling the rapid and accurate extraction of relevant data from a large amount of data. This reduces unnecessary data traversal and processing, improving the processing speed and resource utilization rate of the entire system. Secondly, the generated application programming interface (API) is dynamically constructed based on the text identification and dimension information, which means that the interface functions can be flexibly adjusted according to different requirements, and parameters can be easily added or modified to adapt to diverse application scenarios and future changes in data structures, enhancing maintainability and scalability. Finally, users or downstream services can obtain highly customized text recognition results through simple API calls without having to deeply understand the underlying complex data structures and processing logics, lowering the usage threshold, improving the usability and response speed of the service, and enhancing user satisfaction and experience.

[0100] The above is a further description of step S103. Next, the following specific embodiments are used to further describe step S104.

[0101] In a specific embodiment of the present application, the second database includes a theme database, and this embodiment can be implemented through steps S10401 - S10404.

[0102] Step S10401: Determine the theme information corresponding to the text to be recognized based on the text to be recognized. This step can be implemented through the following steps S104011 - S104015.

[0103] Step S104011: Preprocess the text to be recognized.

[0104] Specifically, special characters, digital markers, stop words (such as common conjunctions like "and", "of", etc.) in the text to be recognized are removed, and case unification is performed, etc., so as to achieve preprocessing.

[0105] Step S104012: Obtain text entities based on the preprocessing result of the text to be recognized.

[0106] Specifically, for the preprocessed text to be recognized, the text is split into words or phrases for subsequent processing. Exemplarily, for Chinese text to be recognized, a word segmentation tool such as jieba can be used for word segmentation.

[0107] Then, keywords are extracted from all the word segments. These keywords are crucial for determining the text theme, thereby obtaining text entities. Exemplarily, algorithms such as TF-IDF algorithm and TextRank algorithm can be used to extract keywords from the text.

[0108] Step S104013: Map the text entities to the theme space.

[0109] The subject space is the space where the preset database is located. The preset database can be a pre-built database related to the subject. The preset database is different from the aforementioned subject database. The preset database stores multiple subjects. The subject database is a database that stores the mapping relationship between subjects and subject-related information.

[0110] Specifically, the topic model is used to extract the features of text entities (i.e., keywords), thereby mapping the text entities to the topic space.

[0111] For example, topic models such as an LDA (Latent Direct Allocation) model and a LSI (Latent Semantic Interference) model can be used as examples of topic models.

[0112] Step S104014: Determine the similarity between the text entity and all topic features in the preset database.

[0113] Specifically, the similarity between the text entity and each topic feature in the preset database is compared. Generally speaking, the feature is represented by a vector, and the cosine value between the text entity and each topic feature can be calculated to determine the similarity.

[0114] Step S104015: Obtain the subject information corresponding to the text to be recognized based on the similarity result.

[0115] Specifically, among all similarity results, the topic corresponding to the maximum similarity in the preset database is used as the topic information corresponding to the text to be recognized.

[0116] Step S10402: Based on the subject information, query in the subject database whether there is a text recognition result matching the subject information.

[0117] Specifically, according to the determined subject information, a query is made in the subject database to determine whether there is relevant information corresponding to the subject information.

[0118] Step S10403: When relevant information corresponding to the subject information exists in the subject database, the text to be recognized is converted into an SQL statement.

[0119] Specifically, NL2SQL technology can be used to convert the text to be recognized into SQL statements, so that users can obtain relevant information from the database without understanding SQL syntax. This method is mainly used in scenarios such as data analysis, business reporting, and customer self-service. For example, a marketing person with a non-technical background can ask the question "What was our best-selling product last year?" NL2SQL technology will automatically convert it into a corresponding SQL query, which will return the required data report after execution, greatly improving the ability of non-technical users to access and analyze data.

[0120] Step S10404: Execute the SQL statement to obtain the text recognition result, and obtain the second text recognition result.

[0121] Specifically, the text recognition result can be obtained by executing the SQL statement, thereby obtaining the second text recognition result.

[0122] Through the above method, when no text results related to the text to be recognized are found in the first database, text results related to the text to be recognized can be further obtained in the subject database, thereby avoiding the problem of not being able to return results when no relevant text results are found in the first database, achieving the purpose of better interaction with users and improving the user experience.

[0123] In another specific implementation of the present application, the second database includes a subject database and a knowledge information base, wherein the knowledge information base includes a plurality of knowledge sub-bases. This embodiment can be implemented through steps S10411 to S10414.

[0124] Step S10411: Determine whether there is a text recognition result corresponding to the text to be recognized in the subject database based on the text to be recognized.

[0125] The specific implementation principle of determining whether there is a text recognition result corresponding to the text to be recognized in the subject database based on the text to be recognized is similar to the above-mentioned embodiment and will not be repeated here.

[0126] Step S10412: When there is no text recognition result corresponding to the text to be recognized in the subject database, the text type corresponding to the text to be recognized is obtained.

[0127] The text type refers to the knowledge domain to which the text to be identified belongs.

[0128] Specifically, the text type can be obtained by analyzing the keywords in the text to be recognized to obtain the technical field corresponding to the text.

[0129] Step S10413: Acquire a knowledge sub-base based on the text type.

[0130] Specifically, it is determined according to the text type of the text to be recognized that which knowledge sub-base in the knowledge information base corresponds to the text to be recognized.

[0131] Step S10414: Acquire a second text recognition result corresponding to the text to be recognized from the knowledge sub-base.

[0132] Specifically, relevant knowledge corresponding to the text to be recognized is searched in the knowledge sub-base to obtain the second text recognition result.

[0133] Through the above method, when no text results related to the text to be recognized can be found in the first database and the subject database, text results related to the text to be recognized can be further searched in the knowledge information database, thereby avoiding the problem of not being able to return results when no relevant text results are found in the first database, achieving the purpose of better interaction with users and improving the user experience.

[0134] In another specific embodiment of the present application, the second database includes a subject database, a knowledge information base and a language model database, wherein the knowledge information base includes multiple knowledge sub-bases, and the language model database includes at least one language model. This embodiment can be implemented through steps S10421-S10425.

[0135] Step S10421: Determine whether there is a text recognition result corresponding to the text to be recognized in the subject database based on the text to be recognized.

[0136] Step S10422: When there is no text recognition result corresponding to the text to be recognized in the subject database, the text type corresponding to the text to be recognized is obtained.

[0137] Step S10423: Determine the knowledge sub-base based on the text type.

[0138] Step S10424: Determine whether there is a text recognition result corresponding to the text to be recognized in the knowledge sub-base based on the text to be recognized.

[0139] Specifically, the specific implementation principles of the aforementioned steps S10421 to S10424 are similar to those of the aforementioned embodiments and will not be repeated here.

[0140] Step S10425: When there is no text recognition result corresponding to the text to be recognized in the knowledge sub-base, the text to be recognized is input into a pre-trained language model through a preset instruction, and a second text recognition result corresponding to the text to be recognized is output.

[0141] Through the above method, when no text results related to the text to be recognized are found in the first database, the subject database, or the knowledge information database, the language model database can be further used to obtain text results related to the text to be recognized, thereby avoiding the problem of not being able to return results when no relevant text results are found in the first database, achieving the purpose of better interaction with users, and improving the user experience.

[0142] In one embodiment of the present application, Figure 3 Taking a data query problem as an example, the text recognition method of the present application is described in detail.

[0143] In the first step, the user raises a data query question.

[0144] The second step is to parse the user's intention. After parsing the user's intention, the workflow configuration is used to enter the indicator mode first. Whether there is an indicator asked by the user in the indicator library, if there is an indicator, the NL2API (natural language to API) service is used to generate JSON for the indicator ID and indicator dimension, and the indicator interface in the interactive intelligent analysis project is called to return the matching indicators and the drillable dimensions defined in the indicator library. The chart and drillable dimensions are returned by default. After the user clicks the drillable dimension, the chart can display the data of the drilled dimension and the user can filter and query the data.

[0145] In the third step, if the indicator is not in the existing indicator library in the second step of the workflow, it will automatically enter the topic mode to query whether there are related topics. If there is a topic corresponding to the user's question, the NL2SQL (natural language to SQL statement) service will be used to automatically convert the user's question into an SQL statement to query the topic, execute the SQL statement, and return the SQL statement execution result to the user.

[0146] In the fourth step, if the workflow in the third step determines that the user's question is neither in the indicator library nor in the relevant subject data, it will automatically enter the knowledge mode and confirm which category of data knowledge the user's question belongs to through the data insight service. After confirming the data knowledge category, it will first search for relevant questions and answers in the business-specific knowledge base. If no relevant answers can be found in the business-specific knowledge base, it will search for relevant knowledge in the GPT large model through pre-defined instructions (prompt). After retrieving the knowledge answer, the answer will be returned to the user.

[0147] In addition to returning query results, the above three modes will also recommend related indicators / topics / knowledge after the results. Users can also communicate smoothly after clicking on the recommended related content.

[0148] For example, a user asks "What is the number of online network devices in the air-conditioning industry in the past 30 days?" If the indicator exists in the indicator library, the result of the indicator and the drillable dimensions (industry, product group, model, etc.) will be returned. The user can click on the product group to view the number of online network devices at the granularity of the product group (household air conditioners, commercial air conditioners, etc.) again.

[0149] The user asks "How many users are bound to the air conditioner?" If the indicator library has not defined the number of bound users indicator, but the subject data has human-computer relationship subject data, and the subject details record detailed user ID, device ID, binding source, binding time and other information, the user's question will be converted into an SQL statement of the corresponding subject table, "select count(dist inct user id)from xxxxx where xxxxx", and the SQL statement will be executed to return the result value.

[0150] The user asks, "I want to classify the user groups on the APP and view the activity of different types of users. What analysis model can achieve this?" The workflow determines the key information of the question. If there is no suitable answer in the indicator mode and the topic mode, the knowledge base mode will be entered. The business-specific knowledge base will be checked first to see whether there is an analysis model and specific operation method for user grouping. If there is an answer in the business-specific knowledge base, the answer will be returned to the user. If there is no answer to this question in the proprietary knowledge base, the knowledge of the GPT large model will be retrieved again, and the knowledge answer of the large model will be returned to the user.

[0151] By adding a topic mode, after defining the commonly used business topics in the topic database, when the indicator cannot match the indicator database result, it will match the business topic table again, match the relevant topics based on the semantic interpretation results of the large model, and convert the user's question into an SQL statement through NL2SQL to query the topic table data after matching the topic, and finally return the SQL result. If the data required by the user is not available in the topic mode, the user is guided to enter the knowledge base mode again, and in the knowledge base mode, some relevant analysis ideas and methods are provided to the user. Based on these ideas and methods, the user is guided to ask other related indicators or knowledge that can answer business problems, so as to better interact with the user and improve the user experience.

[0152] In another embodiment, Figure 4 As shown, after the user asks a question, the big model intention recognition will be performed first. If the recognition result is suitable for the indicator mode, the priority of the mode flow is indicator mode > topic mode > knowledge mode.

[0153] Alternatively, after the big model recognizes the intent, the one that is suitable for the topic mode first, the priority of mode flow is: topic mode > knowledge mode.

[0154] Alternatively, after the big model intention is identified, the priority of the model flow that is suitable for the knowledge model is: knowledge model.

[0155] Through the three different modes of indicator mode, theme mode, and knowledge mode, users' requirements for obtaining data are met. Through the customized configuration of the workflow, the processing flow is defined, and different processing modes can be entered according to different priorities for different situations. Through the combination of the three modes of indicator mode, theme mode, and knowledge base mode, the common data usage scenarios of users in the field of data analysis are covered, allowing users and interactive intelligent analysis products to interact more smoothly, and satisfying as many ways as possible for users to obtain data, improving the user experience of obtaining data through interactive Q&A.

[0156] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effect of the present application, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present application.

[0157] Furthermore, the present application also provides a text recognition device.

[0158] See attached Figure 5 , Figure 5 It is a main structural block diagram of a text recognition device according to an embodiment of the present application.

[0159] like Figure 5 As shown, the text recognition device in the embodiment of the present application mainly includes an acquisition module 11, a determination module 12, a first output module 13 and a second output module 14. In some embodiments, one or more of the acquisition module 11, the determination module 12, the first output module 13 and the second output module 14 can be combined into one module.

[0160] In some embodiments, the acquisition module 11 may be configured to acquire text to be recognized.

[0161] The determination module 12 may be configured to determine whether there is a first text recognition result corresponding to the text to be recognized in a first database based on the text to be recognized, wherein the first database is an indicator database storing the text to be recognized and text recognition results corresponding to the text to be recognized.

[0162] The first output module 13 may be configured to output the first text recognition result when there is a first text recognition result corresponding to the text to be recognized in the first database;

[0163] The second output module 14 can be configured to obtain and output a second text recognition result corresponding to the text to be recognized in a second database when there is no first text recognition result corresponding to the text to be recognized in the first database, wherein the second database includes at least one of a subject database, a knowledge information database and a language model database.

[0164] In one implementation, the description of the specific implementation functions can refer to step S101 to step S104.

[0165] The above-mentioned text recognition device is used to perform Figure 2 The text recognition method embodiment shown in the figure has similar technical principles, technical problems solved and technical effects produced. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process and related instructions of the text recognition device can refer to the contents described in the embodiment of the text recognition method, which will not be repeated here.

[0166] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above-mentioned embodiment of the present application can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code.

[0167] Furthermore, the present application also provides an electronic device, which may include a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute any of the above-mentioned text recognition method embodiments through the computer program. Figure 6 As shown, Figure 6 exemplarily shows the structure of an electronic device, which includes a processor 100 and a memory 200.

[0168] Furthermore, the present application also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present application, the computer-readable storage medium can be configured to store a program for executing the text recognition method of the above method embodiment, and the program can be loaded and run by the processor to implement the above text recognition method. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The computer-readable storage medium can be a memory device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present application is a non-temporary computer-readable storage medium.

[0169] Further, it should be understood that since the setting of each module is only for illustrating the functional units of the device of the present application, the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.

[0170] It is understood by those skilled in the art that each module in the device can be adaptively split or merged. Such splitting or merging of specific modules will not cause the technical solution to deviate from the principle of the present application, and therefore, the technical solutions after splitting or merging will fall within the protection scope of the present application.

[0171] So far, the technical solutions of the present application have been described in conjunction with the specific implementations shown in the accompanying drawings, but it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific implementations. Without departing from the principles of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present application.

Claims

1. A text recognition method, characterized in that: The method comprises: Get the text to be recognized; Determine whether there is a first text recognition result corresponding to the text to be recognized in a first database based on the text to be recognized, wherein the first database is an indicator database storing the text to be recognized and the text recognition result corresponding to the text to be recognized; If yes, obtain and output the first text recognition result; If not, a second text recognition result corresponding to the text to be recognized is obtained in a second database and outputted, wherein the second database includes at least one of a subject database, a knowledge information database, and a language model database.

2. The text recognition method according to claim 1, characterized in that: The determining, based on the text to be recognized, whether there is a first text recognition result corresponding to the text to be recognized in the first database comprises: Determining a text intent corresponding to the text to be recognized based on the text to be recognized; The first database is queried to determine whether there is a first text recognition result corresponding to the text intent.

3. The text recognition method according to claim 1, characterized in that: The obtaining the first text recognition result includes: Obtaining text identification information and text dimension information corresponding to the text recognition result; Generate an application program interface based on the text identification information and the text dimension information; The first text recognition result is obtained based on the application programming interface.

4. The text recognition method according to claim 1, characterized in that: The second database includes a subject database, and obtaining a second text recognition result corresponding to the text to be recognized in the second database includes: Determining subject information corresponding to the text to be recognized based on the text to be recognized; Based on the subject information, query in the subject database whether there is a text recognition result matching the subject information; If yes, convert the text to be recognized into SQL statements; The SQL statement is executed to obtain the text recognition result, thereby obtaining the second text recognition result.

5. The text recognition method according to claim 4, characterized in that: The determining, based on the text to be recognized, the subject information corresponding to the text to be recognized includes: Preprocessing the text to be recognized; Acquire a text entity based on a preprocessing result of the text to be recognized; Mapping the text entities to a topic space; Determining the similarity between the text entity and all subject features in a preset database; The subject information corresponding to the text to be recognized is obtained based on the similarity result.

6. The text recognition method according to claim 1, characterized in that: The second database includes a subject database and a knowledge information base, wherein the knowledge information base includes a plurality of knowledge sub-bases; The step of acquiring a second text recognition result corresponding to the text to be recognized in the second database includes: Determining whether there is a text recognition result corresponding to the text to be recognized in the subject database based on the text to be recognized; If not, obtaining the text type corresponding to the text to be recognized; Acquire a knowledge sub-base based on the text type; A second text recognition result corresponding to the text to be recognized is obtained from the knowledge sub-base.

7. The text recognition method according to claim 1, characterized in that: The second database includes a subject database, a knowledge information database and a language model database, wherein the knowledge information database includes a plurality of knowledge sub-databases, and the language model database includes at least one language model; The step of acquiring a second text recognition result corresponding to the text to be recognized in the second database includes: Determining whether there is a text recognition result corresponding to the text to be recognized in the subject database based on the text to be recognized; If not, obtaining the text type corresponding to the text to be recognized; Determining a knowledge sub-base based on the text type; Determining whether there is a text recognition result corresponding to the text to be recognized in the knowledge sub-base based on the text to be recognized; If not, the text to be recognized is input into the language model, and a second text recognition result corresponding to the text to be recognized is output.

8. A text recognition device, characterized in that: The device comprises: An acquisition module, wherein the acquisition module is configured to acquire text to be recognized; A determination module, the determination module being configured to determine whether there is a first text recognition result corresponding to the text to be recognized in a first database based on the text to be recognized, the first database being an indicator database storing the text to be recognized and the text recognition results corresponding to the text to be recognized; a first output module, the first output module being configured to output the first text recognition result when a first text recognition result corresponding to the text to be recognized exists in the first database; A second output module, wherein the second output module is configured to obtain and output a second text recognition result corresponding to the text to be recognized in a second database when there is no first text recognition result corresponding to the text to be recognized in the first database, wherein the second database includes at least one of a subject database, a knowledge information base and a language model database.

9. An electronic device, comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to execute the text recognition method according to any one of claims 1 to 7 through the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the text recognition method according to any one of claims 1 to 7 when executed.