Retrieval method and device of system text, storage medium and electronic equipment
Through latent semantic analysis and distributed caching optimization, high efficiency and accuracy of institutional text retrieval are achieved, solving the problem of low retrieval efficiency in existing technologies and simplifying the search process.
Patent Information
- Application Number
- CN202511185928.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-22
- Publication Date
- 2025-12-16
AI Technical Summary
Existing methods for retrieving institutional texts are inefficient when dealing with complex queries. Traditional methods have limitations and are difficult to efficiently locate the required institutional texts.
Latent semantic analysis technology is employed to acquire latent semantic analysis data, transform retrieval information into topic-text vectors using word sets and topic vector transformation matrices, calculate similarity using the cosine distance formula, determine the target system text, and optimize the retrieval process using distributed caching.
It improves the efficiency and accuracy of institutional text retrieval, simplifies the search process, and ensures high query efficiency even in resource-constrained environments.
Smart Images

Figure CN121144481A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of text processing, in particular, to a system text retrieval method and device, a storage medium and an electronic device. BACKGROUND
[0002] With the rapid expansion of the enterprise scale, the number of system specifications accumulated in the enterprise also increases. Under this background, how to efficiently and accurately locate the required system from the complex system has become an indispensable key link in the process of enterprise management and operation. This not only relates to the improvement of work efficiency, but also directly affects the timeliness and accuracy of enterprise decision-making. Therefore, establishing a scientific and reasonable system retrieval method is of great significance to standardize employee behavior, optimize internal management processes, and improve overall operational efficiency.
[0003] Among the current popular search technologies, the Boolean logic retrieval method is a basic and widely used method. It matches the text content by constructing an accurate logical expression, however, this method is not capable of handling complex queries or subtle differences in text, which can easily lead to retrieval failure. Another method is to use natural language processing technology in deep learning, but this technology has high construction and use costs, and requires professionals to build and maintain the environment. In addition, there is a method of using general search tools, but the use of these tools is relatively complex, requiring higher skills of developers, and there are certain difficulties in deployment, migration, and large memory resource requirements. In summary, traditional search methods have limitations in handling complex queries and performance requirements, and the retrieval efficiency is low.
[0004] The retrieval method in the related art has the problem of low retrieval efficiency when retrieving system text, and there is no effective solution at present. SUMMARY
[0005] The main purpose of the present application is to provide a system text retrieval method and device, a storage medium and an electronic device to solve the problem of low retrieval efficiency of the retrieval method in the related art when retrieving system text.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a system text retrieval method is provided. The method comprises: receiving retrieval information input by a user, and obtaining potential semantic analysis data corresponding to a plurality of system texts from a distributed cache component; for the potential semantic analysis data corresponding to each system text, converting the retrieval information according to the potential semantic analysis data to obtain a topic-text vector of the retrieval information; determining a target system text from the plurality of system texts according to the potential semantic analysis data and the topic-text vector of the retrieval information, and generating a retrieval result according to the target system text.
[0007] Further, the latent semantic analysis data at least comprises a word set and a topic vector transformation matrix, and the converting the search information according to the latent semantic analysis data to obtain a topic-text vector of the search information comprises: converting the search information into a word-text vector according to the word set; and converting the word-text vector into the topic-text vector according to the topic vector transformation matrix.
[0008] Further, the latent semantic analysis data further comprises a topic-text matrix of the system text, and the determining the target system text from the plurality of system texts according to the latent semantic analysis data and the topic-text vector of the search information comprises: calculating a similarity between the topic-text vector and each column vector of the topic-text matrix using a cosine distance formula; and if the similarity is greater than a preset threshold, taking a system text corresponding to the topic-text matrix as the target system text.
[0009] Further, before receiving the search information input by the user, the method further comprises: obtaining system texts of a plurality of system regulations, and performing latent semantic analysis on the system text of each system regulation to obtain latent semantic analysis data corresponding to each system text; and storing the latent semantic analysis data corresponding to each system text in a database.
[0010] Further, the performing latent semantic analysis on the system text of each system regulation to obtain the latent semantic analysis data corresponding to each system text comprises: performing sentence processing on the system text of each system regulation to obtain a sentence set of each system text, and performing word segmentation processing on the system text of each system regulation to obtain a word set of each system text; generating a word-text matrix of each system text according to the sentence set and the word set, and performing singular value decomposition on the word-text matrix to obtain a topic vector transformation matrix of each system text; transforming the word-text matrix according to the topic vector transformation matrix to obtain a topic-text matrix of each system text; and composing the latent semantic analysis data corresponding to each system text according to the sentence set, the word set, the word-text matrix, the topic vector transformation matrix, and the topic-text matrix.
[0011] Further, the storing the latent semantic analysis data corresponding to each system text in the database comprises: obtaining a row number and a column number of the word-text matrix; traversing the word-text matrix to obtain a row number, a column number, and an element value of a non-zero element in the word-text matrix, and generating a triple according to the row number, the column number, and the element value of the non-zero element, and generating a triple list according to the triple; generating information data of the word-text matrix according to the row number and the column number of the word-text matrix and the triple list; converting the information data into a preset string data format and storing the information data in the database.
[0012] Further, before receiving the search information input by the user, the method further comprises: in a case where a system starting instruction is received, reading the latent semantic analysis data corresponding to the multiple system texts from the database, and storing the latent semantic analysis data corresponding to the multiple system texts in the distributed cache component.
[0013] To achieve the above object, according to another aspect of the present application, a retrieval device for system texts is provided. The device comprises: an acquisition unit configured to receive search information input by a user, and acquire latent semantic analysis data corresponding to multiple system texts from a distributed cache component; a processing unit configured to, for the latent semantic analysis data corresponding to each system text, convert the search information according to the latent semantic analysis data to obtain a topic-text vector of the search information; and a determination unit configured to determine a target system text from the multiple system texts according to the latent semantic analysis data and the topic-text vector of the search information, and generate a search result according to the target system text.
[0014] Further, the latent semantic analysis data at least comprises a word set and a topic vector transformation matrix, and the processing unit comprises: a first processing subunit configured to convert the search information into a word-text vector according to the word set; and a second processing subunit configured to convert the word-text vector into the topic-text vector according to the topic vector transformation matrix.
[0015] Further, the latent semantic analysis data further comprises a topic-text matrix of the system texts, and the determination unit comprises: a calculation subunit configured to calculate a similarity between the topic-text vector and each column vector of the topic-text matrix using a cosine distance formula; and a determination subunit configured to, if the similarity is greater than a preset threshold, determine a system text corresponding to the topic-text matrix as the target system text.
[0016] Further, the device further comprises: an analysis unit configured to, before receiving the search information input by the user, acquire system texts of multiple system regulations, and perform latent semantic analysis on the system texts of each system regulation to obtain latent semantic analysis data corresponding to each system text; and a storage unit configured to store the latent semantic analysis data corresponding to each system text in a database.
[0017] Further, the analysis unit comprises: a third processing subunit, configured to perform sentence processing on the system text of each system norm to obtain a sentence set of each system text, and perform word segmentation processing on the system text of each system norm to obtain a word set of each system text; a fourth processing subunit, configured to generate a word-text matrix of each system text according to the sentence set and the word set, and perform singular value decomposition on the word-text matrix to obtain a topic vector transformation matrix of each system text; a fifth processing subunit, configured to transform the word-text matrix according to the topic vector transformation matrix to obtain a topic-text matrix of each system text; and a sixth processing subunit, configured to form latent semantic analysis data corresponding to each system text according to the sentence set, the word set, the word-text matrix, the topic vector transformation matrix and the topic-text matrix.
[0018] Further, the storage unit comprises: a first acquisition subunit, configured to acquire the number of rows and the number of columns of the word-text matrix; a second acquisition subunit, configured to traverse the word-text matrix, acquire the number of rows, the number of columns and the element value of the non-zero element in the word-text matrix, generate a triple according to the number of rows, the number of columns and the element value of the non-zero element, and generate a triple list according to the triple; a seventh processing subunit, configured to generate information data of the word-text matrix according to the number of rows and the number of columns of the word-text matrix and the triple list; and an eighth processing subunit, configured to convert the information data into a preset string data format and store the information data in the database.
[0019] Further, the device further comprises: a loading unit, configured to, before receiving the search information input by the user, read the latent semantic analysis data corresponding to the plurality of system texts from the database in the case that a system starting instruction is received, and store the latent semantic analysis data corresponding to the plurality of system texts in the distributed cache component.
[0020] According to another aspect of the embodiments of the present application, an electronic device is further provided, comprising: a memory storing an executable program; and a processor configured to run the program, wherein the program is configured to perform the system text searching method according to any one of the above.
[0021] According to another aspect of the embodiments of the present application, a computer readable storage medium is further provided, the storage medium storing a program, wherein the program is configured to control the device where the storage medium is located to perform the system text searching method according to any one of the above.
[0022] In the embodiment of the present application, the following steps are adopted: receiving user input search information, and obtaining potential semantic analysis data corresponding to a plurality of system texts from a distributed cache component; for potential semantic analysis data corresponding to each system text, converting the search information according to the potential semantic analysis data to obtain a topic-text vector of the search information; determining a target system text from the plurality of system texts according to the potential semantic analysis data and the topic-text vector of the search information, and generating a search result according to the target system text. The technical problem of low search efficiency of the search method in the related art when searching for system texts is solved. In the present scheme, through potential semantic analysis, the system can understand the deep semantics of the text, so that the system can accurately search for a system text similar in semantics to the to-be-queried text in the system text library based on the semantics of the to-be-queried text, simplifying the search process and improving the efficiency and accuracy of system text search. BRIEF DESCRIPTION OF DRAWINGS
[0023] The accompanying drawings, which form a part of the present application, are intended to provide further understanding of the present application, and are used to interpret the illustrative embodiments of the present application and their descriptions, and do not constitute improper limitations to the present application. In the drawings:
[0024] Figure 1 A hardware structure block diagram of a computer terminal for implementing a system text search method is shown;
[0025] Figure 2 A flowchart of a system text search method according to an embodiment of the present application is shown;
[0026] Figure 3 A flowchart of a potential semantic analysis algorithm according to an embodiment of the present application is shown;
[0027] Figure 4 A schematic diagram of a system text search device according to an embodiment of the present application is shown;
[0028] Figure 5 A structure block diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and in the above drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] It should be noted that the collected information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) involved in the present application are information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards, necessary security measures are taken, do not violate public order and good customs, and provide corresponding operation portal for user to choose authorization or refusal. For example, the system and related users or institutions are provided with an interface to provide the user with a corresponding operation portal for the user to choose to agree or refuse the automatic decision result; if the user chooses to refuse, the expert decision process is entered.
[0032] Embodiment 1
[0033] According to the embodiments of the present application, a method for retrieving a system text is also provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0034] The method provided by the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing the method for retrieving a system text is shown. As Figure 1As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0035] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0036] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the system text retrieval method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the aforementioned system text retrieval method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0037] The transmission device 106 is configured to receive or send data via a network. The network can include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network interface controller (NIC) that can connect to other network devices through a base station to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module that is configured to communicate with the Internet wirelessly.
[0038] The display can be a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0039] In the above operating environment, the present application provides a method for searching a regulation text as shown in Figure 2 Figure 2 is a flowchart of the method for searching a regulation text according to an embodiment of the present application. The method for searching a regulation text includes the following steps:
[0040] In step S201, the search information input by a user is received, and latent semantic analysis data corresponding to a plurality of regulation texts is obtained from a distributed cache component.
[0041] Optionally, the search information can be a text content to be searched, for example, the user types "arranging daily safety production work by designated personnel" in a search box as the search information.
[0042] Optionally, since the content of a regulation specification usually does not change, the latent semantic analysis data corresponding to the regulation specification also does not change. In each search, it is not necessary to obtain data from a database in real time, and a time-consuming task can be completed in advance through a cache mechanism, that is, when the system is started, the latent semantic analysis data corresponding to all regulation specifications stored in the database is read out in advance, and the latent semantic analysis data is constructed into cache data and placed in the distributed cache component to improve the search efficiency of the system. Therefore, after the search information input by the user is received, the latent semantic analysis data corresponding to a plurality of regulation texts can be obtained from the distributed cache component.
[0043] In step S202, for the latent semantic analysis data corresponding to each regulation text, the search information is converted according to the latent semantic analysis data to obtain a topic-text vector of the search information.
[0044] Optionally, when the user inputs the text to be searched, it is necessary to search whether there is text similar in semantics to the text to be searched in all system regulations. Therefore, it is necessary to calculate the text to be searched and the latent semantic analysis data corresponding to all system texts. In order to improve the efficiency of the search, the multi-core characteristics of the computer are fully utilized, and when the search calculation is performed, a parallel computing framework is used to simultaneously and in parallel process multiple calculation tasks, that is, for the latent semantic analysis data corresponding to each system text, the search information is converted according to the latent semantic analysis data to obtain the topic-text vector of the search information. For example, the text to be searched is converted into a topic-text vector according to the latent semantic analysis data of the safety production system obtained from the distributed cache component.
[0045] Through the parallel computing mechanism, the performance of the search process is improved, the search speed of the system is accelerated, and it is ensured that even in a resource-limited environment, a relatively high query efficiency can be maintained.
[0046] In step S203, the target system text is determined from the multiple system texts according to the latent semantic analysis data and the topic-text vector of the search information, and the search result is generated according to the target system text.
[0047] Optionally, the target system text can be determined from the multiple system texts according to the latent semantic analysis data and the topic-text vector, for example, text similarity calculation is performed on the latent semantic analysis data and the topic-text vector, and if the calculated value is greater than a set threshold value, it can be considered that there is similar text, and then the systems with similar texts are summarized and constitute the search result.
[0048] In summary, through latent semantic analysis, the system can understand the deep semantics of the text, so that it can accurately search for system texts similar in semantics to the text to be queried in the system text library based on the semantics of the text to be queried, simplify the search process, and improve the efficiency and accuracy of the system text search.
[0049] Optionally, in the system text search method provided in the embodiments of the present application, the latent semantic analysis data at least includes a word set and a topic vector transformation matrix, and the conversion of the search information according to the latent semantic analysis data to obtain the topic-text vector of the search information includes: converting the search information into a word-text vector according to the word set; and converting the word-text vector into a topic-text vector according to the topic vector transformation matrix.
[0050] In an optional embodiment, the latent semantic analysis data at least includes a word set (such as a word list) and a topic vector transformation matrix U, the text to be searched is converted into a word-text vector L according to the word list, and then the word-text vector L is converted into a topic-text vector K according to the topic vector transformation matrix U, and the formula is as follows:
[0051] K = U T L
[0052] By converting the search information into a topic-text vector, the system can more accurately understand the user's search intent and find the most relevant text in the institutional text library, improving the accuracy of the search.
[0053] Optionally, in the method for searching for institutional text provided in the embodiments of the present application, the latent semantic analysis data further includes a topic-text matrix of the institutional text, and determining the target institutional text from the multiple institutional texts according to the latent semantic analysis data and the topic-text vector of the search information includes: using a cosine distance formula to calculate the similarity between the topic-text vector and each column vector of the topic-text matrix; if the similarity is greater than a preset threshold, the institutional text corresponding to the topic-text matrix is taken as the target institutional text.
[0054] In an optional embodiment, the latent semantic analysis data further includes a topic-text matrix Y of the institutional text, for example, the similarity between the topic-text vector K and each column vector of the topic-text matrix Y corresponding to the "Safety Production System" is calculated using a cosine distance formula. When the similarity is greater than a preset threshold, it can be considered that the to-be-searched text and the current institutional text have certain similarity, that is, the institutional text of the "Safety Production System" is taken as the target institutional text.
[0055] For example, the user types "by designated personnel responsible for daily safety production work arrangement" in the search box, and through the calculation of semantic similarity, it is found that the to-be-searched text input by the user is semantically the same as the sentence "and designate a designated person responsible for daily safety production management work" in the "Safety Production System", so the institutional text of the "Safety Production System" is taken as the target institutional text, realizing the search for the text of the system according to the semantics of the to-be-searched text input by the user, and improving the accuracy of the search.
[0056] Optionally, in the method for searching for institutional text provided in the embodiments of the present application, before receiving the search information input by the user, the method further includes: obtaining the institutional text of the multiple institutional norms, and performing latent semantic analysis on the institutional text of each institutional norm to obtain the latent semantic analysis data corresponding to each institutional text; and storing the latent semantic analysis data corresponding to each institutional text in a database.
[0057] In an optional embodiment, first, the institutional text of the multiple institutional norms is obtained, and latent semantic analysis is performed on the institutional text of each institutional norm to obtain the latent semantic analysis data corresponding to each institutional text, and then the latent semantic analysis data corresponding to each institutional text is stored in a database.
[0058] Optionally, the latent semantic analysis data corresponding to the system is generated according to the system text stored in the database, and the data is stored in the database. When a new system text is added, the latent semantic analysis algorithm can be used to construct the latent semantic analysis data of the system text, for example, the latent semantic analysis data corresponding to the text content in the "safety production system" is generated and stored in the database.
[0059] Optionally, in the system text retrieval method provided in the embodiments of the present application, the latent semantic analysis of the system text of each system specification is performed to obtain the latent semantic analysis data corresponding to each system text, which includes: performing sentence processing on the system text of each system specification to obtain a sentence set of each system text, and performing word segmentation processing on the system text of each system specification to obtain a word set of each system text; generating a word-text matrix of each system text according to the sentence set and the word set, and performing singular value decomposition on the word-text matrix to obtain a topic vector transformation matrix of each system text; transforming the word-text matrix according to the topic vector transformation matrix to obtain a topic-text matrix of each system text; and forming the latent semantic analysis data corresponding to each system text according to the sentence set, the word set, the word-text matrix, the topic vector transformation matrix, and the topic-text matrix.
[0060] In an optional embodiment, the latent semantic analysis mainly includes the following processes: first, sentence processing is performed on the system text of each system specification to obtain a sentence set of each system text, and word segmentation processing is performed on the system text of each system specification to obtain a word set of each system text, then a word-text matrix of each system text is generated according to the sentence set and the word set, and singular value decomposition is performed on the word-text matrix to obtain a topic vector transformation matrix of each system text, then the word-text matrix is transformed according to the topic vector transformation matrix to obtain a topic-text matrix of each system text, and finally, the latent semantic analysis data corresponding to each system text is formed according to the sentence set, the word set, the word-text matrix, the topic vector transformation matrix, and the topic-text matrix.
[0061] In an optional embodiment, Figure 3 is a flowchart of the latent semantic analysis algorithm provided in the embodiments of the present application, as Figure 3 shown, given a text data, after sentence processing of the text data, a set D containing n sentence texts d1, d2,..., d n} is obtained, d i represents one of the sentence texts in the text data; after word segmentation processing of the text data, a set W containing m words w1, w2,..., w m};Utilize the sentence set D and the word set W to constitute the word-text matrix X, the dimension of the matrix X is m*n; the element of the i-th row and the j-th column in the matrix X is denoted as x ij , represents the frequency or weight value of the word w i in the text d j . The weight value is usually represented by the word frequency-inversed document frequency (TFIDF), which is defined as follows:
[0062]
[0063] Wherein, tf ij is the number of times of the word w i appearing in the sentence text d j , tf ·j is the sum of the number of times of all words appearing in d j , df i is the number of sentence texts containing the word w i , and df is the total number of sentences.
[0064] The singular value decomposition is performed on the word-text matrix X, and the formula is as follows:
[0065] X=UΣV T
[0066] Wherein, U is a topic vector transformation matrix, also known as a topic space transformation matrix. Σ is a rectangular diagonal matrix, and the non-diagonal elements are all zero. V is an orthogonal matrix, and the column vector thereof is called a right singular vector.
[0067] The topic-text matrix Y is obtained by utilizing the topic vector transformation matrix U to transform the word-text matrix X, and the formula is as follows:
[0068] Y=U T X
[0069] Through the above process, the system original text can be converted into a sentence set, a word set, a word-text matrix, a topic vector transformation matrix and a topic-text matrix, which are the potential semantic analysis data corresponding to the system text.
[0070] For example, after the text of the "Work Safety System" is processed by sentence segmentation, 32 sentences are obtained; after the text of the "Work Safety System" is processed by word segmentation, a word list is obtained, which contains 127 words. The order of the word list cannot be changed, and the subsequent word-text matrix and word-text vector are constructed according to the order. A word-text matrix is constructed according to the sentence list and the word list, and the dimension is 127*32. The rows of the matrix represent different words, the columns represent different sentence texts, and the element values in the matrix represent the term frequency-inverse document frequency. Assuming that the first word in the word list is "safety", and the second sentence in the system text is "to strengthen the management of work safety", the result obtained according to the calculation formula of TFIDF is the element value of the first row and the second column of the word-text matrix. The element values of other rows and columns are calculated in the same way, and finally the word-text matrix is obtained. The word-text matrix is singular value decomposed to obtain a topic vector transformation matrix, and then the word-text matrix is transformed according to the topic vector transformation matrix to obtain a topic-text matrix.
[0071] Through latent semantic analysis, the system can understand the deep semantics of the text, so as to accurately locate the texts with similar semantics in the system text library and improve the accuracy of retrieval.
[0072] Optionally, in the method for retrieving system texts provided in the embodiments of the present application, storing the latent semantic analysis data corresponding to each system text in the database comprises: obtaining the number of rows and columns of the word-text matrix; traversing the word-text matrix to obtain the number of rows, the number of columns and the element value of the non-zero elements in the word-text matrix, and generating a triple according to the number of rows, the number of columns and the element value of the non-zero elements, and generating a triple list according to the triple; generating information data of the word-text matrix according to the number of rows and columns of the word-text matrix and the triple list; converting the information data into a preset string data format and storing it in the database.
[0073] In an optional embodiment, the data amount of the latent semantic analysis data corresponding to the system text is large, and direct storage in the data table will occupy a large space. Since the word-text matrix is a sparse matrix, most of the elements in the matrix are zero, and therefore, the data storage of the word-text matrix is optimized, that is, only the non-zero elements in the matrix are stored, which can contain all the information of the matrix.
[0074] Optionally, the information data format of the word-text matrix is defined, including the number of rows, the number of columns and the triple list. The number of rows and the number of columns are set according to the dimension information of the word-text matrix, the number of rows, the number of columns and the element value of the non-zero elements in the matrix are counted by traversing the word-text matrix, and the number of rows, the number of columns and the element value of the non-zero elements are formed into a triple, for example, the number of rows of the non-zero element is i, the number of columns is j, and the element value is x ij, the form of the constituted triple is (i, j, x ij ). The constituted triple is added to the triple list. The information data of the term-text matrix is generated according to the number of rows and columns of the term-text matrix and the triple list, and is converted into a preset string data format (such as a lightweight data exchange format) and stored in the database.
[0075] For example, the dimension of the term-text matrix of the "Work Safety System" is 127*32, i.e., the number of rows is 127 and the number of columns is 32. The term-text matrix is compressed into a triple list, and then the triple list is converted into a preset string format and stored in the database. For example, the element value of the first row and the second column in the term-text matrix is 0.572, which represents the term frequency-inverse document frequency of the "safety" term in the second sentence "to strengthen the management of work safety". The triple generated by the element value is (1, 2, 0.572). Other non-zero element values in the term-text matrix are sequentially converted according to the method and aggregated into the triple list.
[0076] By using the sparse matrix compression technology, i.e., the term-text matrix is converted into the form of term-text matrix information data for storage, the storage space of the associated data generated by the latent semantic analysis algorithm in the database is effectively reduced, the storage efficiency is optimized, the performance of the system is improved, the network transmission efficiency is improved, and the disk occupation space is reduced.
[0077] Optionally, in the system text retrieval method provided in the embodiments of the present application, before receiving the retrieval information input by the user, the method further includes: in the case where a system starting instruction is received, reading the latent semantic analysis data corresponding to the plurality of system texts from the database and storing the latent semantic analysis data corresponding to the plurality of system texts in the distributed cache component.
[0078] In an optional embodiment, when the system is started, all the latent semantic analysis data corresponding to the system specifications is automatically read from the database, the information data of the term-text matrix is restored into the term-text matrix, and the term-text matrix is stored in the distributed cache component.
[0079] Optionally, restoring the information data of the term-text matrix into the term-text matrix includes: constructing a matrix with all zero element values according to the number of rows and columns of the matrix in the information data of the term-text matrix, then traversing the triple list, and sequentially filling the element values into the matrix according to the row value and the column value of each triple to restore the entire term-text matrix.
[0080] Through the cache optimization mechanism, the performance of the retrieval process is improved, and high query efficiency can be maintained even in a resource-limited environment.
[0081] The embodiment of the application provides a lightweight system text retrieval method. Through latent semantic analysis, the system can understand the deep semantics of the text, thereby accurately positioning the text with similar semantics in the system text library. Sparse matrix compression technology is used to reduce data storage space and optimize storage efficiency. A cache optimization strategy and a parallel computing framework are introduced to speed up the retrieval speed, reduce network transmission delay, and improve the overall performance of the system. The search process is simplified, and the accuracy of the query is improved.
[0082] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0083] Embodiment 2
[0084] The embodiment of the application also provides a system text retrieval device. It should be noted that the system text retrieval device of the embodiment of the application can be used to execute the system text retrieval method provided by the embodiment of the application. The system text retrieval device provided by the embodiment of the application is introduced as follows.
[0085] According to the embodiment of the application, a system text retrieval device for implementing the system text retrieval method is also provided, as shown in Figure 4 The device comprises an acquisition unit 401, a processing unit 402, and a determination unit 403.
[0086] The acquisition unit 401 is configured to receive retrieval information input by a user, and acquire latent semantic analysis data corresponding to a plurality of system texts from a distributed cache component.
[0087] The processing unit 402 is configured to, for the latent semantic analysis data corresponding to each system text, convert the retrieval information according to the latent semantic analysis data to obtain a topic-text vector of the retrieval information.
[0088] The determination unit 403 is configured to determine a target system text from the plurality of system texts according to the latent semantic analysis data and the topic-text vector of the retrieval information, and generate a retrieval result according to the target system text.
[0089] The retrieval device for system texts provided in the embodiments of the present application receives the retrieval information input by a user through the obtaining unit 401, and obtains the latent semantic analysis data corresponding to a plurality of system texts from the distributed cache component; the processing unit 402 converts the retrieval information according to the latent semantic analysis data corresponding to each system text, and obtains the topic-text vector of the retrieval information; the determining unit 403 determines the target system text from the plurality of system texts according to the latent semantic analysis data and the topic-text vector of the retrieval information, and generates the retrieval result according to the target system text. The technical problem of low retrieval efficiency of the retrieval method in the related art when retrieving system texts is solved.
[0090] Optionally, in the retrieval device for system texts provided in the embodiments of the present application, the latent semantic analysis data at least includes a word set and a topic vector transformation matrix, and the processing unit 402 includes: a first processing subunit, configured to convert the retrieval information into a word-text vector according to the word set; and a second processing subunit, configured to convert the word-text vector into a topic-text vector according to the topic vector transformation matrix.
[0091] Optionally, in the retrieval device for system texts provided in the embodiments of the present application, the latent semantic analysis data further includes a topic-text matrix of the system texts, and the determining unit 403 includes: a calculation subunit, configured to calculate the similarity between the topic-text vector and each column vector of the topic-text matrix using a cosine distance formula; and a determination subunit, configured to take the system text corresponding to the topic-text matrix as the target system text if the similarity is greater than a preset threshold.
[0092] Optionally, in the retrieval device for system texts provided in the embodiments of the present application, the device further includes: an analysis unit, configured to obtain the system texts of a plurality of system norms before receiving the retrieval information input by the user, and perform latent semantic analysis on the system texts of each system norm to obtain the latent semantic analysis data corresponding to each system text; and a storage unit, configured to store the latent semantic analysis data corresponding to each system text in a database.
[0093] Optionally, in the system text retrieval device provided in the embodiment of the present application, the analysis unit comprises: a third processing subunit, configured to perform sentence processing on the system text of each system norm to obtain a sentence set of each system text, and perform word segmentation processing on the system text of each system norm to obtain a word set of each system text; a fourth processing subunit, configured to generate a word-text matrix of each system text according to the sentence set and the word set, and perform singular value decomposition on the word-text matrix to obtain a topic vector transformation matrix of each system text; a fifth processing subunit, configured to transform the word-text matrix according to the topic vector transformation matrix to obtain a topic-text matrix of each system text; and a sixth processing subunit, configured to form latent semantic analysis data corresponding to each system text according to the sentence set, the word set, the word-text matrix, the topic vector transformation matrix, and the topic-text matrix.
[0094] Optionally, in the system text retrieval device provided in the embodiment of the present application, the storage unit comprises: a first acquisition subunit, configured to acquire the number of rows and the number of columns of the word-text matrix; a second acquisition subunit, configured to traverse the word-text matrix, acquire the number of rows, the number of columns, and the element value of the non-zero elements in the word-text matrix, generate a triple according to the number of rows, the number of columns, and the element value of the non-zero elements, and generate a triple list according to the triple; a seventh processing subunit, configured to generate information data of the word-text matrix according to the number of rows and the number of columns of the word-text matrix and the triple list; and an eighth processing subunit, configured to convert the information data into a preset string data format and store the information data in the database.
[0095] Optionally, in the system text retrieval device provided in the embodiment of the present application, the device further comprises a loading unit, configured to, before receiving the retrieval information input by the user, read the latent semantic analysis data corresponding to the plurality of system texts from the database in the case of receiving a system startup instruction, and store the latent semantic analysis data corresponding to the plurality of system texts in the distributed cache component.
[0096] It should be noted that the above-mentioned acquisition unit 401, processing unit 402 and determination unit 403 correspond to steps S201 to S203 in Embodiment 1, and the three units have the same instances and application scenarios as the corresponding steps, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in the memory (for example, the memory 104) and processed by one or more processors (for example, the processors 102a, 102b, …, 102n), and the above-mentioned units can also be run in the computer terminal 10 provided in Embodiment 1 as a part of the device.
[0097] Embodiment 3
[0098] Embodiments of this application may provide an electronic device. Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 5 As shown, the electronic device may include: one or more ( Figure 5 Only one of the components is shown: processor 502, memory 504, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module, and display.
[0099] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0100] The processor can invoke information and applications stored in the memory via a transmission device to perform the following steps: receiving search information input by the user and obtaining latent semantic analysis data corresponding to multiple institutional texts from a distributed caching component; for each institutional text corresponding to latent semantic analysis data, transforming the search information based on the latent semantic analysis data to obtain a topic-text vector of the search information; determining the target institutional text from multiple institutional texts based on the latent semantic analysis data and the topic-text vector of the search information, and generating search results based on the target institutional text.
[0101] The processor can access the information and application programs stored in the memory via the transmission device to perform the following steps: converting the retrieval information into word-text vectors based on the word set; and converting the word-text vectors into topic-text vectors based on the topic vector transformation matrix.
[0102] The processor can access the information and application programs stored in the memory via the transmission device to perform the following steps: calculate the similarity between the topic-text vector and each column vector of the topic-text matrix using the cosine distance formula; if the similarity is greater than a preset threshold, then take the policy text corresponding to the topic-text matrix as the target policy text.
[0103] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining a plurality of system texts of system regulations before receiving the search information input by the user, and performing latent semantic analysis on each system text of system regulations to obtain latent semantic analysis data corresponding to each system text; and storing the latent semantic analysis data corresponding to each system text in the database.
[0104] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: performing sentence processing on each system text of system regulations to obtain a sentence set of each system text, and performing word processing on each system text of system regulations to obtain a word set of each system text; generating a word-text matrix of each system text according to the sentence set and the word set, and performing singular value decomposition on the word-text matrix to obtain a topic vector transformation matrix of each system text; transforming the word-text matrix according to the topic vector transformation matrix to obtain a topic-text matrix of each system text; and forming latent semantic analysis data corresponding to each system text according to the sentence set, the word set, the word-text matrix, the topic vector transformation matrix, and the topic-text matrix.
[0105] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining the number of rows and columns of the word-text matrix; traversing the word-text matrix to obtain the number of rows, the number of columns, and the element value of the non-zero element in the word-text matrix, and generating a triple according to the number of rows, the number of columns, and the element value of the non-zero element, and generating a triple list according to the triple; generating information data of the word-text matrix according to the number of rows and columns of the word-text matrix and the triple list; and converting the information data into a preset string data format and storing it in the database.
[0106] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: before receiving the search information input by the user, in the case of receiving a system start instruction, reading the latent semantic analysis data corresponding to the plurality of system texts from the database, and storing the latent semantic analysis data corresponding to the plurality of system texts in the distributed cache component.
[0107] Those skilled in the art can understand that, Figure 5 The structure shown is only schematic, and the electronic device can also be a smart phone, a tablet computer, a palm computer, a mobile Internet device (MID), a PAD, and the like. Figure 5 It does not limit the structure of the above-mentioned electronic device. For example, the electronic device can further include more or less components (such as a network interface, a display device, etc.) than those shown in the figure, or have a structure different from that shown in the figure. Figure 5 The structure shown is only schematic, and the electronic device can also be a smart phone, a tablet computer, a palm computer, a mobile Internet device (MID), a PAD, and the like.Figure 5 different configurations.
[0108] Those skilled in the art can understand that all or part of the steps of various methods in the above embodiments can be completed by instructing the terminal device related hardware through a program, and the program can be stored in a computer readable storage medium, which can include a flash disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0109] Embodiment 4
[0110] The embodiments of the present application further provide a computer readable storage medium. Optionally, in the embodiment, the storage medium can be used to store the program code executed by the system text retrieval method provided in the embodiment 1.
[0111] Optionally, in the embodiment, the storage medium can be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
[0112] The present application further provides a computer program product, which, when executed on a data processing device, is adapted to execute the steps of the system text retrieval method.
[0113] The above embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0114] In the above embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0115] In the several embodiments provided by the present application, it should be understood that the disclosed technology can be implemented in other ways. Of course, the above device embodiments are only schematic. For example, the division of units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection between units can be indirect coupling or communication connection through some interface, and can be electrical or other forms.
[0116] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0117] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0118] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various program code storage media.
[0119] The above is only the preferred embodiment of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A retrieval method of a system text, characterized by, The method comprises the following steps: receiving search information input by a user, and obtaining latent semantic analysis data corresponding to a plurality of system texts from a distributed cache component; for the latent semantic analysis data corresponding to each system text, converting the search information according to the latent semantic analysis data to obtain a topic-text vector of the search information; determining a target system text from the plurality of system texts according to the latent semantic analysis data and the topic-text vector of the search information, and generating a search result according to the target system text.
2. The method of claim 1, wherein, The latent semantic analysis data at least comprises a word set and a topic vector transformation matrix, and converting the search information according to the latent semantic analysis data to obtain the topic-text vector of the search information comprises the following steps: converting the search information into a word-text vector according to the word set; converting the word-text vector into the topic-text vector according to the topic vector transformation matrix.
3. The method of claim 1, wherein, The latent semantic analysis data further comprises a topic-text matrix of the system text, and determining the target system text from the plurality of system texts according to the latent semantic analysis data and the topic-text vector of the search information comprises the following steps: calculating the similarity between the topic-text vector and each column vector of the topic-text matrix using a cosine distance formula; if the similarity is greater than a preset threshold, taking the system text corresponding to the topic-text matrix as the target system text.
4. The method of claim 1, wherein, Before receiving the search information input by the user, the method further comprises the following steps: obtaining system texts of a plurality of system regulations, and performing latent semantic analysis on the system text of each system regulation to obtain latent semantic analysis data corresponding to each system text; storing the latent semantic analysis data corresponding to each system text in a database.
5. The method of claim 4, wherein, Performing latent semantic analysis on the system text of each system regulation to obtain the latent semantic analysis data corresponding to each system text comprises the following steps: performing sentence processing on the system text of each system regulation to obtain a sentence set of each system text, and performing word segmentation processing on the system text of each system regulation to obtain a word set of each system text; generating a word-text matrix of each system text according to the sentence set and the word set, and performing singular value decomposition on the word-text matrix to obtain a topic vector transformation matrix of each system text; transforming the word-text matrix according to the topic vector transformation matrix to obtain a topic-text matrix of each system text; composing the latent semantic analysis data corresponding to each system text according to the sentence set, the word set, the word-text matrix, the topic vector transformation matrix and the topic-text matrix.
6. The method of claim 5, wherein, Storing the latent semantic analysis data corresponding to each system text in the database comprises the following steps: obtaining the number of rows and columns of the word-text matrix; traversing the word-text matrix, obtaining the row number, column number and element value of the non-zero element in the word-text matrix, and generating a triple according to the row number, column number and element value of the non-zero element, generating a triple list according to the triple; generating information data of the word-text matrix according to the row number and column number of the word-text matrix and the triple list; converting the information data into a preset string data format and storing in a database.
7. The method of claim 1, wherein, Before receiving the search information input by the user, the method further comprises: In the case of receiving a system startup instruction, reading the latent semantic analysis data corresponding to the multiple system texts from the database, and storing the latent semantic analysis data corresponding to the multiple system texts in the distributed cache component.
8. A device for retrieving institutional texts, characterized in that, Comprise: An acquisition unit is configured to receive search information input by a user and acquire latent semantic analysis data corresponding to multiple system texts from a distributed cache component; A processing unit is configured to, for latent semantic analysis data corresponding to each system text, convert the search information according to the latent semantic analysis data to obtain a topic-text vector of the search information; A determination unit is configured to determine a target system text from the multiple system texts according to the latent semantic analysis data and the topic-text vector of the search information, and generate a search result according to the target system text.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium comprises a stored executable program, wherein the executable program controls the device where the computer-readable storage medium is located to execute the system text retrieval method of any one of claims 1 to 7 when the executable program is running.
10. An electronic device, comprising: Comprise: A memory storing an executable program; A processor configured to run the program, wherein the program executes the system text retrieval method of any one of claims 1 to 7 when the program is running.