Regional information identification method, device, electronic device and storage medium
Through semantic recognition and coding processing, combined with deep semantics and shallow features, the matching degree of regional words and text is calculated, which solves the accuracy problem of identifying local regional information under multiple regional words and achieves more accurate regional information identification.
Patent Information
- Application Number
- CN202210951264.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2042-08-09
AI Technical Summary
It is difficult for the existing technology to accurately identify the actual regional information of the text when multiple regional words are used, resulting in inaccurate content recommendations and search results.
By obtaining the regional words in the text to be recognized, semantic recognition and encoding processing are performed, and deep semantic features and shallow features are combined to calculate the matching degree between the regional words and the text to determine the regional information.
The accuracy and precision of regional information recognition are improved, and the regional information of the text can be accurately determined in the case of multiple regional words.
Smart Images

Figure CN115292620B
Abstract
Description
Technical Field
[0001] The present application relates to the field of text processing technology, and in particular to a method, device, electronic device and storage medium for identifying regional information. Background Art
[0002] With the rapid development of the Internet, people have various ways to obtain content, such as actively searching for relevant content or having the system automatically recommend content to users. When users search for content related to a region or make recommendations based on a region, they need to accurately identify the region information of the content.
[0003] If there is only one regional word in the regional content, the regional word can usually be directly used as the regional information of the content. However, if there are multiple regional words in the content, it is difficult to accurately determine the regional information that the content actually points to. Summary of the invention
[0004] The embodiments of the present application provide a method, device, electronic device and storage medium for identifying regional information, which can accurately determine the regional information in a text to be identified.
[0005] The present application provides a method for identifying regional information, including:
[0006] The present application also provides a device for identifying regional information, including:
[0007] An acquisition module, used for acquiring the text to be recognized and the regional words in the text to be recognized;
[0008] A semantic recognition module, used for performing semantic recognition on the fused data obtained based on the regional word and the text to be recognized, and obtaining a first feature vector corresponding to the regional word;
[0009] An encoding module, used for encoding the associated data between the regional word and the text to be recognized to obtain a second feature vector corresponding to the regional word;
[0010] A calculation module, used for calculating the matching degree between the text to be recognized and the regional word based on the first feature vector and the second feature vector corresponding to the regional word;
[0011] A determination module is used to determine the regional information of the text to be recognized from the regional words according to the matching degree of the regional words.
[0012] In some embodiments, the computing module further comprises:
[0013] A fusion unit, used for fusing the first feature vector and the second feature vector to obtain a target feature vector;
[0014] A normalization unit is used to perform normalization processing based on the target feature vector to obtain a matching degree between the text to be recognized and the regional word.
[0015] In some embodiments, the fused data includes first fused data and second fused data, and the semantic recognition module further includes:
[0016] An information acquisition unit, used to acquire category information and publisher information of the text to be recognized;
[0017] A first fusion unit, configured to fill the category information and the regional words into a preset template to obtain the first fusion data;
[0018] A second fusion unit, configured to combine the text to be recognized, the category information, and the publisher information of the text to be recognized according to the preset template to obtain the second fused data;
[0019] A semantic recognition unit is used to perform semantic recognition on the fused data to obtain the first feature vector.
[0020] In some embodiments, the encoding module further includes:
[0021] An extraction unit, used for extracting the association data between the regional word and the text to be recognized from the text to be recognized according to a preset rule;
[0022] The encoding unit is used to encode the associated data to obtain the second feature vector.
[0023] In some embodiments, the region information identification device further includes a training module, and the training module is used to:
[0024] Acquire a first model and a first sample set, wherein the first sample set includes a specified sample to be identified and a marked regional word, wherein the marked regional word is the only regional word in the specified sample to be identified;
[0025] Predicting the regional words for the designated sample to be identified by using the first model to obtain the predicted regional words;
[0026] Using the predicted regional words and the marked regional words, adjusting the model parameters of the first model to obtain an adjusted first model;
[0027] constructing a second model using the adjusted first model;
[0028] The parameters of the second model are adjusted to obtain a matching degree calculation model, wherein the matching degree calculation model is used to calculate the matching degree between the regional words in the text to be recognized and the text to be recognized.
[0029] In some embodiments, the training module is further configured to:
[0030] Acquire a second sample set, wherein the second sample set includes sample fusion data corresponding to the sample regional words, sample association data corresponding to the sample regional words, and label values;
[0031] Based on the second model, the sample fusion data and the sample association data are fused to obtain a prediction value;
[0032] Based on the predicted value and the label value, the model parameters of the second model are adjusted to obtain the matching degree calculation model.
[0033] An embodiment of the present application also provides an electronic device, including a memory storing multiple instructions; the processor loads instructions from the memory to execute the steps in any one of the regional information identification methods provided in the embodiments of the present application.
[0034] An embodiment of the present application also provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the steps in any one of the regional information identification methods provided in the embodiments of the present application.
[0035] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps in any one of the regional information identification methods provided in the embodiment of the present application.
[0036] The embodiment of the present application can obtain the text to be recognized and the regional words in the text to be recognized; perform semantic recognition on the fused data obtained based on the regional words and the text to be recognized, and obtain the first feature vector corresponding to the regional words; perform encoding processing on the associated data between the regional words and the text to be recognized, and obtain the second feature vector corresponding to the regional words; calculate the matching degree between the text to be recognized and the regional words based on the first feature vector and the second feature vector corresponding to the regional words; finally, determine the regional information of the text to be recognized from the regional words according to the matching degree of the regional words. When calculating the matching degree, the semantic features of the regional words and the text to be recognized and the shallow features obtained based on simple encoding are integrated, so that the feature expressions of the regional words and the text to be recognized are more complete and accurate, so as to improve the calculation accuracy of the matching degree, so that the regional information of the text to be recognized can be accurately determined. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0038] Figure 1a It is a scene schematic diagram of the regional information identification method provided in an embodiment of the present application;
[0039] Figure 1b It is a flowchart of a method for identifying regional information provided in an embodiment of the present application;
[0040] Figure 1c It is a structural schematic diagram of the first model provided in the embodiment of the present application;
[0041] Figure 1d is a schematic diagram of the structure of the matching degree calculation model provided in the embodiment of the present application;
[0042] Figure 2 is a flowchart of a method for identifying regional information provided by another embodiment of the present application;
[0043] Figure 3 is a schematic diagram of the structure of a regional information identification device provided in an embodiment of the present application;
[0044] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0046] Embodiments of the present application provide a method, device, electronic device, and storage medium for identifying regional information.
[0047] The region information identification device may be integrated into an electronic device, which may be a terminal, a server, or the like. The terminal may be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, or a personal computer (PC); the server may be a single server or a server cluster consisting of multiple servers.
[0048] In some embodiments, the region information identification device may also be integrated into multiple electronic devices. For example, the region information identification device may be integrated into multiple servers, and the region information identification method of the present application may be implemented by multiple servers.
[0049] In some embodiments, the server may also be implemented in the form of a terminal.
[0050] For example, refer to Figure 1a , showing a schematic diagram of an application scenario of the regional information identification method provided in an embodiment of the present application.
[0051] like Figure 1a As shown in , the user terminal 101 and the server 102 are located in a wireless network or a wired network, and the user terminal 101 and the server 102 perform data exchange. The server 102 can be a separate server or a server cluster, a local server or a cloud server.
[0052] The server 102 can obtain data related to the user terminal 101 and the user, such as data actively input by the user, the user's current location information, etc., and can specifically acquire data according to actual needs.
[0053] For example, in a scenario of content recommendation based on region, the current location information of the user may be obtained with the user's permission, and the content matching the location information may be recommended to the user. The server 102 may treat each content to be recommended in the recommendation database as a text to be recognized, recognize the region information of the text to be recognized, and use the region information as a region tag for the content to be recommended. When recommending, the server 102 may obtain the current location information sent by the user terminal 101, determine the content to be recommended indicated by the region tag matching the location information, and send the content to be recommended to the user terminal 101.
[0054] For another example, in a scenario of performing a regional search, a search text containing a regional word input by a user may be obtained. The server 102 may treat each content in the database as a text to be recognized, recognize the regional information of the text to be recognized, and use the regional information as a regional tag of the content. When a user performs a regional search, the user terminal 101 may input a search text containing a regional word, and send the search text containing the regional word to the server 102. The server 102 uses the content indicated by the regional tag matching the regional word input by the user as the search result, and sends the search result to the user terminal 101.
[0055] Among them, when the server 102 performs regional information recognition, it can be to obtain the text to be recognized and the regional words in the text to be recognized; perform semantic recognition on the fusion data obtained based on the regional words and the text to be recognized, and obtain the first feature vector corresponding to the regional words; encode the associated data between the regional words and the text to be recognized, and obtain the second feature vector corresponding to the regional words; based on the first feature vector and the second feature vector corresponding to the regional words, calculate the matching degree between the text to be recognized and the regional words; according to the matching degree of the regional words, determine the regional information of the text to be recognized from the regional words.
[0056] It should be noted that in the specific implementation of the present application, the user-related data involved, such as user account information, user input data, user current location information, etc., when the embodiments of the present application apply these data to specific products or technologies, it is necessary to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions, which are explained in detail below.
[0057] Artificial Intelligence (AI) is a technology that uses digital computers to simulate human perception of the environment, acquire knowledge, and use knowledge. This technology can enable machines to have functions similar to human perception, reasoning, and decision-making. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technology mainly includes natural language processing technology and machine learning / deep learning.
[0058] Among them, natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0059] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
[0060] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, Internet of Vehicles, automatic driving, smart transportation, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0061] In this embodiment, a method for identifying regional information involving artificial intelligence is provided, such as Figure 1b As shown, the specific process of the regional information identification method can be as follows:
[0062] S110, obtaining a text to be recognized and a regional word in the text to be recognized.
[0063] The text to be recognized refers to the text information that needs to be regionally recognized. The text to be recognized can be in the form of articles, sentences, phrases, etc., and can include text information such as words, numbers, characters, symbols, etc. The text to be recognized can be a text in any language, such as Chinese, English, etc., or a text mixed in different languages, such as a text mixed in Chinese and English. The embodiment of the present application does not limit the form of the text to be recognized.
[0064] Regional words refer to words that represent geographical locations, such as XX province, XX city, XX county, XX district, the abbreviations of provincial administrative regions, the abbreviations of various places, etc. Regional words can be expressed in the form of single characters, words, etc.
[0065] The text to be recognized can be obtained in different ways. For example, with the permission or consent of the user, the text information input by the user through the terminal is used as the text to be recognized. For another example, with the permission or consent of the user, the content posted by the user on the Internet is used as the text to be recognized.
[0066] The method of obtaining the text to be recognized can be determined according to the specific application scenario. For example, in a search scenario, each content in the database used for search can be used as the text to be recognized. For another example, in a recommendation scenario, each content in the database used for recommendation can be used as the text to be recognized. For another example, the text entered by the user can be used as the text to be recognized. In some implementations, the content in the database may be multimedia content in various forms such as video, audio, image or dynamic image, and these contents can be converted into text to be recognized based on technologies such as image recognition or speech recognition.
[0067] After obtaining the text to be recognized, you can continue to obtain the regional words in the text to be recognized. When obtaining the regional words in the text to be recognized, you can determine the regionality of the text to be recognized; if the text to be recognized has regionality, extract the regional words from the text to be recognized; if the text to be recognized does not have regionality, directly output that the text to be recognized does not have regionality.
[0068] In some embodiments, when determining the regionality of the text to be recognized, it can be determined by a pre-trained regional discrimination model. For example, if the regional discrimination model can output two results of "yes" and "no" after training; if the text to be recognized is input into the regional discrimination model, and the result output by the regional discrimination model is "yes", it can be considered that the text to be recognized has regionality; if the text to be recognized is input into the regional discrimination model, and the result output by the regional discrimination model is "no", it can be considered that the text to be recognized does not have regionality.
[0069] If the text to be recognized is not regional, it means that the content described in the text to be recognized is not specific to a certain region, then the result that the text to be recognized is not regional is directly output, and the processing of the text to be recognized is terminated. If the text to be recognized is regional, it means that the text to be recognized includes at least one regional word, and then the regional word is continuously extracted from the text to be recognized.
[0070] There are many ways to extract regional words from the text to be recognized. As an implementation method, a regional dictionary may be pre-established, and the regional dictionary may include a plurality of preset regional words; the text to be recognized is matched with each preset regional word in the regional dictionary, and the successfully matched preset regional words are used as the regional words in the text to be recognized. For example, the regional dictionary includes A, B, C, and D, and the text to be recognized includes A and C, so the regional words of the text to be recognized can be determined to be A and C.
[0071] As an implementation method, the deep learning model may be trained in advance to obtain a regional word extraction model, and the regional word extraction model may be input into the text to be recognized to obtain the regional words in the text to be recognized.
[0072] As an implementation method, a named entity recognition (NER) tool, such as HanLP, CRF++, etc., may be used. Based on the named entity recognition tool, regional words may be directly extracted from the text to be recognized.
[0073] S120: Perform semantic recognition on fused data obtained based on the regional word and the text to be recognized to obtain a first feature vector corresponding to the regional word.
[0074] After obtaining the regional words in the text to be recognized, in order to accurately recognize the regional information of the text to be recognized, the semantic features of the fusion data of the regional words and the text to be recognized may be obtained.
[0075] In some implementations, the concatenated text of the regional word and the text to be recognized may be used as fused data, and then semantic recognition is performed on the fused data to obtain a first feature vector corresponding to the regional word.
[0076] In some embodiments, in order to improve the accuracy of semantic recognition, the fused data obtained based on the regional words and the text to be recognized may include first fused data and second fused data. This step may include: obtaining the category information and publisher information of the text to be recognized; filling the category information and the regional words into a preset template to obtain the first fused data; splicing the text to be recognized, the category information and the publisher information of the text to be recognized according to the preset template to obtain the second fused data; performing semantic recognition on the fused data to obtain the first feature vector.
[0077] The category information to which the text to be identified belongs refers to the category to which the text to be identified belongs obtained through a preset hierarchical classification system, such as society, entertainment, film and television, etc. The preset hierarchical classification system refers to a pre-set classification system, which may include multiple different levels, and the text to be identified corresponds to a category at each level. The publisher information of the text to be identified may refer to the relevant information of the user who published the text to be identified, such as the identifier of the user account, etc.
[0078] The preset template refers to a template preset for fusing the text to be recognized and the regional words, which may include a first sub-template and a second sub-template, wherein first fused data may be obtained based on the first sub-template, and second fused data may be obtained based on the second sub-template.
[0079] In order to enhance the expressiveness of the regional words, the category information and the regional words can be filled into the first sub-template to obtain the first fused data. In order to avoid the introduction of noise caused by the category information, the text to be identified, the category information and the publisher information of the text to be identified can be spliced according to the second sub-template to obtain the second fused data, which mainly contains the specific information of the text to be identified.
[0080] In some embodiments, before obtaining the second fusion data, the title in the text to be recognized and the body of the text to be recognized can be specifically distinguished. For example, if the text to be recognized has a title, the title and body of the text to be recognized can be distinguished to obtain the title of the text to be recognized and the body of the text to be recognized; if the text to be recognized does not have a title, all the contents of the text to be recognized can be directly used as the body.
[0081] For example, the first sub-template in the preset template is: [regional word] [category information] type article; the second sub-template in the preset template is: [category information] type article#[publisher information]: [title] [text].
[0082] The publisher information of the text to be identified is: Things in Place A; the title is: Late edition of Things in Place A, sent every day to keep you updated with the latest information; the text is: Starting from April 5, the license plate number restrictions in Place B will be adjusted soon; the category information is: Society.
[0083] If the regional word of the text to be identified is place A, according to the above content, the first fused data can be obtained as "social articles about place A"; the second fused data is "social articles#Baoding Things: The late edition of Things in Place A, sent every day, with fresh information not to be missed. Starting from April 5, the license plate number restriction in place B will be adjusted soon."
[0084] The preset template introduces the category information of the text to be recognized, and the first sub-template expands the regional word into a complete statement, which can enhance the expressive power of the regional word. In order to avoid the noise caused by the introduction of category information, category information is also added to the second sub-template.
[0085] Then the first fused data and the second fused data are taken together as fused data, and semantic recognition is performed on the fused data to obtain a first feature vector.
[0086] As an implementation method, the first feature vector may be obtained by using the BERT model. For example, the first fused data and the second fused data may be concatenated, and a separator may be inserted between the first fused data and the second fused data, and a start identifier may be inserted into the header of the entire fused data to obtain the input data of BERT. For example, the separator may be [SEP], the start identifier may be [CLS], and the input data of BERT may be: [CLS] first fused data [SEP] second fused data. After the input data is input into BERT, the output vector of BERT may be obtained, and the vector corresponding to the start identifier [CLS] may be used as the first feature vector.
[0087] The BERT model is used to perform semantic recognition on the fused data obtained according to the preset template, and the deep semantic features corresponding to the fused data are obtained.
[0088] S130 , encoding the association data between the regional word and the text to be recognized to obtain a second feature vector corresponding to the regional word.
[0089] Since deep models such as BERT have good generalization and focus on the deep semantic information of the input data, but lack memory, in order to avoid excessive focus on deep semantics that leads to inaccurate final matching calculations, the associated data between the regional words and the text to be recognized can be extracted and encoded to obtain a shallow feature expression, that is, the second feature vector.
[0090] When obtaining the second feature vector, the association data between the regional word and the text to be recognized may be extracted from the text to be recognized according to a preset rule; the association data is encoded to obtain the second feature vector.
[0091] The preset rules refer to the pre-set rules for extracting associated data. The associated data between the regional words and the text to be recognized may include data associated with the regional words, data associated with the text to be recognized, and associated data of the regional words in the text to be recognized.
[0092] The data associated with the geographical word may refer to the administrative unit to which the geographical word belongs, such as the province, city or district to which the geographical word belongs.
[0093] The data associated with the text to be recognized may include information related to the publisher of the text to be recognized and category information of the text to be recognized. The information related to the publisher may include whether the publisher is regional, the administrative division unit to which the regional information of the publisher belongs, etc. The category information of the text to be recognized may include the primary category, secondary category, tertiary category, etc. of the text to be recognized.
[0094] The associated data of the regional word in the text to be recognized may include the location and number of occurrences of the regional word. For example, the location of occurrence may be to determine whether the regional word appears in the identifier of the publisher's user account, whether it appears in the title of the text to be recognized, whether it appears in the body of the text to be recognized, and whether the regional word appears at the beginning, middle or end of the body.
[0095] After the associated data is obtained, the associated data is encoded to obtain a second feature vector. In order to make up for the weak expression of the associated data extracted based on the preset rule, the associated data can be encoded using a coding model.
[0096] For example, the encoding model can be a GBDT model, where the GBDT model is a gradient boosting decision tree model that can perform feature segmentation, feature combination, and feature selection on shallow features (associated data) based on rules or manual extraction, and obtain high-order feature attributes and nonlinear mapping. The depth of the decision tree in GBDT determines the cross-dimensionality of the associated data, and encoding the associated data based on the GBDT model can further enhance the expressiveness of the associated data.
[0097] Use the pre-trained GBDT model to perform feature segmentation, feature combination and feature selection on the associated data. The trained GBDT model can include multiple subtrees, obtain the leaf node results of the associated data falling on each subtree, that is, the leaf node number, and convert it into a multi-hot encoding format to obtain the final second feature vector. Encoding the associated data with the trained GBDT model can enhance the feature expression of extracting associated data based on preset rules.
[0098] S140: Calculate the matching degree between the text to be recognized and the regional word based on the first feature vector and the second feature vector corresponding to the regional word.
[0099] For each regional word, the first feature vector and the second feature vector corresponding to the regional word can be obtained. In order to calculate the matching degree between the regional word and the text to be recognized, the first feature vector and the second feature vector can be fused to obtain a target feature vector; normalization processing is performed based on the target feature vector to obtain the matching degree between the text to be recognized and the regional word.
[0100] Among them, the first feature vector is obtained based on the fused data, and the first fused data in the fused data contains regional words and category information, and the second fused data in the fused data contains basic information of the text to be recognized. Therefore, the first feature vector contains deep semantic features of regional words and text to be recognized. The second feature vector is obtained based on the associated data, which contains basic information of regional words and text to be recognized. The associated data is simply encoded to enhance the feature expression of the associated data. It can be seen that the second feature vector contains shallow features of regional words and text to be recognized.
[0101] When calculating the matching degree between the regional word and the text to be recognized, the first feature vector and the second feature vector may be fused to obtain a target feature vector.
[0102] In some implementations, the first feature vector and the second feature vector may be directly concatenated to obtain a target feature vector. For example, the first feature vector is 768-dimensional, the second feature vector is 5-dimensional, and the target feature vector obtained after concatenation is 773-dimensional.
[0103] In some implementations, the second feature vector may be input into a feedforward neural network (FFN) to obtain a third feature vector, and the first feature vector and the third feature vector may be concatenated to obtain a target feature vector. After the second feature vector is processed by the feedforward neural network, the feature dimension is improved, which can further enhance the expressiveness of shallow features.
[0104] After obtaining the target feature vector, the target feature vector may be normalized to obtain the matching degree between the text to be recognized and the regional word. For example, the target feature vector may be input into a softmax classifier, and binary classification may be performed to output the corresponding matching degree.
[0105] S150: Determine the regional information of the text to be recognized from the regional words according to the matching degree of the regional words.
[0106] After calculating the matching degree of the regional words, the regional information of the text to be recognized can be determined from the regional words. It can be understood that the number of regional words in the text to be recognized may be one or more. When determining the regional information of the text to be recognized based on the matching degree, the number of regional words in the text to be recognized can be obtained; if the number is not greater than the preset number, the regional information of the text to be recognized is determined based on the matching degree and the preset threshold; if the number is greater than the preset number, the regional word corresponding to the matching degree indicating the highest matching degree is used as the regional information corresponding to the text to be recognized.
[0107] As an implementation, when obtaining the number of regional words in the text to be recognized, the regional words may be directly counted to obtain the number of regional words. For example, if the regional words in the text to be recognized are A and C, the number of regional words may be considered to be 2.
[0108] As another implementation, when obtaining the number of regional words in the text to be recognized, the regional words in the text to be recognized may be first merged to obtain the merged regional words; then the number of the merged regional words is used as the number of regional words in the text to be recognized. For example, the regional words are A and C, where A is the full name of city A and C is the abbreviation of city A. It can be seen that A and C are actually different names of the same city, so A and C can be merged into a standard name, for example, merged into the full name of the city, and then A and C can be merged into A. Thus, it can be obtained that the number of regional words in the text to be recognized is 1.
[0109] Among them, the preset number can be a preset value. In the embodiment of the present application, the preset number can be set to 1.
[0110] If the number is not greater than 1, when determining the regional information of the text to be recognized based on the matching degree and the preset threshold, it can be determined whether the matching degree is greater than the preset threshold; if it is greater, the regional word is determined as the regional information of the text to be recognized; if it is not greater, the regional information of the text to be recognized is determined to be empty.
[0111] Among them, the preset threshold is an empirical value set in advance. For example, usually when the matching degree is greater than the preset threshold, it can be indicated that there is a certain correlation between the regional word and the text to be recognized. If the matching degree is less than the preset threshold, it indicates that the correlation between the regional word and the text to be recognized is low. In order to avoid incorrect recognition of regional information, the regional information is determined to be empty.
[0112] If the number is greater than 1, the regional word corresponding to the highest matching degree is directly used as the regional information corresponding to the text to be recognized. The matching degree is usually proportional to the matching degree it indicates. For example, the higher the matching degree value, the higher the matching degree between the regional word and the text to be recognized, and the greater the possibility that the regional word is the regional information of the text to be recognized; the lower the matching degree value, the lower the matching degree between the regional word and the text to be recognized, and the less likely the regional word is the regional information of the text to be recognized. In this way, the regional word with the highest matching degree can be determined as the regional information of the text to be recognized.
[0113] In some embodiments, in order to improve the efficiency of determining the regional information of the text to be recognized, after extracting the regional words from the text to be recognized, it is also possible to determine whether to determine the regional information based on the degree of match between the regional words and the text to be recognized based on the number of regional words in the text to be recognized, that is, to determine whether to execute the following steps S120 to S140 based on the number of regional words in the text to be recognized.
[0114] For example, if the number of regional words is 1, the regional words can be directly determined as the regional information of the text to be recognized. If the number of regional words is greater than 1, the matching degree between the regional words and the text to be recognized is calculated, and the regional word with the highest matching degree is determined as the regional information of the text to be recognized.
[0115] In some implementations, in order to ensure that the regional information is detailed and complete, after the regional information is obtained, the regional information can also be standardized so that the regional information is accurate to the deepest node of the province, city, and district. For example, if the regional information is District D, the city and provincial levels corresponding to District D can be completed. For another example, if the regional information is City C, the provincial level corresponding to City C can be completed.
[0116] In the above steps S120 to S140, in order to obtain the matching degree between the regional word and the text to be recognized through the matching degree calculation model, the training process of the matching degree calculation model will be described in detail below.
[0117] Since the matching calculation model needs to calculate the matching degree between the regional word and the text to be recognized, the training data needs to meet the following conditions when training the model: there are multiple regional words of the same level in the text to be recognized, and the manually annotated optimal regional word needs to appear in the regional words. The manually annotated optimal regional word is combined with the text to be recognized as a positive example used in training; other regional words of the same level in the text to be recognized are combined with the text to be recognized as negative examples used in training. However, this kind of training data is relatively small, and annotation is also more resource-intensive. In order to take into account both training costs and training effects, the example of this application obtains the final matching calculation model through secondary training.
[0118] The training process of the matching degree calculation model may include the following steps: obtaining a first model and a first sample set, wherein the first sample set includes a specified sample to be identified and annotated regional words, wherein the annotated regional words are the only regional words in the specified sample to be identified; predicting the regional words of the specified sample to be identified by using the first model to obtain predicted regional words; adjusting the model parameters of the first model using the predicted regional words and the annotated regional words to obtain an adjusted first model; constructing a second model using the adjusted first model; adjusting the parameters of the second model to obtain a matching degree calculation model, wherein the matching degree calculation model is used to calculate the matching degree of the first data and the second data.
[0119] The first model may be composed of a BERT model, a feedforward neural network, and a softmax classifier. For example, see Figure 1c , shows a schematic diagram of the structure of the first model. In order to enable the trained first model to recognize the regional words in the text to be recognized, a first sample set may be obtained.
[0120] The first sample set includes designated samples to be identified and marked regional words. The designated samples to be identified refer to texts to be identified that contain only one regional word. The marked regional word is the only regional word in the designated samples to be identified.
[0121] Based on the designated sample to be identified, it can refer to the splicing of the title and the body of the designated sample to be identified, or it can refer to the splicing of the title, the body, and the publisher information of the designated sample to be identified. The following takes the splicing of the title and the body of the designated sample to be identified as an example for explanation.
[0122] The marked regional word may be represented in the form of a one-hot encoding. For example, assuming there are 1,000 administrative units in total, the administrative unit corresponding to the marked regional word is represented as 1, and the remaining administrative units are represented as 0.
[0123] When training the first model, you can insert a start identifier [CLS] before the title in the specified sample to be identified, insert a separator [SEP] between the title and the text, and then input it into the BERT model, take the vector corresponding to the position of the start identifier [CLS] as the representation of the entire input after encoding, and then input the vector corresponding to the position of [CLS] into the feedforward neural network, and pass it through the softmax classifier to obtain the corresponding probabilities of 1,000 administrative divisions, and use the administrative division corresponding to the largest probability as the predicted regional word, where the predicted regional word is still expressed in the form of one-hot encoding. Then calculate the cross entropy loss based on the predicted regional word and the annotated regional word, and update the model parameters of the first model by gradient backpropagation until the predicted regional word and the annotated regional word of the first model are consistent, and the trained first model is obtained.
[0124] After training, the first model has the ability to predict the regional information of the text to be recognized that contains only one regional word, that is, it can predict the matching degree between the text to be recognized and each administrative division, and calculate the matching degree between the regional information of the text to be recognized and the administrative division as the maximum value. Pre-training helps the model achieve better results in matching degree calculation.
[0125] Then, a second model is constructed based on the first model, wherein the second model can be a combination of BERT and other models after the memory parameters of the first model are adjusted. The trained second model is the matching degree calculation model, which can be found in Figure 1d , which shows a structural diagram of the matching degree calculation model.
[0126] Among them, the BERT in the second model is the one in the trained first model, and the model parameters of the second model are adjusted to obtain the matching degree calculation model. For example, the second sample set may be obtained, and the second sample set includes sample fusion data corresponding to the sample regional words, sample association data corresponding to the sample regional words, and label values; based on the second model, the sample fusion data and the sample association data are fused to obtain a predicted value; based on the predicted value and the label value, the model parameters of the second model are adjusted to obtain the matching degree calculation model.
[0127] The second sample set refers to the sample data used to train the second model. The sample fusion data corresponding to the sample regional word refers to the fusion data obtained by fusing the sample regional word and the sample to be identified using a preset template. The sample association data corresponding to the sample regional word refers to the association data between the sample regional word and the sample to be identified extracted using a preset rule. The label value is used to indicate whether the sample regional word is the final regional information of the sample to be identified. If so, the label value is 1, otherwise the label value is 0.
[0128] When training the model, the sample fusion data can be input into the BERT model to obtain the predicted first feature vector. The sample association data is input into the GBDT model. After the sample association data is input into the GBDT model, the GBDT model can automatically classify the sample association data, find the subtree, and then obtain the leaf node number on each subtree, convert it into a multi-hot encoding format, and obtain the predicted second feature vector.
[0129] Then the predicted second feature vector and the predicted first feature vector are concatenated together to obtain the predicted target feature vector, and then the predicted target feature vector is input into the softmax classifier to control the final output of the predicted matching result of the sample regional word and the sample to be identified. If it matches, 1 is output, if it does not match, 0 is output, as well as the probability value corresponding to the sample regional word.
[0130] Then, a cross entropy loss function is constructed based on the predicted matching results and label values, and gradient backpropagation is performed to update the model parameters of the second model until the predicted matching results and label values are consistent, thus obtaining a matching degree calculation model.
[0131] As an implementation method, when training the second model, the GBDT model can be trained only with sample-related data in advance, so that the GBDT model can better encode the related data. Then the trained GBDT model is placed in the second model, and the entire second model is trained using the sample-related data and the sample fusion data to obtain the final matching calculation model. As another implementation method, the entire second model can also be trained directly. It can be set according to actual needs and is not specifically limited here. In the process of training the matching calculation model, pre-training and construction of sample fusion data are used for prompt learning. In the training, the easily accessible text data containing only one regional word is fully utilized to obtain better training results.
[0132] The regional information identification scheme provided in the embodiment of the present application can be applied in various regional information identification scenarios. For example, taking the regional information identification of an article as an example, no matter how many regional words exist in the article, the regional information actually indicated by the article can be accurately predicted. The scheme provided in the embodiment of the present application can combine deep semantic features and shallow features extracted based on rules to accurately predict the regional information of the article.
[0133] The method provided by the embodiment of the present application can obtain the text to be recognized and the regional words in the text to be recognized; perform semantic recognition on the fused data obtained based on the regional words and the text to be recognized to obtain a first feature vector; encode the associated data between the regional words and the text to be recognized to obtain a second feature vector; then fuse the first feature vector and the second feature vector to calculate the matching degree between the text to be recognized and the regional words, and finally determine the regional information of the text to be recognized based on the matching degree. When calculating the matching degree between the regional words and the text to be recognized, not only the deep semantic features are used, but also the shallow features obtained by directly encoding the associated data are integrated to improve the accuracy of the matching degree calculation and further improve the accuracy of regional information recognition.
[0134] The method described in the above embodiment will be further described in detail below.
[0135] In this embodiment, the method of the embodiment of the present application is described in detail by taking the text to be recognized as an article as an example.
[0136] like Figure 2 As shown, a specific process of a regional information identification method is as follows:
[0137] S210: Perform preset processing on the article to obtain the category information, title, text, and publisher information of the article.
[0138] An article is usually a text with a title and a body. When identifying the regional information of an article, the article can be pre-processed first, for example, the title and body of the article are distinguished, and the publisher information and category information of the article are obtained.
[0139] S220, judging whether the article is regional based on the title and the text; if so, executing S230; if not, executing S250.
[0140] When determining whether an article is regional, a pre-trained regional discrimination model may be obtained, the title and body of the article may be concatenated and input into the regional discrimination model, and the output of the regional discrimination model may be obtained to determine whether the article is regional.
[0141] If the article is regional, it indicates that the article has regional information, so S230 can be continued to perform subsequent steps.
[0142] If the article is not regional, it means that the article does not have any regional information, and S250 can be directly executed to output a result that the article is not regional.
[0143] S230, extracting regional words from the article and determining whether the number of regional words is greater than 1; if so, executing S240; if not, executing S250.
[0144] If the article is regional in nature, the place names in the article can be identified through NER tools to obtain regional words, and then it can be determined whether the number of extracted regional words is greater than 1.
[0145] If the number of extracted regional words is not greater than 1, that is, the number of extracted regional words is 0 or 1, S250 can be directly executed to output the corresponding regionality and regional information. As an implementation method, if the number of regional words is 1, the regional word can be directly used as the regional information of the article, and the article has regionality and the regional word is output. If the number of extracted regional words is 0, that is, no regional word is extracted from the article, the result that the article does not have regionality is directly output.
[0146] If the number of extracted regional words is greater than 1, it is difficult to determine which regional word the regional information actually indicated by the article is, so S240 may be continued to be executed to further determine the regional information of the article from multiple regional words.
[0147] S240: Calculate the matching degree between each regional word and the article, and use the regional word with the highest matching degree as the regional information of the article.
[0148] When multiple regional words are extracted from an article, the matching degree between each regional word and the article can be calculated respectively to obtain the matching degree corresponding to each regional word, and then the regional word with the highest matching degree is used as the regional information of the article.
[0149] When calculating the matching degree between each regional word and the article, it can be based on constructing a fusion data pair and associated data corresponding to each regional word.
[0150] The fused data pair may include first fused data and second fused data, both of which are constructed based on a preset template. The first fused data combines the regional words and the category information of the article into a complete sentence expression, and the second fused data splices all the information of the article together.
[0151] Associated data refers to data extracted based on preset rules, and may generally include associated data of geographical terms, such as the administrative unit to which the geographical terms belong; it may also include associated data of articles, such as category information of the article, the regionality of the identification of the publisher of the article, and the administrative unit to which the geographical terms in the identification of the publisher of the article belong; it may also include associated data between geographical terms and articles, such as the location information of the geographical terms in the article and the number of times the geographical terms appear in the article.
[0152] The fused data pairs and associated data corresponding to the regional words are input into the matching degree calculation model to obtain the matching degree of the regional words. When calculating the matching degree, the matching degree calculation model can perform semantic recognition on the fused data pairs through the BERT model to obtain the first feature vector; and encode the associated data through the GBDT model to obtain the second feature vector. The first feature vector can represent deep semantic features, and the second feature vector represents shallow features extracted based on rules. The first feature vector and the second feature vector are then fused to obtain the target feature vector, and then binary classification is performed based on the target feature vector to obtain the final matching degree.
[0153] By inputting the fused data pair and associated data corresponding to each regional word into the matching calculation model, the matching degree corresponding to each regional word can be obtained, and then the regional words are sorted based on the matching degree, and the regional word with the highest matching degree is determined as the regional information of the article.
[0154] S250. Output the regionality and regional information of the article.
[0155] The final output is the regionality of the article and the determined regional information.
[0156] As can be seen from the above, the embodiments of the present application can make regional judgments on articles and extract regional words from articles with regional characteristics. If there are multiple regional words extracted, the matching degree of each regional word with the text to be recognized is calculated separately. When calculating the matching degree between the regional word and the text to be recognized, the extracted deep semantic features and the shallow features obtained based on rule extraction can be combined to avoid the deep model from focusing too much on semantic features and ignoring some shallow features. The deep semantic features and shallow features are combined to calculate the matching degree, which can ensure the integrity of the features of the regional words and the text to be recognized, improve the accuracy of the calculated matching degree, and further improve the accuracy of identifying regional information.
[0157] In order to better implement the above method, the embodiment of the present application also provides a regional information identification device, which can be integrated in an electronic device, and the electronic device can be a terminal, a server, etc. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.
[0158] For example, in this embodiment, the method of the embodiment of the present application will be described in detail by taking the specific integration of the regional information identification device in the server as an example.
[0159] For example, Figure 3 As shown, the region information identification device 300 may include an acquisition module 310 , a semantic recognition module 320 , an encoding module 330 , a calculation module 340 and a determination module 350 .
[0160] An acquisition module 310 is used to acquire a text to be recognized and a regional word in the text to be recognized;
[0161] A semantic recognition module 320, configured to perform semantic recognition on the fused data obtained based on the regional word and the text to be recognized, and obtain a first feature vector corresponding to the regional word;
[0162] An encoding module 330 is used to encode the association data between the regional word and the text to be recognized to obtain a second feature vector corresponding to the regional word;
[0163] A calculation module 340, configured to calculate a matching degree between the text to be recognized and the regional word based on the first feature vector and the second feature vector corresponding to the regional word;
[0164] The determination module 350 is used to determine the region information of the text to be recognized from the region words according to the matching degree of the region words.
[0165] In some embodiments, the calculation module 340 further includes:
[0166] A fusion unit, used for fusing the first feature vector and the second feature vector to obtain a target feature vector;
[0167] A normalization unit is used to perform normalization processing based on the target feature vector to obtain a matching degree between the text to be recognized and the regional word.
[0168] In some embodiments, the fused data includes first fused data and second fused data, and the semantic recognition module 320 further includes:
[0169] An information acquisition unit, used to acquire category information and publisher information of the text to be recognized;
[0170] A first fusion unit, configured to fill the category information and the regional words into a preset template to obtain the first fusion data;
[0171] A second fusion unit, configured to combine the text to be recognized, the category information, and the publisher information of the text to be recognized according to the preset template to obtain the second fused data;
[0172] A semantic recognition unit is used to perform semantic recognition on the fused data to obtain the first feature vector.
[0173] In some embodiments, the encoding module 330 further includes:
[0174] An extraction unit, used for extracting the association data between the regional word and the text to be recognized from the text to be recognized according to a preset rule;
[0175] The encoding unit is used to encode the associated data to obtain the second feature vector.
[0176] In some embodiments, the region information identification device 300 further includes a training module, and the training module is used to:
[0177] Acquire a first model and a first sample set, wherein the first sample set includes a specified sample to be identified and a marked regional word, wherein the marked regional word is the only regional word in the specified sample to be identified;
[0178] Predicting the regional words for the designated sample to be identified by using the first model to obtain the predicted regional words;
[0179] Using the predicted regional words and the marked regional words, adjusting the model parameters of the first model to obtain an adjusted first model;
[0180] constructing a second model using the adjusted first model;
[0181] The parameters of the second model are adjusted to obtain a matching degree calculation model, wherein the matching degree calculation model is used to calculate the matching degree between the regional words in the text to be recognized and the text to be recognized.
[0182] In some embodiments, the training module is further configured to:
[0183] Acquire a second sample set, wherein the second sample set includes sample fusion data corresponding to the sample regional words, sample association data corresponding to the sample regional words, and label values;
[0184] Based on the second model, the sample fusion data and the sample association data are fused to obtain a prediction value;
[0185] Based on the predicted value and the label value, the model parameters of the second model are adjusted to obtain the matching degree calculation model.
[0186] In specific implementation, the above modules or units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above modules or units can refer to the previous method embodiments, which will not be repeated here.
[0187] As can be seen from the above, the regional information identification device of this embodiment can obtain the text to be identified and the regional words in the text to be identified; perform semantic identification on the fused data obtained based on the regional words and the text to be identified, and obtain the first feature vector corresponding to the regional words; perform encoding processing on the associated data between the regional words and the text to be identified, and obtain the second feature vector corresponding to the regional words; calculate the matching degree between the text to be identified and the regional words based on the first feature vector and the second feature vector corresponding to the regional words; finally, according to the matching degree of the regional words, determine the regional information of the text to be identified from the regional words. When calculating the matching degree, the semantic features of the regional words and the text to be identified and the shallow features obtained based on simple encoding are integrated, so that the feature expressions of the regional words and the text to be identified are more complete and accurate, so as to improve the calculation accuracy of the matching degree and further improve the accuracy of identifying regional information.
[0188] The embodiment of the present application also provides an electronic device, which can be a terminal, a server, etc. The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc. The server can be a single server or a server cluster composed of multiple servers, etc.
[0189] In some embodiments, the region information identification device may also be integrated into multiple electronic devices. For example, the region information identification device may be integrated into multiple servers, and the region information identification method of the present application may be implemented by multiple servers.
[0190] In this embodiment, the electronic device of this embodiment is a server as an example for detailed description, for example, Figure 4 As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:
[0191] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, an input module 404, and a communication module 405. Those skilled in the art will appreciate that Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0192] The processor 401 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 402 and calling data stored in the memory 402, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. In some embodiments, the processor 401 may include one or more processing cores; in some embodiments, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0193] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0194] The electronic device also includes a power supply 403 for supplying power to various components. In some embodiments, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0195] The electronic device may further include an input module 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0196] The electronic device may further include a communication module 405. In some embodiments, the communication module 405 may include a wireless module. The electronic device may perform short-range wireless transmission through the wireless module of the communication module 405, thereby providing the user with wireless broadband Internet access. For example, the communication module 405 may be used to help the user send and receive emails, browse web pages, and access streaming media.
[0197] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:
[0198] Acquire a text to be recognized and a regional word in the text to be recognized;
[0199] Performing semantic recognition on fused data obtained based on the regional word and the text to be recognized to obtain a first feature vector corresponding to the regional word;
[0200] Encoding the association data between the regional word and the text to be recognized to obtain a second feature vector corresponding to the regional word;
[0201] Calculating the matching degree between the text to be recognized and the regional word based on the first feature vector and the second feature vector corresponding to the regional word;
[0202] According to the matching degree of the regional words, the regional information of the text to be recognized is determined from the regional words.
[0203] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0204] As can be seen from the above, the embodiments of the present application can obtain the text to be recognized and the regional words in the text to be recognized; perform semantic recognition on the fused data obtained based on the regional words and the text to be recognized, and obtain the first feature vector corresponding to the regional words; perform encoding processing on the associated data between the regional words and the text to be recognized, and obtain the second feature vector corresponding to the regional words; based on the first feature vector and the second feature vector corresponding to the regional words, calculate the matching degree between the text to be recognized and the regional words; finally, according to the matching degree of the regional words, determine the regional information of the text to be recognized from the regional words. When calculating the matching degree, the semantic features of the regional words and the text to be recognized and the shallow features obtained based on simple encoding are integrated, so that the feature expressions of the regional words and the text to be recognized are more complete and accurate, so as to improve the calculation accuracy of the matching degree and further improve the accuracy of identifying regional information.
[0205] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0206] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the regional information identification methods provided in the embodiments of the present application. For example, the instructions can execute the following steps:
[0207] Acquire a text to be recognized and a regional word in the text to be recognized;
[0208] Performing semantic recognition on fused data obtained based on the regional word and the text to be recognized to obtain a first feature vector corresponding to the regional word;
[0209] Encoding the association data between the regional word and the text to be recognized to obtain a second feature vector corresponding to the regional word;
[0210] Calculating the matching degree between the text to be recognized and the regional word based on the first feature vector and the second feature vector corresponding to the regional word;
[0211] According to the matching degree of the regional words, the regional information of the text to be recognized is determined from the regional words.
[0212] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0213] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the method provided in various optional implementations of the regional information recognition or model training aspects provided in the above embodiments.
[0214] Since the instructions stored in the storage medium can execute the steps in any of the regional information identification methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any of the regional information identification methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0215] The above is a detailed introduction to a method, device, electronic device and computer-readable storage medium for identifying regional information provided in an embodiment of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for identifying regional information, characterized in that: The method comprises: Acquire a text to be recognized and a regional word in the text to be recognized; Performing semantic recognition on the fused data obtained based on the regional word and the text to be recognized to obtain a first feature vector corresponding to the regional word; the fused data includes first fused data and second fused data, and performing semantic recognition on the fused data obtained based on the regional word and the text to be recognized to obtain the first feature vector corresponding to the regional word includes: Acquire the category information and publisher information of the text to be recognized; fill the category information and the regional word into a preset template to obtain the first fused data; splice the text to be recognized, the category information and the publisher information of the text to be recognized according to the preset template to obtain the second fused data; perform semantic recognition on the fused data to obtain the first feature vector; Encoding the association data between the regional word and the text to be recognized to obtain a second feature vector corresponding to the regional word; Calculating the matching degree between the text to be recognized and the regional word based on the first feature vector and the second feature vector corresponding to the regional word; According to the matching degree of the regional words, the regional information of the text to be recognized is determined from the regional words.
2. The method according to claim 1, characterized in that: Calculating the matching degree between the text to be recognized and the regional word based on the first feature vector and the second feature vector corresponding to the regional word includes: fusing the first feature vector and the second feature vector to obtain a target feature vector; Normalization processing is performed based on the target feature vector to obtain a matching degree between the text to be recognized and the regional word.
3. The method according to claim 1, characterized in that: The encoding process of the association data between the regional word and the text to be recognized to obtain a second feature vector corresponding to the regional word includes: Extracting association data between the regional word and the text to be recognized from the text to be recognized according to preset rules; The associated data is encoded to obtain the second feature vector.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Acquire a first model and a first sample set, wherein the first sample set includes a specified sample to be identified and a marked regional word, wherein the marked regional word is the only regional word in the specified sample to be identified; Predicting the regional words for the designated sample to be identified by using the first model to obtain the predicted regional words; Using the predicted regional words and the marked regional words, adjusting the model parameters of the first model to obtain an adjusted first model; constructing a second model using the adjusted first model; The parameters of the second model are adjusted to obtain a matching degree calculation model, wherein the matching degree calculation model is used to calculate the matching degree between the regional words in the text to be recognized and the text to be recognized.
5. The method according to claim 4, characterized in that The step of adjusting parameters of the second model to obtain a matching degree calculation model includes: Acquire a second sample set, wherein the second sample set includes sample fusion data corresponding to the sample regional words, sample association data corresponding to the sample regional words, and label values; Based on the second model, the sample fusion data and the sample association data are fused to obtain a prediction value; Based on the predicted value and the label value, the model parameters of the second model are adjusted to obtain the matching degree calculation model.
6. A regional information identification device, characterized in that: The device comprises: An acquisition module, used for acquiring the text to be recognized and the regional words in the text to be recognized; A semantic recognition module is used to perform semantic recognition on the fused data obtained based on the regional word and the text to be recognized, and obtain a first feature vector corresponding to the regional word; the fused data includes first fused data and second fused data, and the semantic recognition module is specifically used to: Acquire the category information and publisher information of the text to be recognized; fill the category information and the regional word into a preset template to obtain the first fused data; splice the text to be recognized, the category information and the publisher information of the text to be recognized according to the preset template to obtain the second fused data; perform semantic recognition on the fused data to obtain the first feature vector; an encoding module is used to encode the associated data between the regional word and the text to be recognized to obtain the second feature vector corresponding to the regional word; A calculation module, used for calculating the matching degree between the text to be recognized and the regional word based on the first feature vector and the second feature vector corresponding to the regional word; A determination module is used to determine the regional information of the text to be recognized from the regional words according to the matching degree of the regional words.
7. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in the regional information identification method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the regional information identification method according to any one of claims 1 to 5.
9. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps in the method for identifying regional information according to any one of claims 1 to 5.
