Multilingual term detection method and device, computer device and storage medium
By comparing and semantically analyzing the term structure objects in the project code files, the problems of missing terms and translation errors in the project code files were solved, and efficient and accurate multilingual term detection was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2026-04-07
AI Technical Summary
During the internationalization process of applications or projects, there may be missing or incomplete translations of terms in the project code files, resulting in low detection efficiency and poor accuracy.
By obtaining the term structure object from the project code file, comparing it with a pre-established standard term structure object, and combining semantic analysis, multilingual term detection results are generated, including structure detection and semantic detection, and missing information and semantic errors are automatically identified.
It improves the efficiency and accuracy of multilingual term detection, automatically detects missing information and semantic errors in project code files, and ensures the accuracy of multilingual support.
Smart Images

Figure CN115964051B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data detection, and in particular to a multilingual term detection method and device, computer equipment and a storage medium. BACKGROUND
[0002] With the internationalization of some application programs or projects, the application programs or projects need to access multiple languages to provide services for users of different languages. During the development of the application programs or projects, developers need to prepare multiple language expressions for the appearing terms. Due to the complexity of software functions, the large number of terms and languages, and other reasons, the engineering code files may have missing terms or missing translations. It is easy to make mistakes and slow to correct a large number of terms one by one by the developers, resulting in low software development efficiency. SUMMARY
[0003] The purpose of the embodiments of the present application is to provide a multilingual term detection method, device, computer equipment and storage medium to solve the problem of low efficiency and accuracy of multilingual term detection.
[0004] To solve the above technical problems, the embodiments of the present application provide a multilingual term detection method, which adopts the technical scheme as follows:
[0005] Obtain an engineering code file to be detected;
[0006] Scan the engineering code file to obtain a term structure object, the term structure object comprising term identifiers in the engineering code file and language identifiers under the term identifiers, the language identifiers comprising a main language identifier of a main language and a plurality of secondary language identifiers of secondary languages;
[0007] Obtain a standard term structure object established in advance;
[0008] Compare the term structure object with the standard term structure object to obtain a structured detection result;
[0009] For each term identifier, perform semantic analysis on the main language text corresponding to the main language identifier and the secondary language texts corresponding to the secondary language identifiers under the term identifier to obtain a term semantic detection result of the term identifier, and generate a semantic detection result according to the term semantic detection results of the term identifiers;
[0010] Generate a multilingual term detection result according to the structured detection result and the semantic detection result.
[0011] To solve the above technical problems, the embodiments of the present application also provide a multilingual term detection device, which adopts the technical scheme as follows:
[0012] a file acquisition module, configured to acquire an engineering code file to be detected;
[0013] a file scanning module, configured to scan the engineering code file to obtain a term structure object, the term structure object comprising term identifiers in the engineering code file and language identifiers under the term identifiers, the language identifiers comprising a main language identifier of a main language and language identifiers of multiple secondary languages;
[0014] a standard acquisition module, configured to acquire a standard term structure object established in advance;
[0015] an object comparison module, configured to compare the term structure object with the standard term structure object to obtain a structured detection result;
[0016] a semantic analysis module, configured to, for each term identifier, perform semantic analysis on main language text corresponding to the main language identifier and secondary language text corresponding to the secondary language identifiers under the term identifier to obtain a term semantic detection result of the term identifier, and generate a semantic detection result according to the term semantic detection results of the term identifiers;
[0017] a result generation module, configured to generate a multilingual term detection result according to the structured detection result and the semantic detection result.
[0018] To solve the above technical problems, the embodiment of the application further provides a computer device, which adopts the technical scheme as follows:
[0019] acquire an engineering code file to be detected;
[0020] scan the engineering code file to obtain a term structure object, the term structure object comprising term identifiers in the engineering code file and language identifiers under the term identifiers, the language identifiers comprising a main language identifier of a main language and language identifiers of multiple secondary languages;
[0021] acquire a standard term structure object established in advance;
[0022] compare the term structure object with the standard term structure object to obtain a structured detection result;
[0023] for each term identifier, perform semantic analysis on main language text corresponding to the main language identifier and secondary language text corresponding to the secondary language identifiers under the term identifier to obtain a term semantic detection result of the term identifier, and generate a semantic detection result according to the term semantic detection results of the term identifiers;
[0024] generate a multilingual term detection result according to the structured detection result and the semantic detection result.
[0025] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0026] Obtain the project code file to be tested;
[0027] The project code file is scanned to obtain a term structure object. The term structure object includes each term identifier in the project code file and each language identifier under each term identifier. The language identifier includes the main language identifier and multiple secondary language identifiers.
[0028] Retrieve a pre-built standard term structure object;
[0029] The term structure object is compared with the standard term structure object to obtain the structure detection result;
[0030] For each term identifier, semantic analysis is performed on the main language text corresponding to the main language identifier under the term identifier and the sub-language text corresponding to each sub-language identifier to obtain the term semantic detection result of the term identifier, and a semantic detection result is generated based on the term semantic detection result of each term identifier;
[0031] Multilingual term detection results are generated based on the structured detection results and the semantic detection results.
[0032] Compared with the prior art, the embodiments of this application have the following advantages: The engineering code file is scanned to obtain a term structure object, which records each term identifier and its corresponding language identifier in a fixed format. A pre-established standard term structure object is obtained as a benchmark, and compared with the term structure object to obtain a structured detection result. This result records which information is missing in the term structure object, and the comparison of the fixed-format data improves the comparison speed. For each term identifier, semantic analysis is performed on the main language text corresponding to the main language identifier and the corresponding sub-language texts of each sub-language identifier, based on the main language as the standard, to obtain the term semantic detection result. A semantic detection result is generated based on the term semantic detection result of each term identifier. This result records which texts in the term structure object may have semantic errors, thus achieving automatic detection of the engineering code file from different dimensions and improving the efficiency and accuracy of multilingual term detection. Attached Figure Description
[0033] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0035] Figure 2 This is a flowchart of an embodiment of the multilingual term detection method according to this application;
[0036] Figure 3 This is a schematic diagram of the structure of an embodiment of the multilingual term detection device according to this application;
[0037] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0038] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0039] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0040] 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 accompanying drawings.
[0041] like Figure 1As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0042] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0043] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0044] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0045] It should be noted that the multilingual term detection method provided in this application embodiment is generally executed by a terminal device, and correspondingly, the multilingual term detection device is generally installed in the terminal device.
[0046] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0047] Continue to refer to Figure 2 The diagram illustrates a flowchart of an embodiment of the multilingual term detection method according to this application. The multilingual term detection method includes the following steps:
[0048] Step S201: Obtain the project code file to be tested.
[0049] In this embodiment, the multilingual term detection method runs on an electronic device (e.g., Figure 1The terminal device shown can communicate with the server via wired or wireless connection. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, Wi-Fi connections, Bluetooth connections, Wi-Fi connections, Zigbee connections, UWB (ultra-Width band) connections, and other currently known or future wireless connection methods.
[0050] Specifically, the project code file to be tested is obtained. The project code file can be the code file of an application or project, containing all the information of the application or project.
[0051] Step S202: Scan the project code file to obtain the term structure object. The term structure object includes the term identifiers in the project code file and the language identifiers under each term identifier. The language identifiers include the main language identifier and multiple secondary language identifiers.
[0052] Specifically, an application or project can contain multiple terms; for example, "virtual machine" could be a term. A term identifier uniquely identifies a term, and a term can be represented in multiple languages, such as Chinese, English, and Japanese. Each term identifier has multiple language identifiers, representing the term's content in the language corresponding to each identifier. Among these languages, one will be the primary language, while the others will be secondary languages; the primary language identifier is the primary language identifier, and the secondary language identifiers are secondary language identifiers.
[0053] Each term and its corresponding term identifier, as well as the language identifiers under each term identifier, can be recorded in the project code file. Scanning the project code file can obtain the above information, and the scanned information can be summarized according to a preset format to obtain the term structure object.
[0054] Step S203: Obtain the pre-established standard term structure object.
[0055] Specifically, the standard term structure object is obtained. The standard term structure object can be a pre-established term structure object, which can be automatically generated based on the development specification document of the application software or project. The development specification document is a detailed description document of the application software or project during the early stage of project initiation, which contains various standards and specifications of the application software or project. The standard term structure object can also be pre-written and proofread by the developers.
[0056] Step S204: Compare the term structure object with the standard term structure object to obtain the structure detection result.
[0057] Specifically, the term structure object is compared with a standard term structure object. Since the data formats of the two objects are identical, the comparison can be completed quickly. This comparison primarily detects whether there is any missing information in the term structure object. After the comparison, a structured detection result is obtained, which records which information is missing from the term structure object.
[0058] Step S205: For each term identifier, perform semantic analysis on the main language text corresponding to the main language identifier and the sub-language text corresponding to each sub-language identifier to obtain the term semantic detection result of the term identifier, and generate semantic detection result based on the term semantic detection result of each term identifier.
[0059] Specifically, for each term identifier, there can be main language text corresponding to the main language identifier, and sub-language text corresponding to each sub-language identifier. Semantic analysis can be performed on the main language text and sub-language text to detect semantic errors. During semantic analysis, the main language text corresponding to the main language can be used as a reference standard. The main language can be determined by the developers; typically, their native language is used, such as Chinese, because developers are most familiar with their native language, and writing term text based on their native language ensures the most accuracy and completeness.
[0060] After semantic analysis is completed, semantic detection results for each term identifier are generated. These results indicate which language identifiers under each term identifier may contain semantic errors. The collection of semantic detection results for each term identifier constitutes the semantic detection result.
[0061] Step S206: Generate multilingual word detection results based on the structured detection results and semantic detection results.
[0062] Specifically, the structured detection results record which information is missing in the term structure object, and the semantic detection results record which text in the term structure object may have semantic errors. By merging the structured detection results and the semantic detection results, multilingual term detection results for the project code file can be generated, thus completing the automated detection of the project code file.
[0063] The multilingual term detection results can also include the name of the code repository where the project code file is located, the editors and developers of the abnormal terms, the submission time of the abnormal terms, and their specific text content.
[0064] The results of multilingual term detection can be stored in a local temporary file and pushed to the appropriate recipients via webhook, such as developers or a group chat, to remind developers to check the results and fix the terms.
[0065] When pushing notifications, you can selectively reduce the number of detected anomalies. You can define a variable `overviewCount` to determine the number of content items to push. For example, if you define `overviewCount = 5`, when the number of anomaly content items is greater than 5, only the first five items will be selected for push notification. At the same time, the local paths where other results are stored will be attached to the recipient for easy viewing. Push messages can be pushed in the form of a command-down for easy reading.
[0066] In this embodiment, the engineering code file is scanned to obtain a term structure object. The term structure object records each term identifier and its corresponding language identifier in a fixed format. A pre-established standard term structure object is obtained as a benchmark and compared with the term structure object to obtain a structured detection result. This result records which information is missing in the term structure object. The comparison of fixed-format data can improve the comparison speed. For each term identifier, semantic analysis is performed on the main language text corresponding to the main language identifier and the corresponding sub-language texts of each sub-language identifier, based on the main language as the standard, to obtain the term semantic detection result. A semantic detection result is generated based on the term semantic detection result of each term identifier. This result can record which texts in the term structure object may have semantic errors, thereby achieving automatic detection of the engineering code file from different dimensions and improving the efficiency and accuracy of multilingual term detection.
[0067] Furthermore, step S202 above may include: recursively scanning the project code file to obtain each term identifier and each language identifier under each term identifier in the project code file, wherein the language identifier also carries an existence declaration identifier, which is used to mark whether the language text corresponding to the language identifier exists; and generating a JSON format term structure object based on each term identifier and each language identifier under each term identifier.
[0068] Specifically, the project code file is recursively scanned to obtain the term identifiers and language identifiers under each term identifier. Each language identifier also carries an existence declaration identifier, which indicates whether the corresponding language text exists. In the project code file, the existence of a language identifier under a term identifier does not necessarily mean there is corresponding text; the developers may not have translated the term yet. In this case, the developers can add an existence declaration identifier. Typically, when the text corresponding to a language identifier exists, the existence declaration identifier is empty. When the term has not been translated, a preset existence declaration identifier can be entered; this can be a pre-defined string.
[0069] Based on each term identifier and the language identifiers under each term identifier, a JSON-formatted term structure object is generated. JSON (JavaScript Object Notation) is a lightweight data-interchange format. It uses a text format that is completely independent of programming languages to store and represent data. JSON has a concise and clear hierarchical structure, making it an ideal data exchange language. It is easy to read and write, easy for machines to parse and generate, and effectively improves network transmission efficiency.
[0070] It should be noted that when developers write project code files, they also add entry identifiers for those entries when creating them; and when developers write text representations in a language under an entry, they add language identifiers for that language. The added entry identifiers and language identifiers can be added automatically by the system or manually by the developers.
[0071] In one embodiment, the folder path sourceDir containing the project code files is located in the code repository, such as " / packages / lang / local / ". The sourceDir is recursively scanned and traversed. If its subset is a folder, the recursion continues until all filenames are obtained. Then, sourceDir is dynamically imported to obtain all terms under different languages. That is, after obtaining all file paths, the file content objects are imported one by one to obtain the content of all terms.
[0072] This application also supports not performing whitelisting on specific folders. An array ignorePathPrefix can be defined to store file paths that do not need to be scanned (only partial path prefixes are needed). Then, by performing secondary filtering on sourceDir, folders that do not need to be scanned can be filtered out, thus achieving whitelisting.
[0073] In this embodiment, the project code file is recursively scanned to fully obtain the identifiers of each term in the project code file and the language identifiers under each term identifier; a JSON-formatted term structure object is generated based on the information obtained from the scan, which is beneficial for computer parsing and improves the speed of subsequent comparison.
[0074] Furthermore, step S204 may include: comparing the term structure object with a standard term structure object to detect missing language identifiers in the term structure object; determining the language identifiers with missing translations in the term structure object based on the existence declaration identifiers in the term structure object; and generating a structured detection result based on the missing language identifiers and the language identifiers with missing translations.
[0075] Specifically, the standard term structure object contains the most complete structured information. By comparing the term structure object with the standard term structure object, missing language identifiers can be detected. It can be understood that these missing language identifiers are related to the term identifiers, meaning that a certain term lacks a text representation in a specific language. If a term structure object is missing a term identifier, then that term identifier and all its subordinate language identifiers are marked as missing.
[0076] The existence declaration identifier in the term structure object is read to determine the language identifiers of missing translations in the term structure object; based on the detected missing language identifiers and the language identifiers of missing translations, a structured detection result is generated.
[0077] In this embodiment, the term structure object is compared with the standard term structure object to detect missing language identifiers in the term structure object; based on the existence declaration identifier, the language identifiers with missing translations in the term structure object are determined, thereby comprehensively and accurately detecting the missing information in the project code file.
[0078] Furthermore, the steps described above for performing semantic analysis on the main language text corresponding to the main language identifier under the term identifier and the sub-language text corresponding to each sub-language identifier to obtain the term semantic detection result of the term identifier may include: translating the sub-language text corresponding to each sub-language identifier under the term identifier according to the main language to obtain translated text; calculating the text similarity between each translated text and the main language text corresponding to the main language identifier under the term identifier; and generating the term semantic detection result of the term identifier based on the obtained text similarity.
[0079] Specifically, this application can also translate the text under the term identifier. The translation can be achieved through a translation tool developed by the developer or by calling the interface of an existing translation tool.
[0080] As discussed earlier, the main language text is usually the most complete and accurate. Therefore, the main language text is used as the reference standard in semantic analysis.
[0081] Based on the primary language, the text corresponding to each secondary language identifier under the term identifier is translated to obtain the translated text. For example, if the primary language is Chinese and the secondary languages include English and Japanese, then the secondary language texts corresponding to English and Japanese under the term identifier are translated into Chinese to obtain the translated text.
[0082] Calculate the text similarity between each translated text and the corresponding text in the main language under each term identifier. For example, the main language text and the translated text can be converted into sentence vectors, and the cosine similarity between the sentence vectors can be used as the text similarity.
[0083] The magnitude of text similarity can reflect the semantic closeness between the translated text and the main language text, thereby detecting whether there are semantic errors in the corresponding sub-language text (for example, the developer placed the English representation of term B below term A), thus obtaining the semantic detection results of the term identifier.
[0084] Furthermore, the steps for generating term identification results based on the obtained text similarity may include: obtaining a preset similarity threshold; when there is text similarity less than the similarity threshold, marking the sub-language text corresponding to the text similarity as semantically abnormal text; when all text similarities are less than the similarity threshold, marking the main language text as semantically abnormal text; and generating term identification results based on the obtained semantically abnormal text.
[0085] Specifically, a preset similarity threshold is obtained. When there is a text similarity lower than the similarity threshold, the sub-language text corresponding to that text similarity is semantically significantly different from the main language text and may contain errors. The sub-language text can be marked as semantically abnormal text.
[0086] When the similarity scores of all texts are below the similarity threshold, there are significant semantic differences between the sub-language texts and the main language text. In this case, the main language text may contain errors, such as not matching the term. The main language text can be marked as semantically anomalous text. Based on the detected semantically anomalous text, semantic detection results with term identifiers are generated.
[0087] In one embodiment, a quantity threshold can be preset. If the number of sub-language texts with text similarity less than the similarity threshold is less than the quantity threshold, the sub-language text is considered to have a higher probability of error, and the corresponding sub-language text is marked as semantically abnormal text. If the number of sub-language texts with text similarity less than the similarity threshold is greater than or equal to the quantity threshold, the main language text is considered to have a higher probability of error, and the main language text is marked as semantically abnormal text. Understandably, in this case, both the main language text and each sub-language text can be marked as semantically abnormal text.
[0088] In one embodiment, it can be determined whether the main language text matches the term name. For example, the semantic similarity between the two can be calculated, or the main language text and the term name can be input into a trained neural network to determine whether they match semantically. If the main language text and the term name do not match, the main language text / main language text and each sub-language text are marked as semantically anomalous text.
[0089] In this embodiment, a preset similarity threshold is obtained, and based on the number of sub-language texts that are less than the similarity threshold, the sub-language texts or the main language texts are marked as semantically abnormal texts, thereby achieving accurate semantic detection.
[0090] In this embodiment, the translated text is obtained by translating the sub-language texts corresponding to each sub-language identifier under the main language identifier; the text similarity between each translated text and the main language text corresponding to the main language identifier under the main language identifier is calculated, thereby determining whether there are semantic errors in the sub-language texts and realizing semantic detection of the entries.
[0091] Furthermore, after step S206 above, the method may further include: when it is determined from the multilingual term detection results that there is a main language anomaly in the project code file, sending a main language repair request to the target terminal, wherein the main language anomaly includes the absence of the main language identifier, the absence of translation, and semantic anomalies; and when the main language repair information returned by the target terminal is received, repairing the main language anomaly in the project code file according to the main language repair information.
[0092] Specifically, when the multilingual term detection results indicate that the project code file has a main language anomaly (including missing main language identifiers, missing translations, and semantic anomalies, the meanings of which have been described above), a main language repair request is sent to the target terminal. The target terminal can be a terminal logged into by a preset account, which can be the account of the relevant developer. It is understandable that, because terms have contextual meaning, their connotations are difficult to generate automatically; developers need to supplement and modify the content of the abnormal main language to obtain the main language repair information. After receiving the main language repair information returned by the developer through the target terminal, the terminal device repairs the main language anomaly in the project code file according to the main language repair information. This includes compensating for missing main language identifiers (i.e., missing main language text corresponding to the main language identifier); compensating for missing translations and modifying the corresponding existence declaration identifier; replacing the main text of the semantically abnormal text with the corresponding main language text in the main language repair information; and continuing to repair the sub-language text under the same term identifier, thereby improving the accuracy of the project code file.
[0093] In this embodiment, when it is determined that there is a main language anomaly in the project code file based on the multilingual term detection results, since the term has contextual significance, it is necessary to send a main language repair request to the target terminal. The developers write the main language repair information and repair the main language anomaly in the project code file based on the main language repair information, thereby improving the accuracy of the project code file and repairing the missing or erroneous information.
[0094] Furthermore, after step S206 above, the method may include: when it is determined from the multilingual term detection results that there is a sublingual anomaly in the project code file, obtaining the main language text corresponding to the sublingual identifier of the anomaly; translating the main language text according to the sublingual identifier to obtain the translated text; and repairing the sublingual anomaly in the project code file according to the translated text.
[0095] Specifically, when the multilingual term detection results indicate that the project code file has sublingual anomalies (including missing sublingual identifiers, missing translations, and semantic anomalies, the meanings of which have been described above), the main language text corresponding to the abnormal sublingual identifier is obtained, that is, the main language text under the same term identifier is obtained.
[0096] Then, based on the sublanguage corresponding to the sublanguage identifier, the main language text is translated to obtain the translated text. For example, when an anomaly occurs in the sublanguage English under a certain term, the text of the main language Chinese under that term is obtained and translated into English. Based on the translated text, the sublanguage anomalies in the project code file are repaired, compensating for the missing sublanguage identifier, i.e., the missing sublanguage text corresponding to the sublanguage identifier; compensating for translation deficiencies and modifying the corresponding existence declaration identifier; and replacing the original sublanguage text with the translated text.
[0097] It is understandable that if there is a main language anomaly, after the main language anomaly in the project code file is repaired based on the main language repair information, the corresponding sub-language under the same term can be automatically repaired to ensure the accuracy of the sub-language text.
[0098] In this embodiment, when it is determined from the multilingual term detection results that the project code file has a secondary language anomaly while the primary language is normal, the secondary language text can be automatically repaired according to the corresponding primary language text, thereby improving the accuracy of the project code file and repairing the missing or erroneous information.
[0099] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0100] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0101] Further reference Figure 3 As a response to the above Figure 2 The implementation of the method shown in this application provides an embodiment of a multilingual term detection device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0102] like Figure 3 As shown, the multilingual term detection device 300 described in this embodiment includes: a file acquisition module 301, a file scanning module 302, a standard acquisition module 303, an object comparison module 304, a semantic analysis module 305, and a result generation module 306, wherein:
[0103] The file acquisition module 301 is used to acquire the project code file to be tested.
[0104] The file scanning module 302 is used to scan the project code file to obtain the term structure object. The term structure object includes the term identifiers in the project code file and the language identifiers under each term identifier. The language identifiers include the main language identifier and multiple secondary language identifiers.
[0105] The standard acquisition module 303 is used to acquire a pre-established standard term structure object.
[0106] The object comparison module 304 is used to compare the term structure object with the standard term structure object to obtain the structure detection result.
[0107] The semantic analysis module 305 is used to perform semantic analysis on the main language text corresponding to the main language identifier and the sub-language text corresponding to each sub-language identifier for each term identifier, to obtain the term semantic detection result of the term identifier, and to generate semantic detection result based on the term semantic detection result of each term identifier.
[0108] The result generation module 306 is used to generate multilingual term detection results based on the structured detection results and semantic detection results.
[0109] In this embodiment, the engineering code file is scanned to obtain a term structure object. The term structure object records each term identifier and its corresponding language identifier in a fixed format. A pre-established standard term structure object is obtained as a benchmark and compared with the term structure object to obtain a structured detection result. This result records which information is missing in the term structure object. The comparison of fixed-format data can improve the comparison speed. For each term identifier, semantic analysis is performed on the main language text corresponding to the main language identifier and the corresponding sub-language texts of each sub-language identifier, based on the main language as the standard, to obtain the term semantic detection result. A semantic detection result is generated based on the term semantic detection result of each term identifier. This result can record which texts in the term structure object may have semantic errors, thereby achieving automatic detection of the engineering code file from different dimensions and improving the efficiency and accuracy of multilingual term detection.
[0110] In some optional implementations of this embodiment, the file scanning module 302 may include: a file scanning submodule and an object generation submodule, wherein:
[0111] The file scanning submodule is used to recursively scan the project code file to obtain the term identifiers and language identifiers under each term identifier. The language identifiers also have existence declaration identifiers, which are used to indicate whether the language text corresponding to the language identifier exists.
[0112] The object generation submodule is used to generate JSON-formatted term structure objects based on each term identifier and the language identifiers under each term identifier.
[0113] In this embodiment, the project code file is recursively scanned to fully obtain the identifiers of each term in the project code file and the language identifiers under each term identifier; a JSON-formatted term structure object is generated based on the information obtained from the scan, which is beneficial for computer parsing and improves the speed of subsequent comparison.
[0114] In some optional implementations of this embodiment, the object comparison module 304 may include: a missing detection submodule, a translation determination submodule, and a result generation submodule, wherein:
[0115] The missing word detection submodule is used to compare the word structure object with the standard word structure object to detect missing language identifiers in the word structure object.
[0116] The translation determination submodule is used to determine the language identifiers that are missing in the translation of a term structure object based on the existence declaration identifiers in the term structure object.
[0117] The results generation submodule is used to generate structured detection results based on the missing language identifiers and the translation of the missing language identifiers.
[0118] In this embodiment, the term structure object is compared with the standard term structure object to detect missing language identifiers in the term structure object; based on the existence declaration identifier, the language identifiers with missing translations in the term structure object are determined, thereby comprehensively and accurately detecting the missing information in the project code file.
[0119] In some optional implementations of this embodiment, the semantic analysis module 305 may include: a text translation submodule, a similarity calculation submodule, and a semantic detection submodule, wherein:
[0120] The text translation submodule is used to translate the text corresponding to each sub-language identifier under the main language identifier, and obtain the translated text.
[0121] The similarity calculation submodule is used to calculate the text similarity between each translated text and the text corresponding to the main language identifier under the term identifier.
[0122] The semantic detection submodule is used to generate semantic detection results for word tags based on the obtained text similarity.
[0123] In this embodiment, the translated text is obtained by translating the sub-language texts corresponding to each sub-language identifier under the main language identifier; the text similarity between each translated text and the main language text corresponding to the main language identifier under the main language identifier is calculated, thereby determining whether there are semantic errors in the sub-language texts and realizing semantic detection of the entries.
[0124] In some optional implementations of this embodiment, the semantic detection submodule may include: a threshold acquisition unit, a first labeling unit, a second labeling unit, and a result generation unit, wherein:
[0125] The threshold acquisition unit is used to acquire a preset similarity threshold.
[0126] The first labeling unit is used to label the sublingual text corresponding to the text similarity as semantically abnormal text when there is a text similarity less than the similarity threshold.
[0127] The second labeling unit is used to label the main language text as semantically abnormal text when the similarity of each text is less than the similarity threshold.
[0128] The result generation unit is used to generate semantic detection results of the term identifier based on the obtained semantically abnormal text.
[0129] In this embodiment, a preset similarity threshold is obtained, and based on the number of sub-language texts that are less than the similarity threshold, the sub-language texts or the main language texts are marked as semantically abnormal texts, thereby achieving accurate semantic detection.
[0130] In some optional implementations of this embodiment, the multilingual term detection device 300 may include: a request sending module and a main language repair module, wherein:
[0131] The request sending module is used to send a main language repair request to the target terminal when the main language anomaly is determined to exist in the project code file based on the multilingual term detection results. The main language anomaly includes missing main language identifiers, missing translations, and semantic anomalies.
[0132] The main language repair module is used to repair main language anomalies in the project code file based on the main language repair information returned by the target terminal.
[0133] In this embodiment, when it is determined that there is a main language anomaly in the project code file based on the multilingual term detection results, since the term has contextual significance, it is necessary to send a main language repair request to the target terminal. The developers write the main language repair information and repair the main language anomaly in the project code file based on the main language repair information, thereby improving the accuracy of the project code file and repairing the missing or erroneous information.
[0134] In some alternative implementations of this embodiment, the multilingual term detection device 300 may further include: a text acquisition module, a text translation module, and a sublingual repair module, wherein:
[0135] The text acquisition module is used to acquire the main language text corresponding to the main language of the abnormal sub-language identifier when the sub-language anomaly is determined to exist in the project code file based on the multilingual term detection results.
[0136] The text translation module is used to translate the main language text into translated text based on the sub-language identifier.
[0137] The sublanguage repair module is used to repair sublanguage anomalies in the project code files based on the translated text.
[0138] In this embodiment, when it is determined from the multilingual term detection results that the project code file has a secondary language anomaly while the primary language is normal, the secondary language text can be automatically repaired according to the corresponding primary language text, thereby improving the accuracy of the project code file and repairing the missing or erroneous information.
[0139] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 4 ,Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0140] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), digital digital processors (DSPs), embedded devices, etc.
[0141] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0142] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for multilingual word detection methods. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.
[0143] In some embodiments, the processor 42 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute computer-readable instructions for the multilingual term detection method.
[0144] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.
[0145] The computer device provided in this embodiment can execute the above-described multilingual term detection method. The multilingual term detection method here can be any of the multilingual term detection methods described in the various embodiments above.
[0146] In this embodiment, the engineering code file is scanned to obtain a term structure object. The term structure object records each term identifier and its corresponding language identifier in a fixed format. A pre-established standard term structure object is obtained as a benchmark and compared with the term structure object to obtain a structured detection result. This result records which information is missing in the term structure object. The comparison of fixed-format data can improve the comparison speed. For each term identifier, semantic analysis is performed on the main language text corresponding to the main language identifier and the corresponding sub-language texts of each sub-language identifier, based on the main language as the standard, to obtain the term semantic detection result. A semantic detection result is generated based on the term semantic detection result of each term identifier. This result can record which texts in the term structure object may have semantic errors, thereby achieving automatic detection of the engineering code file from different dimensions and improving the efficiency and accuracy of multilingual term detection.
[0147] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the multilingual term detection method described above.
[0148] In this embodiment, the engineering code file is scanned to obtain a term structure object. The term structure object records each term identifier and its corresponding language identifier in a fixed format. A pre-established standard term structure object is obtained as a benchmark and compared with the term structure object to obtain a structured detection result. This result records which information is missing in the term structure object. The comparison of fixed-format data can improve the comparison speed. For each term identifier, semantic analysis is performed on the main language text corresponding to the main language identifier and the corresponding sub-language texts of each sub-language identifier, based on the main language as the standard, to obtain the term semantic detection result. A semantic detection result is generated based on the term semantic detection result of each term identifier. This result can record which texts in the term structure object may have semantic errors, thereby achieving automatic detection of the engineering code file from different dimensions and improving the efficiency and accuracy of multilingual term detection.
[0149] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application. The storage medium may be a non-volatile storage medium or a volatile storage medium.
[0150] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A method for detecting multilingual terms, characterized in that, Includes the following steps: Obtain the project code file to be tested; The project code file is scanned to obtain a term structure object. The term structure object includes each term identifier in the project code file and each language identifier under each term identifier. The language identifier includes the main language identifier and multiple secondary language identifiers. Retrieve a pre-built standard term structure object; The term structure object is compared with the standard term structure object to obtain the structure detection result; For each term identifier, semantic analysis is performed on the main language text corresponding to the main language identifier under the term identifier and the sub-language text corresponding to each sub-language identifier to obtain the term semantic detection result of the term identifier, and a semantic detection result is generated based on the term semantic detection result of each term identifier; Multilingual term detection results are generated based on the structured detection results and the semantic detection results.
2. The multilingual term detection method according to claim 1, characterized in that, The step of scanning the project code file to obtain the term structure object includes: The project code file is recursively scanned to obtain each term identifier in the project code file and each language identifier under each term identifier. The language identifier also carries an existence declaration identifier, which is used to mark whether the language text corresponding to the language identifier exists. Generate a JSON-formatted term structure object based on each term identifier and the language identifier under each term identifier.
3. The multilingual term detection method according to claim 2, characterized in that, The step of comparing the term structure object with the standard term structure object to obtain the structure detection result includes: The term structure object is compared with the standard term structure object to detect missing language identifiers in the term structure object; Based on the existence declaration identifier in the term structure object, determine the language identifiers of the missing translations in the term structure object; Based on the missing language identifier and the missing language identifier in the translation, a structured detection result is generated.
4. The multilingual term detection method according to claim 1, characterized in that, The step of performing semantic analysis on the main language text corresponding to the main language identifier under the term identifier and the sub-language text corresponding to each sub-language identifier to obtain the term semantic detection result of the term identifier includes: The sub-language texts corresponding to each sub-language identifier under the term identifier are translated according to the main language to obtain the translated text; Calculate the text similarity between each translated text and the text corresponding to the main language identifier under the term identifier; Based on the obtained text similarity, the semantic detection result of the term identifier is generated.
5. The multilingual term detection method according to claim 4, characterized in that, The step of generating the semantic detection result of the term identifier based on the obtained text similarity includes: Obtain the preset similarity threshold; When there is a text similarity lower than the aforementioned similarity threshold, the sublingual text corresponding to that text similarity is marked as semantically abnormal text. When the similarity of each text is less than the similarity threshold, the main language text is marked as semantically abnormal text; Based on the obtained semantically abnormal text, generate the semantic detection result of the term identifier.
6. The multilingual term detection method according to claim 1, characterized in that, After the step of generating multilingual term detection results based on the structured detection results and the semantic detection results, the method further includes: When it is determined that the project code file has a main language anomaly based on the multilingual term detection results, a main language repair request is sent to the target terminal. The main language anomaly includes missing main language identifiers, missing translations, and semantic anomalies. When the target terminal returns the main language repair information, the main language anomaly in the project code file is repaired according to the main language repair information.
7. The multilingual term detection method according to claim 6, characterized in that, After the step of generating multilingual term detection results based on the structured detection results and the semantic detection results, the method further includes: When it is determined from the multilingual term detection results that the project code file has a sublingual anomaly, the main language text corresponding to the sublingual identifier of the anomaly is obtained; The main language text is translated according to the sub-language corresponding to the sub-language identifier to obtain the translated text; Based on the translated text, the sublanguage anomalies in the project code file are repaired.
8. A multilingual term detection device, characterized in that, include: The file acquisition module is used to acquire the project code file to be tested; The file scanning module is used to scan the project code file to obtain a term structure object. The term structure object includes each term identifier in the project code file and each language identifier under each term identifier. The language identifier includes the main language identifier and multiple secondary language identifiers. The standard acquisition module is used to obtain pre-built standard term structure objects; The object comparison module is used to compare the term structure object with the standard term structure object to obtain the structured detection result; The semantic analysis module is used to perform semantic analysis on the main language text corresponding to the main language identifier and the sub-language text corresponding to each sub-language identifier for each term identifier, to obtain the term semantic detection result of the term identifier, and to generate semantic detection result based on the term semantic detection result of each term identifier; The result generation module is used to generate multilingual term detection results based on the structured detection results and the semantic detection results.
9. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the processor, when executing the computer-readable instructions, implements the steps of the multilingual term detection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement step 0 of the multilingual term detection method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Knowledge-driven English and Chinese word semantic similarity automatic detection method
CN110263331A
Power transformation research specification entry analysis method and system based on natural language processing
CN112241630A