Corpus index display method and device, equipment, medium and product thereof
Patent Information
- Application Number
- CN202210917023.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-01
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2042-08-01
AI Technical Summary
但是,采用索引值来表示语料,对编程人员的阅读体验来说是不够友善的,编程人员很难记忆多个相对应的索引值,从而每次面对脚本文件中的索引值时,都需要经过一番复杂的查询检索过程,才能了解各个索引值相对应的文案内容,非常不方便
[0041]Compared with existing technologies, this application has several advantages, including but not limited to: After loading the corpus, this application allows multiple statements to be selected from a script file to form a corpus set, and then a single corpus replacement instruction is applied. Based on each statement in the corpus set, the corresponding index value is determined from the corpus, and each corresponding statement in the script file is replaced with the corresponding index value, thereby achieving one-click replacement of the corpus. The index value facilitates the generation of different language versions of the corpus in the script file, making it convenient to convert between different language versions, improving operational convenience, and accelerating the development efficiency of software engineering.
Smart Images

Figure CN115237412B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software engineering technology, and in particular to a corpus indexing and display method and its corresponding apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] When developing front-end software projects in software engineering, if the software project is an international project and needs to implement multiple language versions, the copy in the project needs to be multilingual. That is, the copy used in the project needs to provide corresponding language data for different languages, so that developers who are accustomed to different languages can easily view the language data in different languages, and also facilitate the production of software versions corresponding to different languages.
[0003] In practice, in the code of script files in software projects, to associate corpora of different languages, the corresponding corpora are usually converted into their corresponding index values and inserted into the appropriate locations in the code. This way, the computer can subsequently call the corresponding corpus based on the index value to complete encoding or parsing, which is very convenient. However, using index values to represent corpora is not user-friendly for programmers. Programmers find it difficult to remember multiple corresponding index values, requiring a complex search process each time they encounter an index value in a script file to understand the corresponding text content, which is very inconvenient.
[0004] Therefore, the corpus processing for multilingual software projects needs to be carefully designed to adapt to specific development scenarios in order to improve the efficiency of software engineering implementation. Summary of the Invention
[0005] The purpose of this application is to solve the above-mentioned problems by providing a corpus index display method and corresponding apparatus, computer equipment, computer-readable storage medium, and computer program product.
[0006] To suit the various purposes of this application, the following technical solution is adopted:
[0007] In one aspect, a corpus index display method is provided to suit one of the purposes of this application, comprising:
[0008] Load a corpus containing mapping data between index values and corpora;
[0009] In response to the statement selection command, the system obtains the corpus of each statement selected by the user from the script file.
[0010] In response to a single corpus replacement instruction, the index value of each statement in the corpus is determined from the corpus, and the corpus in the script file is replaced with its corresponding index value.
[0011] Optionally, after loading the corpus, the following are included:
[0012] Obtain the target word, which is either an index value or a corpus;
[0013] The corpus is used to retrieve the corpus and / or index value corresponding to the target word, and the result list is displayed on the graphical user interface.
[0014] In response to a user's selection of any corpus or index value in the results list, the target word is replaced with the selected corpus and / or index value.
[0015] Optionally, the corpus and / or index values corresponding to the target word are retrieved from the corpus, and a result list is displayed on the graphical user interface, including:
[0016] Determine whether the target word is an index value or part of the corpus;
[0017] When the target word is an index value, rule matching is performed in the corpus to retrieve the corpus of the mapping relationship data with the same index value as the target word, forming a first result list.
[0018] When the target word is a corpus, semantic matching is performed in the corpus, and the mapping relationship data between the corpus and the target word that are semantically matched is retrieved to form a second result list;
[0019] The results list is displayed via a floating layer, wherein the index value and / or corpus in each mapping relationship data is configured as an option to be selected by an operation event.
[0020] Optionally, when the target word is a corpus, semantic matching is performed in the corpus to retrieve the mapping relationship data that semantically matches the target word, forming a second result list, including:
[0021] When the target word is a corpus, a feature extractor pre-trained to a convergent state is used to extract the text vector of the target word;
[0022] The text similarity between the text vector of the target word and the text vector of each corpus in the mapping relationship data of the corpus is calculated. The text vector of each corpus in the corpus is obtained in advance by the feature extractor.
[0023] The mapping relationship data with high text similarity are selected to form the second result list.
[0024] Optionally, retrieve target words, including:
[0025] Responding to the user's search command, retrieve the text string entered by the user in the search box as the target word;
[0026] or,
[0027] Responding to mouse hover commands, the text being pointed to by the mouse is used as the target word based on the mouse position.
[0028] Optionally, load the corpus, including:
[0029] In response to the server's corpus update notification, a corpus update request is sent to the server, which includes the language information corresponding to the corpus.
[0030] Obtain the corpus corresponding to the language information that is pushed by the server in response to the corpus update request;
[0031] The corpus is loaded by replacing the historical corpus with the corpus described above.
[0032] On the other hand, to suit one of the purposes of this application, a corpus index display device is provided, comprising: a corpus loading module for loading a corpus containing mapping relationship data between index values and corpora; a statement selection module for responding to a statement selection instruction and obtaining corpora from each statement selected by the user from a script file to form a corpus set; and a one-click execution module for responding to a single corpus replacement instruction, determining the index values of each statement in the corpus set from the corpus, and replacing each corpus in the script file with its corresponding index value.
[0033] Optionally, following the corpus loading module, it includes: a word extraction submodule for acquiring a target word, wherein the target word is an index value or corpus; a retrieval submodule for retrieving the corpus and / or index value corresponding to the target word from the corpus and constructing a result list to be displayed on the graphical user interface; and a single-item replacement submodule for responding to an operation event in which the user selects any corpus or index value in the result list and replacing the target word with the selected corpus and / or index value.
[0034] Optionally, the retrieval submodule includes: an object determination unit, used to determine whether the target word is an index value or corpus; a first matching unit, used to perform rule matching in the corpus when the target word is an index value, and retrieve corpus data in the mapping relationship data where the index value is the same as the target word to form a first result list; a second matching unit, used to perform semantic matching in the corpus when the target word is corpus, and retrieve mapping relationship data in the corpus that semantically matches the target word to form a second result list; and a result display unit, used to display the result list through a floating layer, wherein the index value and / or corpus in each mapping relationship data is configured as an option, making it suitable for selection by an operation event.
[0035] Optionally, the second matching unit includes: a vector generation subunit, used to extract the text vector of the target word using a pre-trained feature extractor to a convergent state when the target word is a corpus; a similarity calculation subunit, used to calculate the text similarity between the text vector of the target word and the text vector of the corpus in each mapping relationship data in the corpus, wherein the text vector of each corpus in the corpus is pre-extracted by the feature extractor; and a structure construction subunit, used to select the mapping relationship data with higher text similarity to form a second result list.
[0036] Optionally, the word extraction submodule includes: a search word extraction submodule, used to respond to a user's search command and obtain the text string entered by the user in the search box as the target word; or, a hover word extraction submodule, used to respond to a mouse hover command and determine the corpus pointed to by the mouse as the target word based on the mouse position.
[0037] Optionally, the corpus loading module includes: a request update submodule, used to respond to the server's corpus update notification and send a corpus update request to the server, which includes language information corresponding to the corpus; an update acquisition submodule, used to acquire the corpus corresponding to the language information pushed by the server in response to the corpus update request; and a corpus upgrade submodule, used to replace the historical corpus with the corpus to complete the corpus loading.
[0038] In another aspect, a computer device provided for one of the purposes of this application includes a central processing unit and a memory, the central processing unit being used to invoke and run a computer program stored in the memory to perform the steps of the corpus indexing and display method described in this application.
[0039] On another aspect, a computer-readable storage medium is provided to suit another purpose of this application, which stores, in the form of computer-readable instructions, a computer program implemented according to the corpus indexing and display method, which, when invoked by a computer, performs the steps included in the method.
[0040] In another aspect, a computer program product provided for another purpose of this application includes a computer program / instructions that, when executed by a processor, implement the steps of the corpus indexing and display method described in any embodiment of this application.
[0041] Compared with existing technologies, this application has several advantages, including but not limited to: After loading the corpus, this application allows multiple statements to be selected from a script file to form a corpus set, and then a single corpus replacement instruction is applied. Based on each statement in the corpus set, the corresponding index value is determined from the corpus, and each corresponding statement in the script file is replaced with the corresponding index value, thereby achieving one-click replacement of the corpus. The index value facilitates the generation of different language versions of the corpus in the script file, making it convenient to convert between different language versions, improving operational convenience, and accelerating the development efficiency of software engineering. Attached Figure Description
[0042] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0043] Figure 1 This is a flowchart illustrating one embodiment of the corpus indexing and display method of this application.
[0044] Figure 2 This is a schematic diagram illustrating the process of displaying a result list based on target words to achieve human-computer interaction in an embodiment of this application.
[0045] Figure 3 This is a schematic diagram of the process for determining the second result list through semantic matching in an embodiment of this application.
[0046] Figure 4 This is a schematic diagram illustrating the process of implementing human-computer interaction based on verification configuration information to merge development branches in an embodiment of this application.
[0047] Figure 5 This application provides a schematic diagram of the process for loading a corpus in an embodiment.
[0048] Figure 6 This is a schematic diagram of the corpus index display device of this application;
[0049] Figure 7 This is a schematic diagram of the structure of a computer device used in this application. Detailed Implementation
[0050] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0051] Unless otherwise specified, the neural network models referenced or potentially referenced in this application may be deployed on a remote server and invoked remotely on the client, or deployed on a client with the capability to invoke directly. In some embodiments, when running on the client, the corresponding intelligence may be acquired through transfer learning in order to reduce the requirements on the client's hardware resources and avoid excessive consumption of the client's hardware resources.
[0052] Unless otherwise expressly stated, the various embodiments disclosed in this application can be combined in a cross-cutting manner to flexibly construct new embodiments, as long as such combination does not depart from the inventive spirit of this application and can meet the needs of the prior art or solve a certain deficiency in the prior art. Those skilled in the art should be aware of such modifications.
[0053] This application discloses a corpus indexing and display method, which can be programmed into a computer program product and deployed on a client or server for execution. Please refer to... Figure 1 In one embodiment of the corpus index display method of this application, the following steps are included:
[0054] Step S1100: Load the corpus, which contains mapping data between index values and corpus data;
[0055] In an exemplary application scenario, the software project of this application can use JavaScript as the programming scripting language, be developed in the VSCode code encoder, and then run in the NodeJS runtime environment provided by the Chrome V8 engine.
[0056] The corpus to be embedded in the scripting language can be obtained from a corpus, which can be stored on a multilingual platform and downloaded by providing the platform's network address. Each corpus is assigned a corresponding index value, and each index value is a unique feature, allowing for the unique identification of its corresponding corpus through a single index value. Within the multilingual platform, corpora in different languages can be configured for each index value to represent the same text content.
[0057] The corpus can be a corpus in a language version that is adapted to the default language set on the local development end. It contains mapping data between index values and corpora expressed in the default language. For example, the default language is set to Chinese on the local development end, and then the server where the multilingual platform is located requests to download the Chinese version of the corpus. The corpus obtained in this way is stored on the local storage device for retrieval.
[0058] Step S1200: Respond to the statement selection instruction and obtain the corpus set composed of the corpus of each statement selected by the user from the script file;
[0059] In an editor used for encoding script files, such as the VSCode code encoder, an extension plugin can be used to provide a toggle control for entering a statement selection mode. When a user opens a script file and operates the toggle control based on the script file, they can enter the statement selection mode.
[0060] Each line of code in the script file may contain corpus expressed in a default language, depending on the actual coding practices of the developers. In one embodiment, after entering the statement selection mode, a checkbox may be provided to the left or right of each statement for selecting the corresponding statement.
[0061] A separate confirmation control is set up in the development interface. After the developer selects one or more statements in the script file, the confirmation command is triggered when the developer operates the confirmation control, and the selected statements are constructed into a corpus. It is easy to understand that the statements in the corpus may include corpus expressed in the default language, or they may not include such corpus but will be identified later.
[0062] In one embodiment, when displaying the corresponding checkboxes for each statement, it is possible to select a line to detect whether each statement in the script file contains corpus, for example, to detect whether a statement contains a string reserve character (e.g., double quotes), and the string indicated by the reserve character is taken as the corpus. For statements containing corpus, the checkbox of that statement is set to an optional active state, while the checkbox of statements without corpus is set to an unselectable deactivated state.
[0063] Step S1300: In response to a single corpus replacement instruction, determine the index value of each statement in the corpus from the corpus, and replace each corpus in the script file with its corresponding index value.
[0064] After the user determines the corpus set, a replacement control is further provided in the development interface. This replacement control is implemented to trigger a single corpus replacement instruction, which replaces all the corpora in the corpus set and replaces the corresponding corpora in the script file with their corresponding index values.
[0065] When the corpus replacement instruction is triggered, the corresponding data record is retrieved one by one from the corpus according to each corpus in the corpus set. Each data record stores the mapping relationship data between the corresponding corpus and its index value. Thus, the mapping relationship data of each corpus in the sentence set is obtained, which can be used to determine the corresponding index value based on the corpus.
[0066] Furthermore, for each selected statement in the script file, for each corpus in each statement, each corpus is determined to have its corresponding index value. By replacing the index value of the corresponding corpus in the script file based on the entire corpus set, the replacement of the corpus in all selected statements in the script file can be achieved.
[0067] In the process of replacing corpus with index value, the corpus is used as an intermediate medium instead of directly querying the corpus. This is mainly because the corpus can play a role in deduplication. When multiple sentences use the same corpus, the sentences with the same corpus are treated as the same processing object through the corpus. Subsequently, a corresponding data record is determined, which can then serve to replace the corpus in multiple sentences, thus improving processing efficiency.
[0068] As can be seen, by responding to a single corpus replacement command, the corpus in the script file is replaced, and the corpus in each selected statement is replaced with the corresponding index value. This can achieve one-click replacement of the corpus in all selected statements, avoiding the need for developers to set index values individually and greatly improving the efficiency of program writing.
[0069] Based on the above embodiments, it is easy to understand that this application has many advantages, including but not limited to: after loading the corpus, this application allows multiple statements to be selected from the script file to form a corpus set, and then a single corpus replacement instruction is given. According to each statement in the corpus set, its corresponding index value is determined from the corpus, and each corresponding statement in the script file is replaced with the corresponding index value, thereby realizing one-click replacement of the corpus. The index value facilitates the generation of different language versions of the corpus in the script file, making it convenient to convert between different language versions, improving operational convenience, and accelerating the development efficiency of software engineering.
[0070] Developers can obtain the index values and / or corpus required by the script file by providing target words as query objects, which can be used as information prompts or as an option. Therefore, based on any embodiment of this application, please refer to... Figure 2 After loading the corpus, it includes:
[0071] Step S2100: Obtain the target word, where the target word is an index value or corpus;
[0072] The target word can be an index value, which is used to retrieve the corresponding corpus from the corpus and display it on the screen as a prompt, or it can be a corpus, which is used to search for multiple mapping relationship data similar to the corpus so that the developer can select the index value or corpus, or it can simply serve as a prompt.
[0073] The target words can be obtained either by extracting words from a script file or by having the developer input them into the provided search box.
[0074] In one embodiment, this step includes performing the following steps: responding to a user search command and obtaining the text string entered by the user in the search box as the target word. Specifically, using the plugin extended in the code encoder of this application, a search box is provided in the development interface, into which the developer user enters a text string for searching the corpus, which can be regarded as the corpus to be searched. The extended plugin is responsible for segmenting the text string entered into the search box to obtain each word element. Any one of these word elements or any combination of these word elements can be regarded as the target word, and the subsequent search of the corpus is performed using these word elements or any combination of them.
[0075] In another embodiment, this step includes performing the following steps: responding to a mouse hover command and determining the corpus pointed to by the mouse as the target word based on the mouse position. Specifically, in one approach, mouse position information is obtained by listening to mouse hover commands, and then a sentence corresponding to the mouse position is obtained based on the mouse position information. The corpus pointed to by the mouse position is then determined from the sentence. This corpus is typically the corpus indicated by the reserved characters, and this corpus can be used as the target word. Using the entire corpus as the target word facilitates subsequent accurate matching of its index value. In another approach, the word pointed to by the mouse position can be determined, and this word can be used as the target word. Using a single word as the target word makes it easier to match multiple mapping relationship data from the corpus through fuzzy search.
[0076] As an auxiliary means, in one embodiment, after the corresponding target word is determined in response to the mouse hover command, the target word determined in the script file can be highlighted, so that developers can quickly understand the selected target word.
[0077] In another embodiment, an adjustment control for expanding the length of the selected string is provided in the highlighted target word, allowing developers to adjust the specific text constituting the target word as needed by arbitrarily changing the text range covered by the entire adjustment control on the left and right sides.
[0078] Step S2200: Retrieve the corpus and / or index value corresponding to the target word from the corpus, and display the result list on the graphical user interface;
[0079] Based on the target words determined in the previous step, a search can be performed in the corpus to obtain a list of results.
[0080] In one embodiment, the target word is an index value. Since there is usually a one-to-one correspondence between the index value and the corpus, when a developer enters the target word as an index value from the search box or selects it by hovering the mouse, it is understood as being used to query the corpus corresponding to the index value. Accordingly, by using exact matching, the mapping relationship data corresponding to the target word (index value) can be queried in the corpus, and then the corpus can be obtained to get a result list. This result list is actually only used to display the exact matched mapping relationship data, that is, the data pair between the index value and its corpus, or it can be just the corpus corresponding to the index value in the mapping relationship data.
[0081] In another embodiment, the target word is a corpus, which may contain only a single word or a complete string from a complete corpus. When a user enters a text string from the search box, or selects a corpus or word in a corpus within a script file by hovering the mouse, thus determining the target word, this can be understood as the developer wanting to fuzzily determine related corpora and / or their index values that are semantically similar to the target word using the target word they provide. Alternatively, it can be understood as the developer wanting to find the index value of the corpus corresponding to their target word so that they can perform corresponding editing operations based on the returned results. Similarly, for the target word provided by the user that belongs to the corpus, fuzzy matching can be performed in the corpus to retrieve mapping relationship data between the corpus and the target word that are the same or similar in meaning, forming a result list. In the result list, the index value corresponding to the corpus of the target word can be provided separately, or the data pairs between the corpus and the index value that match the corpus of the target word can be provided.
[0082] Regardless of how the results list is obtained, it can be formatted and displayed in the graphical user interface where the script file is located, so that developers can select the objects they need and insert or replace them at a specified position in the script text, such as inserting them at the current cursor position or replacing the highlighted target words.
[0083] In one embodiment, when the target word is a corpus, semantic matching is performed in the corpus to retrieve mapping relationship data that semantically matches the target word. Then, a result list is constructed. During the formatted display of the result list, the index values and their corresponding corpora in each mapping relationship data are listed. Furthermore, each index value and each corpus is configured as an option so that developers can click on any one of them to insert the selected index value or corpus into the corresponding position in the script file, thus achieving insertion or replacement.
[0084] Step S2300: In response to the user's operation event of selecting any corpus or index value in the result list, replace the target word with the selected corpus and / or index value.
[0085] As mentioned earlier, whether the results list contains a single index value or mapping data between index values and corpora, the index values and corpora can be configured as optional. Thus, the user can select any corpus or index value, and the selected corpus or index value will be inserted into the position of the cursor in the script file, or replace the highlighted target word, thereby realizing the insertion of corpus or index values into the search results based on the target word.
[0086] Based on the above embodiments, it is easy to understand that in this application, multiple methods can be used to understand user input, including input via a search box or selection via mouse hover. The system adapts to different input methods, flexibly understands user intent, and retrieves corresponding results based on different user search intents. This not only enables the corpus to be retrieved using index values and displayed as a suggestion through a results list, but also allows for the fuzzy or precise search of the corpus to retrieve corresponding index values, or other similar corpus and index value mapping data, which are then displayed to the developer for selection in the form of a results list. After the developer selects one, the selected result can be inserted into the script file, thus facilitating quick and easy editing of the corpus and its index values in the script text, greatly improving code writing efficiency.
[0087] Based on any embodiment of this application, please refer to Figure 3 The corpus retrieves the corresponding corpus and / or index values for the target word, and displays the results list on the graphical user interface, including:
[0088] Step S2210: Determine whether the target word is an index value or corpus;
[0089] Index values and corpora each have their own characteristics. For example, index values are usually in numerical form, while corpora are usually in text form. Therefore, we can determine whether the target word is an index value or corpus by judging its data type, and then perform corresponding processing on the index value or corpus respectively.
[0090] Step S2220: When the target word is an index value, perform rule matching in the corpus to retrieve the corpus of the mapping relationship data with the same index value as the target word to form a first result list;
[0091] When the target word is determined to be an index value, it usually means that the user wants to view the corresponding corpus for a specific index value. Therefore, rule matching can be performed on the corpus, specifically, an exact match. This retrieves the mapping relationship data in the corpus where the index value equals the target word; this is usually a single data record. Then, the corpus within that record is obtained as the first result list. It's easy to understand that the first result list can actually contain a single corpus.
[0092] Step S2230: When the target word is a corpus, perform semantic matching in the corpus and retrieve the mapping relationship data that semantically matches the target word to form a second result list;
[0093] When the target word is identified as a corpus, since the corpus contains semantics, it can be entered through a search box or obtained by mouse word selection. Therefore, it usually means that the user wants to obtain similar corpus and / or index values for the target word, or obtain the index values of the corpus corresponding to these target words.
[0094] To accommodate various user query intentions, in this embodiment, the target word is semantically matched one by one with the corpus data records. All mapping relationship data that semantically match the target word are filtered out to form a second result list. It is easy to understand that the second result list can simultaneously provide the index value and corresponding corpus from the mapping relationship data, so that users can select not only a specific index value but also a specific corpus through the second result list.
[0095] Step S2240: Display the result list via a floating layer, wherein the index value and / or corpus in each mapping relationship data is configured as an option to be selected by an operation event.
[0096] Regardless of whether the obtained result list is a first result list or a second result list, it can be displayed in the graphical user interface where the script file is located through a unified formatting and display operation. Specifically, in this embodiment, a floating layer is created, a list control is added to the floating layer, and then the result list is displayed in the list control.
[0097] To facilitate user selection of index values or corpora in the results list, each index value and each corpus in the list control is configured as an option when the results list is displayed in a formatted manner. This allows them to be selected in response to the user's touch operation event, and then inserted into the corresponding cursor position in the script text or replaced with the highlighted target word.
[0098] Based on the above embodiments, it is easy to understand that developers do not need to clearly express their operational intentions; they only need to provide the corresponding target words. This application can accommodate multiple operational intentions of the user and determine the corresponding corpus for the target words, thus providing a prompt; or it can determine the corresponding corpus and index value for the target words, providing them to the user for invocation or at least providing a prompt. Therefore, this application provides greater operational convenience for the software code development process. Developers can directly achieve the desired results without performing multi-level operations. When handling multilingual software projects, various corpora and their index values can be quickly edited in the code files, and they can be interchanged at any time to overcome the obstacles brought by multiple language versions, significantly improving the efficiency of software engineering implementation.
[0099] Based on any embodiment of this application, please refer to Figure 4 When the target word is a corpus, semantic matching is performed in the corpus to retrieve the mapping relationship data between the corpus and the target word that constitutes a semantic match, forming a second result list, including:
[0100] Step S2231: When the target word is a corpus, use a feature extractor that has been pre-trained to convergence state to extract the text vector of the target word;
[0101] When using target words as the corpus, a pre-trained feature extractor that has reached a convergence state can be used to achieve semantic matching based on target words.
[0102] The feature extractor mentioned can be a text feature extractor, including but not limited to deep learning models implemented using recurrent neural networks such as LSTM and BERT, all of which can be used as text feature extractors. Of course, the text feature extractor needs to be connected to a classifier first, and trained to a convergent state using sufficient training samples, so that it learns the ability to represent text information as features before it can be put into use.
[0103] For the target word, it can be embedded to obtain its corresponding word vector, and then input into the text feature extraction model to extract its corresponding deep semantic information and obtain the corresponding text vector.
[0104] Step S2232: Calculate the text similarity between the text vector of the target word and the text vector of the corpus in each mapping relationship data in the corpus. The text vector of each corpus in the corpus is pre-extracted by the feature extractor.
[0105] Similarly, for each mapping relationship data in the corpus, the feature extractor described above can be used to extract deep semantic information one by one to obtain its corresponding text vector, which is then stored in the corpus for later use.
[0106] Therefore, the text distance between the text vector of the target word and the text vectors of the corpora in each mapping relationship data in the corpus can be calculated as the text similarity. The algorithm used to calculate the data distance can be any of the following: cosine similarity algorithm, Euclidean distance algorithm, Pearson correlation coefficient algorithm, Jaccard coefficient algorithm, etc. After calculating the data distance, it is normalized to a specific numerical space, such as the [0,1] numerical space, where a higher value indicates a closer similarity between the corresponding corpus and the target word, and can then be used as the text similarity.
[0107] Step S2233: Select the mapping relationship data with high text similarity to form the second result list.
[0108] After obtaining the text similarity between each corpus and the target word, in one embodiment, the data records in the corpus are sorted in reverse order according to the text similarity. Then, according to a preset number, a number of data records with the highest sort order are selected, and the mapping relationship data corresponding to these data records can be used to construct a second result list.
[0109] In another embodiment, the text similarity of each corpus in the corpus can be filtered according to a preset threshold. The preset threshold can be an empirical threshold. The mapping relationship data of each corpus whose text similarity is higher than the preset threshold can be filtered out to construct the second result list.
[0110] Based on the above embodiments, it is easy to understand that the second result list obtained by semantic matching based on the deep semantic information of the target word and each corpus in the corpus, since it obtains the deep semantic information of the target word and the corpus with the help of the feature extractor, and calculates the text similarity between the two based on the deep semantic information, can more accurately represent the matching relationship between the target word and the corpus. This makes the result information contained in the second result list more able to meet the needs of the development user, provide them with effective index information, facilitate their quick selection of index values or corpus, and improve their code writing efficiency.
[0111] Based on any embodiment of this application, a corpus is loaded; please refer to [link / reference]. Figure 5 ,include:
[0112] Step S1110: Respond to the server's corpus update notification by sending a corpus update request to the server, which includes the language information corresponding to the corpus;
[0113] When an update event occurs in the corpus of the multilingual development platform server, an update notification can be generated and broadcast to the terminal devices of each developer user. After receiving the update notification, the current terminal device can send a corpus update request to the server, and include the default language set on the local machine in the update request to provide language information so that the server can obtain the language information and provide the corresponding updated version of the corpus.
[0114] Specifically, in response to the update request, the server determines the latest version of the corpus for the corresponding language based on the language information in the update request, and then pushes it to the current terminal device.
[0115] Step S1120: Obtain the corpus corresponding to the language information pushed by the server in response to the corpus update request;
[0116] The current terminal device has begun downloading the latest version of the corpus pushed by the server to its local machine. The download process supports resuming interrupted downloads.
[0117] Step S1130: Replace the historical corpus with the corpus to complete the corpus loading.
[0118] Once the latest version of the corpus is completed, it can replace the historical corpus, keeping it as the corpus corresponding to the default language, thus completing the loading of the corpus required for this application.
[0119] Based on the above embodiments, this application can ensure that the latest version of the corpus is always used to provide query index services for the corpus during the script text writing process, thereby maintaining collaborative development among different development users and avoiding errors in reference index values or corpus due to different versions of the corpus among different users.
[0120] Please see Figure 6 To meet one of the purposes of this application, a corpus index display device is provided, which is a functional embodiment of the corpus index display method of this application. The device includes: a corpus loading module 1100, used to load a corpus containing mapping relationship data between index values and corpora; a statement selection module 1200, used to respond to a statement selection instruction and obtain the corpora from each statement selected by the user from a script file to form a corpus set; and a one-click execution module 1300, used to respond to a single corpus replacement instruction, determine the index values of each statement in the corpus set from the corpus, and replace each corpus in the script file with its corresponding index value.
[0121] Based on any embodiment of this application, the corpus loading module 1100 includes: a word extraction submodule for acquiring a target word, wherein the target word is an index value or corpus; a retrieval submodule for retrieving the corpus and / or index value corresponding to the target word from the corpus and constructing a result list to be displayed on a graphical user interface; and a single-item replacement submodule for responding to an operation event in which a user selects any corpus or index value in the result list and replacing the target word with the selected corpus and / or index value.
[0122] Based on any embodiment of this application, the retrieval submodule includes: an object determination unit, used to determine whether the target word is an index value or corpus; a first matching unit, used to perform rule matching in the corpus when the target word is an index value, and retrieve corpus from the mapping relationship data where the index value is the same as the target word to form a first result list; a second matching unit, used to perform semantic matching in the corpus when the target word is corpus, and retrieve mapping relationship data where the corpus and the target word are semantically matched to form a second result list; and a result display unit, used to display the result list through a floating layer, wherein the index value and / or corpus in each mapping relationship data is configured as an option, making it suitable for selection by an operation event.
[0123] Based on any embodiment of this application, the second matching unit includes: a vector generation subunit, used to extract the text vector of the target word using a pre-trained feature extractor to a convergent state when the target word is a corpus; a similarity calculation subunit, used to calculate the text similarity between the text vector of the target word and the text vector of the corpus in each mapping relationship data in the corpus, wherein the text vector of each corpus in the corpus is pre-extracted by the feature extractor; and a structure construction subunit, used to select the mapping relationship data with higher text similarity to form a second result list.
[0124] Based on any embodiment of this application, the word extraction submodule includes: a search word extraction submodule, used to respond to a user search command and obtain the text string entered by the user in the search box as the target word; or, a hover word extraction submodule, used to respond to a mouse hover command and determine the corpus pointed to by the mouse as the target word based on the mouse position.
[0125] Based on any embodiment of this application, the corpus loading module 1100 includes: a request update submodule, used to respond to a corpus update notification from the server and send a corpus update request to the server, which includes language information corresponding to the corpus; an update acquisition submodule, used to acquire the corpus corresponding to the language information pushed by the server in response to the corpus update request; and a corpus upgrade submodule, used to replace the historical corpus with the corpus to complete the corpus loading.
[0126] To address the aforementioned technical problems, embodiments of this application also provide computer equipment. For example... Figure 7 As shown, the computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. The computer-readable storage medium stores an operating system, a database, and computer-readable instructions. The database may store a sequence of control information. When the computer-readable instructions are executed by the processor, the processor can implement a product search category identification method. The processor of the computer device provides computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute the corpus indexing and display method of this application. The network interface of the computer device is used for communication with a terminal. Those skilled in the art will understand that... Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0127] In this embodiment, the processor is used to execute... Figure 6 The system contains the specific functions of each module and its sub-modules, and the memory stores the program code and various data required to execute these modules or sub-modules. The network interface is used for data transmission between the user terminal and the server. In this embodiment, the memory stores the program code and data required to execute all modules / sub-modules in the corpus indexing display device of this application, and the server can call the server's program code and data to execute the functions of all sub-modules.
[0128] This application also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the corpus indexing and display method of any embodiment of this application.
[0129] This application also provides a computer program product, including a computer program / instructions that, when executed by one or more processors, implement the steps of the method described in any embodiment of this application.
[0130] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0131] In summary, this application facilitates one-click replacement of corpora in script files with corresponding index values, enabling convenient conversion of corpora between different language versions and improving the implementation efficiency of software engineering.
Claims
1. A corpus indexing and display method, characterized in that, include: Load the corpus, which is a corpus of the corresponding language version obtained to adapt to the default language set on the local development end. The corpus contains mapping relationship data between index values and corpus of the default language. Obtaining target words, where the target words are index values or corpora, includes: responding to a user search command and obtaining the text string entered by the user in the search box as the target word; or, responding to a mouse hover command and determining the corpora that the mouse is pointing to as the target word based on the mouse position. The process involves retrieving the corresponding corpus and / or index value for the target word from the corpus, constructing a result list, and displaying it on a graphical user interface. This includes: determining whether the target word is an index value or corpus; when the target word is an index value, performing rule matching in the corpus to retrieve corpus data from mapping relationships where the index value matches the target word, thus forming a first result list; when the target word is corpus data, performing semantic matching in the corpus to retrieve mapping relationship data where the corpus semantically matches the target word, thus forming a second result list; and displaying the result list via a floating layer, wherein the index value and / or corpus data in each mapping relationship are configured as optional, making them suitable for selection by an operation event. In response to a user's selection of any corpus or index value in the results list, the target word is replaced with the selected corpus and / or index value. After entering the statement selection mode in the editor used to edit script files, the system responds to the statement selection command, obtains the corpus of each statement selected by the user from the script file to form a corpus set, and performs deduplication on the corpus set. In response to a single corpus replacement instruction applied to the replacement control, the index value of each statement in the corpus is determined from the corpus, and the corpus in the script file is replaced with its corresponding index value with one click.
2. The corpus index display method according to claim 1, characterized in that, When the target word is a corpus, semantic matching is performed in the corpus, and the mapping relationship data between the corpus and the target word that forms a semantic match is retrieved to form a second result list, including: When the target word is a corpus, a feature extractor pre-trained to a convergent state is used to extract the text vector of the target word; The text similarity between the text vector of the target word and the text vector of each corpus in the mapping relationship data of the corpus is calculated. The text vector of each corpus in the corpus is obtained in advance by the feature extractor. The mapping relationship data with high text similarity are selected to form the second result list.
3. The corpus indexing and display method according to claim 1 or 2, characterized in that, Loading the corpus, including: In response to the server's corpus update notification, a corpus update request is sent to the server, which includes the language information corresponding to the corpus. Obtain the corpus corresponding to the language information that is pushed by the server in response to the corpus update request; The corpus is loaded by replacing the historical corpus with the corpus described above.
4. A corpus index display device, characterized in that, include: The corpus loading module is used to load a corpus, which is a corpus of the corresponding language version obtained to adapt to the default language set by the local development end. The corpus contains mapping relationship data between index values and corpus of the default language. The word extraction submodule is used to obtain target words, which are index values or corpora. This includes: responding to user search instructions and obtaining the text string entered by the user in the search box as the target word; or responding to mouse hover instructions and determining the corpora that the mouse is pointing to as the target word based on the mouse position. The retrieval submodule, used to retrieve the corresponding corpus and / or index value of the target word from the corpus and display the result list on the graphical user interface, includes: an object judgment unit, used to determine whether the target word is an index value or corpus; a first matching unit, used to perform rule matching in the corpus when the target word is an index value, and retrieve the corpus in the mapping relationship data where the index value is the same as the target word to form a first result list; a second matching unit, used to perform semantic matching in the corpus when the target word is corpus, and retrieve the mapping relationship data where the corpus and the target word are semantically matched to form a second result list; and a result display unit, used to display the result list through a floating layer, wherein the index value and / or corpus in each mapping relationship data is configured as an option, making it suitable for selection by performing an operation event; The single-item replacement submodule is used to respond to the operation event of the user selecting any corpus or index value in the result list, and replace the target word with the selected corpus and / or index value; The statement selection module is used to respond to the statement selection command after entering the statement selection mode in the editor used to edit the script file, obtain the corpus of each statement selected by the user from the script file to form a corpus set, and perform corpus deduplication through the corpus set; The one-click execution module is used to respond to a single corpus replacement instruction applied to the replacement control, determine the index value of each statement in the corpus from the corpus, and replace each corpus in the script file with its corresponding index value with one click.
5. The corpus index display device according to claim 4, characterized in that, The second matching unit includes: The vector generation subunit is used to extract the text vector of the target word by using a pre-trained feature extractor that has reached a convergent state when the target word is a corpus. The similarity calculation subunit is used to calculate the text similarity between the text vector of the target word and the text vector of the corpus in each mapping relationship data in the corpus. The text vector of each corpus in the corpus is obtained in advance by the feature extractor. The structure constructs sub-units, which are used to select the mapping relationship data with high text similarity to form a second result list.
6. The corpus indexing display device according to claim 4 or 5, characterized in that, The corpus loading module includes: The request update submodule is used to respond to the server's corpus update notification and send a corpus update request to the server, which includes the language information corresponding to the corpus. The update acquisition submodule is used to acquire the corpus corresponding to the language information pushed by the server in response to the corpus update request; The corpus upgrade submodule is used to replace the historical corpus with the new corpus to complete the corpus loading.
7. A computer device, comprising a central processing unit and a memory, characterized in that, The central processing unit is used to invoke and run a computer program stored in the memory to perform the steps of the method as described in any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that, It stores, in the form of computer-readable instructions, a computer program implemented according to any one of claims 1 to 3, which, when invoked by a computer, executes the steps included in the corresponding method.
9. A computer program product, characterized in that, Includes a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Text translation method and device, equipment, medium and product
CN114757211A