Method, device, electronic device and storage medium for identifying location in object text
By using a multi-task learning deep neural network model to perform location recognition in object text, the misjudgment problem caused by the same name or similar place names in the prior art is solved, and a higher accuracy of location recognition is achieved.
Patent Information
- Application Number
- CN202110787730.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-13
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2041-07-13
AI Technical Summary
The prior art is prone to misjudgment when identifying places in object texts due to the same name or similar place names, resulting in inaccurate location identification and easy to misjudgment as local information.
The multi-task learning deep neural network model is used to splice the text association information and account information and enter the model. The attribute information and location label information of the object text are obtained through training to determine the location recognition results. This model does not need to rely on the placental dictionary, avoiding misjudgment based on the placental dictionary matching.
It improves the accuracy of location recognition in the text, avoids misjudgment in traditional methods, and has higher accuracy in location recognition than single-task model.
Smart Images

Figure CN113569045B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text processing, and in particular to a method, device, electronic device and storage medium for identifying locations in object text. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the application that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] Local information refers to information that occurs in a certain local area or is related to the area. In the field of information recommendation, local information is usually only suitable for recommendation to local users and users who are interested in the area. Taking news as an example, in related technologies, location information is extracted from news texts to mark the areas where the news is suitable for recommendation, providing a basis for news recommendations.
[0004] In the related art, the location information in the object text is often extracted by matching based on the place name dictionary. The names of thousands of provinces, cities, districts and administrative regions in the country are added to the place name dictionary and a dictionary tree (Trie tree) is established. The AC automaton (Aho-Corasick automaton) multi-mode matching algorithm is used to match the object text content, and the frequency of each place matched from the object text is recorded, sorted from high to low according to the frequency, and the score is calculated in combination with the administrative hierarchy of the place. The place with a high score is taken as the final place label. If no place is matched from the object text, the object text content is considered to be non-local information. The key point of this matching method is string matching, and the place names of some cities in the country have the same name as common nouns, such as Rizhao City, Shandong Province, Zhongshan City, Guangdong Province, etc. There are also cases of the same name or similarity between cities, such as Jilin City, Jilin Province, Anshan City, Liaoning Province and Ma'anshan City, Anhui Province, etc. The string matching stage using the above matching method is prone to misjudgment, resulting in inaccurate location recognition and easy misjudgment as local information. Summary of the invention
[0005] In order to solve the above technical problems, the embodiments of the present application provide a method, device, electronic device and storage medium for identifying places in object text, which improve the accuracy of place identification in text.
[0006] On the one hand, an embodiment of the present application provides a method for identifying a location in an object text, comprising:
[0007] Obtaining text-related information of the object text to be identified and account information that published the object text;
[0008] Inputting a character string obtained by concatenating the text association information and the account information into a multi-task location recognition model to obtain attribute information of the object text and location label information of the object text, wherein the attribute of the object text represents whether the content of the object text belongs to local information, and the multi-task location recognition model is obtained by training the text association information in each sample object text extracted from the sample object text set and the account information that publishes the sample object text according to a preset multi-task learning deep neural network model;
[0009] A location recognition result is determined according to the attribute information of the object text and the location tag information of the object text.
[0010] In a possible implementation, the multi-task location recognition model includes an input layer, a shared network layer, a first task network layer, and a second task network layer; the shared network layer is connected to the first task network layer and the second task network layer respectively;
[0011] The first task network layer includes a first fully connected layer, a first classifier and a first output layer; the second task network layer includes a second fully connected layer, a second classifier and a second output layer.
[0012] In a possible implementation, the shared network layer includes a pre-trained model; the input layer is connected to the pre-trained model, the pre-trained model is respectively connected to the first fully connected layer and the second fully connected layer, the first fully connected layer is connected to the first classifier, the first classifier is connected to the first output layer, the second fully connected layer is connected to the second classifier, and the second classifier is connected to the second output layer.
[0013] In a possible implementation, the input layer is further connected to the second fully connected layer, so that the input information of the input layer and the output information of the pre-trained model serve as inputs of the second fully connected layer.
[0014] In a possible implementation, the character string obtained by concatenating the text association information and the account information is input into a multi-task location recognition model to obtain the attribute information of the object text and the location label information of the object text, specifically including:
[0015] Inputting a character string obtained by concatenating the text association information and the account information into the input layer, and the input layer inputs the character string into the pre-trained model to obtain word vectors corresponding to the text association information and the account information;
[0016] Inputting the word vector into the first fully connected layer to obtain a first feature vector, inputting the first feature vector into the first classifier for classification, obtaining a classification result of the attribute information of the object text, and outputting the classification result of the attribute information of the object text through the first output layer; and
[0017] The character string obtained by concatenating the text association information and the account information and the word vector are input into the second fully connected layer to obtain a second feature vector, the second feature vector is input into the second classifier for classification, the location label information classification result of the object text is obtained, and the location label information classification result of the object text is output through the second output layer.
[0018] In a possible implementation, the text association information of the object text includes the title information of the object text, the category information of the object text, and the object text fragment containing the place name or words with local attribute characteristics in the object text; the account information includes the account name information and the account location information.
[0019] In a possible implementation manner, the attribute information of the object text includes: the content of the object text is local information, the content of the object text is non-local information, and the content of the object text is unknown information;
[0020] Determining a location recognition result according to the attribute information of the object text and the location tag information of the object text specifically includes:
[0021] When it is determined that the content of the object text is non-local information, then determining that the location recognition result is empty;
[0022] When it is determined that the content of the object text is local information, it is determined whether the content of the object text is strong local information or weak local information, a first determination result is obtained, and the first determination result and the location tag information with the highest probability are determined as the location recognition result;
[0023] When it is determined that the content of the object text is unknown information, the content of the object text is determined to be weak local information, a second determination result is obtained, and the second determination result and the location tag information with the highest probability are determined as the location recognition result.
[0024] In a possible implementation, when it is determined that the content of the object text is local information, determining whether the content of the object text is strong local information or weak local information, and obtaining a first determination result specifically includes:
[0025] When it is determined that the content of the object text is local information, if the probability that the content of the object text is local information is greater than or equal to a preset threshold, the content of the object text is determined to be strong local information; if the probability that the content of the object text is local information is less than the preset threshold, the content of the object text is determined to be weak local information.
[0026] In a possible implementation, the account location information is obtained in the following manner:
[0027] The account location information corresponding to the account name information is obtained according to the stored correspondence list between the account name information and the account location information.
[0028] On the one hand, an embodiment of the present application provides a device for identifying a location in an object text, comprising:
[0029] An acquisition unit, used to acquire text association information of the object text to be identified and account information for publishing the object text;
[0030] A recognition unit, used to input a character string obtained by concatenating the text association information and the account information into a multi-task location recognition model to obtain attribute information of the object text and location label information of the object text, wherein the attribute of the object text represents whether the content of the object text belongs to local information, and the multi-task location recognition model is obtained by training the text association information in each sample object text extracted from the sample object text set and the account information that publishes the sample object text according to a preset multi-task learning deep neural network model;
[0031] A determination unit is used to determine a location recognition result according to the attribute information of the object text and the location tag information of the object text.
[0032] In a possible implementation, the multi-task location recognition model includes an input layer, a shared network layer, a first task network layer, and a second task network layer; the shared network layer is connected to the first task network layer and the second task network layer respectively;
[0033] The first task network layer includes a first fully connected layer, a first classifier and a first output layer; the second task network layer includes a second fully connected layer, a second classifier and a second output layer.
[0034] In a possible implementation, the shared network layer includes a pre-trained model; the input layer is connected to the pre-trained model, the pre-trained model is respectively connected to the first fully connected layer and the second fully connected layer, the first fully connected layer is connected to the first classifier, the first classifier is connected to the first output layer, the second fully connected layer is connected to the second classifier, and the second classifier is connected to the second output layer.
[0035] In a possible implementation, the input layer is further connected to the second fully connected layer, so that the input information of the input layer and the output information of the pre-trained model serve as inputs of the second fully connected layer.
[0036] In a possible implementation, the recognition unit is specifically configured to input a character string obtained by concatenating the text association information and the account information into the input layer, and the input layer inputs the character string into the pre-trained model to obtain word vectors corresponding to the text association information and the account information;
[0037] Inputting the word vector into the first fully connected layer to obtain a first feature vector, inputting the first feature vector into the first classifier for classification, obtaining a classification result of the attribute information of the object text, and outputting the classification result of the attribute information of the object text through the first output layer; and
[0038] The character string obtained by concatenating the text association information and the account information and the word vector are input into the second fully connected layer to obtain a second feature vector, the second feature vector is input into the second classifier for classification, the location label information classification result of the object text is obtained, and the location label information classification result of the object text is output through the second output layer.
[0039] In a possible implementation, the text association information of the object text includes the title information of the object text, the category information of the object text, and the object text fragment containing the place name or words with local attribute characteristics in the object text; the account information includes the account name information and the account location information.
[0040] In a possible implementation manner, the attribute information of the object text includes: the content of the object text is local information, the content of the object text is non-local information, and the content of the object text is unknown information;
[0041] The determining unit is specifically configured to determine that the location recognition result is empty when it is determined that the content of the object text is non-local information;
[0042] When it is determined that the content of the object text is local information, it is determined whether the content of the object text is strong local information or weak local information, a first determination result is obtained, and the first determination result and the location tag information with the highest probability are determined as the location recognition result;
[0043] When it is determined that the content of the object text is unknown information, the content of the object text is determined to be weak local information, a second determination result is obtained, and the second determination result and the location tag information with the highest probability are determined as the location recognition result.
[0044] In a possible implementation, the determination unit is specifically used to, when determining that the content of the object text is local information, determine that the content of the object text is strong local information if the probability that the content of the object text is local information is greater than or equal to a preset threshold; and determine that the content of the object text is weak local information if the probability that the content of the object text is local information is less than the preset threshold.
[0045] In a possible implementation manner, the acquisition unit is specifically configured to acquire the account location information in the following manner:
[0046] The account location information corresponding to the account name information is obtained according to the stored correspondence list between the account name information and the account location information.
[0047] On the one hand, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the method for identifying locations in object text described in the present application is implemented when the processor executes the computer program.
[0048] On the one hand, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the steps of the method for identifying a place in an object text described in the present application.
[0049] The embodiments of the present application provide a method, device, electronic device and storage medium for identifying a place in an object text, obtain text association information of an object text to be identified and account information that publishes the object text to be identified, input a character string obtained by concatenating the obtained text association information and account information into a multi-task place recognition model, obtain attribute information and place label information of the object text to be identified, the attribute of the object text represents whether the content of the object text belongs to local information, the multi-task place recognition model is obtained by training the text association information in each sample object text extracted from a sample object text set and the account information that publishes the corresponding sample object text according to a preset multi-task learning deep neural network model, and then determine its place recognition result according to the attribute information and place label information of the object text to be identified. In an embodiment of the present application, a trained multi-task location recognition model is used to perform location recognition on an object text to be recognized, and two related tasks, namely, whether the content of the object text belongs to local information and extracting the location label of the object text, are integrated into the same neural network model for solution. It does not need to rely on a place name dictionary, avoids the misjudgment caused by the method of extracting places in the text based on matching of a place name dictionary, improves the accuracy of location recognition, and, compared with the recognition effect of a traditional single-task model, has higher location recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of an application scenario of the method for identifying locations in object text provided in an embodiment of the present application;
[0051] Figure 2 A schematic diagram of the implementation process of the method for identifying locations in an object text provided in an embodiment of the present application;
[0052] Figure 3 A structural diagram of a multi-task location recognition model provided in an embodiment of the present application;
[0053] Figure 4 A structural diagram of another multi-task location recognition model provided in an embodiment of the present application;
[0054] Figure 5 A schematic diagram of an implementation flow of obtaining attribute information of a text to be identified and location tag information of a text to be identified provided in an embodiment of the present application;
[0055] Figure 6 A schematic diagram of an implementation flow of determining a location recognition result according to attribute information of a text to be recognized and location tag information of the text to be recognized provided in an embodiment of the present application;
[0056] Figure 7 A schematic diagram of the structure of a device for identifying a location in an object text provided in an embodiment of the present application;
[0057] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present application, and are not intended to limit the scope of the present application in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0059] Those skilled in the art know that the embodiments of the present application can be implemented as a system, device, equipment, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0060] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.
[0061] For ease of understanding, the technical terms involved in the embodiments of the present application are explained as follows:
[0062] 1. Local news: refers to news content that occurs in a certain local area or is related to the area. When recommending information flow, local news is usually only suitable for recommendation to local users and users who are interested in the area. In the embodiment of the present application, the regional scope of local news can be as large as a provincial administrative unit and as small as a district or county administrative unit.
[0063] 2. Strong local news: refers to news content that is only suitable for recommendation to local users and is not of interest to users in other regions. For example, this type of news content may include local weather forecasts, municipal facilities construction, house purchases, primary and secondary education, and other information.
[0064] 3. Weak local news: refers to news content that can be recommended to local users as well as users who are interested in the local area. For example, this type of news content can include local humanities and geography introductions, food and attractions guides, local conferences, event reports, and other news information.
[0065] 4. Location label: It is a label unique to local news. In this article, the location label indicates the area where the news is suitable for recommendation, and whether the news is strong local news or weak local news. The location can be divided into three levels, and the levels from high to low represent the province (or autonomous region, municipality directly under the central government), city (or autonomous prefecture, league) and county (or district, flag) where the region is located. Among them, the province and autonomous region, municipality directly under the central government belong to the same level, the city and autonomous prefecture, league belong to the same level, and the county and district, flag belong to the same level. When outputting the location recognition result, strong local news can be represented by "true", and weak local news can be represented by "false", which can also be set as needed. The embodiment of the present invention does not limit this. For example, the location label of a strong local news in Binjiang District, Hangzhou City, Zhejiang Province can be represented as follows: Zhejiang, Hangzhou, Binjiang, true; non-local news can be represented by "null" but is not limited to it.
[0066] 5. Multi-task learning (MTL): Multi-task learning refers to training two or more tasks at the same time, which is an integrated learning method. Assuming that there are multiple tasks to be trained, and there are correlations between the tasks or between some of the tasks, multi-task learning uses the knowledge information of some or all tasks other than the main task to assist in improving the effect of the main task and enhance the generalization ability of the main task.
[0067] 6. Parameter Sharing: It is a method of training neural network models. Parameter sharing can not only improve training efficiency and reduce parameter scale, but also improve the generalization ability of neural network models to a certain extent. Parameter sharing can be divided into several modes, such as hard sharing, soft sharing, and sharing-private. Hard sharing of parameters means that multiple tasks use the same network layer parameters at the bottom layer, map the input data to the same space, and retain the output layers of several specific tasks. At the position close to the output layer, different network structures can be designed for different tasks, and parameters specific to different tasks can be trained. Soft sharing of parameters means that each task learns a network model separately, and the network models of different tasks can obtain information in the corresponding networks of other tasks, such as vector representation and gradient information. Sharing-private parameters include both parameter sharing and private parts of each task.
[0068] 7. Cross Entropy: It is an important concept in information theory, mainly used to measure the difference information between two probability distributions. In the machine learning scenario, cross entropy is used as a loss function to measure the similarity between the real data distribution and the model prediction results. In multi-classification problems, the loss function is the cross entropy loss function. For the sample point (x, y) in the data set, y is the real label. In multi-classification problems, its value is the label set (labels). Assuming there are K label values, it means that the task is K-classified, and the probability that the i-th sample is predicted to be the k-th label value is p i,k , there are N samples in total, then the loss function formula of the data set is:
[0069]
[0070] Among them, y i,k It represents the true probability that the i-th sample is the k-th label value.
[0071] The principles and spirit of the present application are explained in detail below with reference to several representative implementations of the present application. SUMMARY OF THE INVENTION
[0073] Local information is information that occurs in a certain local area or is related to the area. In the field of information recommendation, local information is usually only suitable for recommendation to local users and users who are interested in the area. Taking news as an example, in the related art, location information is extracted from the news text to mark the area where the news is suitable for recommendation, providing a basis for the recommendation of news. The inventor of the present application found that in the related art, the location information in the object text is often extracted by matching based on a place name dictionary. The names of thousands of provinces, cities, districts and administrative regions across the country are added to the place name dictionary and a dictionary tree is established. The AC automaton multi-mode matching algorithm is used to match the object text content, and the frequency of each place matched from the object text is recorded, and it is sorted from high to low according to the frequency, and the score is calculated in combination with the administrative hierarchy relationship of the place. The place with a high score is taken as the final place label. If no place is matched from the object text, the object text content is considered to be non-local information. The key point of this matching method is string matching, and the place names of some cities in the country have the same name as common nouns, such as Rizhao City in Shandong Province and Zhongshan City in Guangdong Province. There are also cases of the same name or similarity between cities, such as Jilin City in Jilin Province, Anshan City in Liaoning Province and Ma'anshan City in Anhui Province. The string matching stage using the above matching method is prone to misjudgment, resulting in inaccurate location recognition and easy misjudgment as local information. The above technical solution has been improved in the relevant technology. For example, an improved solution is as follows: first, the text content of the object text is segmented, and only the words with the part of speech of the place name are matched. A mismatch word library is also sorted, and a Trie tree is also constructed. In the forward matching results, a filter is performed again to solve the place name inclusion relationship. For example, Beijing East Road will not be matched to Beijing, and Shangrao Normal University will not be matched to Shangrao City. However, the above improvement scheme also relies on the accuracy of the word segmenter. In addition, the mismatch word library needs to be manually sorted and expanded continuously, and the update speed is slow and inefficient. Moreover, the above improvement scheme cannot accurately identify the place names with the same name.
[0074] Based on this, in order to solve the above problems, the present application proposes a method, device, electronic device and storage medium for identifying a location in an object text, which obtains text association information of the object text to be identified and account information for publishing the object text;
[0075] The character string obtained by concatenating the text association information and the account information is input into a multi-task location recognition model to obtain the attribute information of the object text and the location label information of the object text. The attribute of the object text represents whether the content of the object text belongs to local information. The multi-task location recognition model is obtained by training the text association information in each sample object text extracted from the sample object text set and the account information that publishes the sample object text according to a preset multi-task learning deep neural network model; the location recognition result is determined according to the attribute information of the object text and the location label information of the object text. In the embodiment of the present application, the trained multi-task location recognition model is used to perform location recognition on the object text to be recognized, and the two related tasks of whether the content of the object text belongs to local information and the location label extraction of the object text are integrated into the same neural network model to solve it. It does not need to rely on a place name dictionary, avoids the misjudgment caused by the method of extracting the location in the text based on the place name dictionary for matching, and improves the accuracy of location recognition. Moreover, compared with the recognition effect of the traditional single-task model, its location recognition accuracy is higher.
[0076] After introducing the basic principles of the present application, various non-limiting implementation methods of the present application are described in detail below.
[0077] Application Scenario Overview
[0078] refer to Figure 1 , which is a schematic diagram of an application scenario of the method for identifying a location in an object text provided in an embodiment of the present application. The application scenario may include a terminal device 101 and a server 102, and the terminal device 101 and the server 102 are connected via a communication network. The terminal device 101 may send a location identification request to the server 102 to request the server 102 to perform location identification on the object text to be identified sent by the terminal device 101. After the server 102 determines the location identification result, it returns the location identification result to the terminal device 101, and the terminal device 101 may display the location identification result after receiving it.
[0079] Among them, the communication network can be a local area network, a wide area network, a mobile Internet, etc., the terminal device 101 can be but is not limited to: a smart phone, a tablet computer, a laptop computer, a desktop computer and other devices, the server 102 can be an independent physical server, or it can be a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, and cloud storage. The embodiments of the present application do not limit this.
[0080] Exemplary Methods
[0081] The following describes the method for identifying places in object text according to an exemplary embodiment of the present application in combination with the above application scenarios. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the embodiments of the present application are not limited in this regard. On the contrary, the embodiments of the present application can be applied to any applicable scenario.
[0082] refer to Figure 2 The present application embodiment provides a method for identifying locations in object text, which can be applied to Figure 1 The server 102 shown may specifically include the following steps:
[0083] S21. Obtain text association information of the object text to be identified and account information of the object text that publishes the object text.
[0084] In specific implementation, the object text may be text published by a user through a registered account, such as news, forum articles, etc. The terminal device sends a location identification request to the server, and the location identification request carries at least the object text to be identified, the category information of the object text to be identified, and the account name information that publishes the object text to be identified. After receiving the location identification request, the server obtains the text association information of the text to be identified and the account information that publishes the object text to be identified, wherein the text association information of the object text to be identified includes the title information of the object text to be identified, the category information of the object text to be identified, and the object text fragment containing the place name or words with local attribute characteristics in the object text to be identified, and the account information includes the account name information and account location information that publishes the object text to be identified. Take the object text to be identified as a news article as an example, wherein the category information of the object text to be identified refers to the category of the news article, such as economic news, military news, social news, etc.
[0085] Specifically, the server extracts the title information of the object text to be identified from the object text to be identified, and extracts the object text segment containing the place name or the words with local attribute characteristics from the body of the object text to be identified. When extracting the title information of the object text to be identified, the following preprocessing can be performed: the number of extracted characters is controlled not to exceed a preset number, and the preset number can be set by oneself. For example, for the title of the object text to be identified, no more than 40 characters can be intercepted from the front to the back, and the x title Indicates the number of characters in the title of the extracted object text to be recognized, in lenght title The actual number of characters in the title of the object text to be recognized can be expressed by the following formula:
[0086] x title =title[0:min(40,length title )]
[0087] When extracting an object text segment containing a place name or words with local attribute characteristics from the main text of the object text to be identified, the following preprocessing may be performed: in the main text of the object text to be identified, a specified number of characters may be intercepted from the beginning of the sentence where the place name or words with local attribute characteristics appear, and the specified number may be set by oneself, for example, it may be set to 200 characters, or only the sentence where the place name or words with local attribute characteristics appear may be intercepted, and the embodiment of the present invention is not limited to this, wherein the words with local attribute characteristics may include potential local suggestive words such as "this province" and "our city".
[0088] During the implementation process, the server can obtain the corresponding account location information according to the account name information of the object text to be identified. The server pre-stores a list of correspondences between account name information and account location information, and the server obtains the account location information corresponding to the account name information of the object text to be identified according to the stored list of correspondences between account name information and account location information. Among them, the account location information can be a string spliced in the format of province, city and county. The province can also be an autonomous region or municipality at the same level, the city can also be an autonomous prefecture or league at the same level, and the county can also be a district or flag at the same level, etc., which is not limited in the embodiment of the present invention.
[0089] Specifically, the account location information corresponding to the account name information that publishes the to-be-identified object text can be obtained by querying the stored correspondence list of account name information and account location information. account tag Indicates the account location information, account_table represents the corresponding relationship list between account name information and account location information, and x account Represents the account name information, and the account location information can be expressed as follows:
[0090] x account tag =account_table[x account ]
[0091] account_table[x account ] indicates the corresponding relationship between account name information and account location information in the account_table account name information x account The corresponding account location information.
[0092] S22. Input the character string obtained by concatenating the text association information and the account information into the multi-task location recognition model to obtain the attribute information of the object text and the location label information of the object text.
[0093] In specific implementation, the server uses the title information of the object text to be identified, the category information of the object text to be identified, the object text fragment containing the place name or words with local attribute characteristics in the object text to be identified, the account name information and the account location information that publishes the object text to be identified as a character string segmented by the [SEP] symbol as the input of the pre-trained multi-task location recognition model, and inputs the character string into the multi-task location recognition model to obtain the attribute information of the object text to be identified and the location label information of the object text to be identified, wherein the attribute of the object text represents whether the content of the object text belongs to local information. The multi-task location recognition model is obtained by training the text association information in each sample object text extracted from the sample object text set and the account information that publishes the sample object text according to a preset multi-task learning deep neural network model. The multi-task learning deep neural network model can train two tasks: the task of identifying the attribute information of the sample object text, which can be recorded as the first task, and the task of identifying the location label information of the sample object text, which can be recorded as the second task.
[0094] S23. Determine a location recognition result according to the attribute information of the object text and the location tag information of the object text.
[0095] In specific implementation, the server determines the location recognition result based on the obtained attribute information of the object text to be recognized and the location tag information of the object text to be recognized, and then returns the location recognition result to the terminal device, which displays the location recognition result to the terminal user.
[0096] In the embodiment of the present application, the server obtains the text association information of the object text to be identified and the account information that publishes the object text to be identified, and inputs the string obtained by splicing the obtained text association information and the account information into the multi-task location recognition model to obtain the attribute information and location label information of the object text to be identified. The attribute of the object text represents whether the content of the object text belongs to local information. The multi-task location recognition model is obtained by training the text association information in each sample object text extracted from the sample object text set and the account information that publishes the corresponding sample object text according to the preset multi-task learning deep neural network model, and then, the location recognition result is determined according to the attribute information and location label information of the object text to be identified. In the embodiment of the present application, the trained multi-task location recognition model is used to identify the location of the object text to be identified, and the two related tasks of whether the content of the object text belongs to local information and the location label extraction of the object text are integrated into the same neural network model to solve it. It does not need to rely on the place name dictionary, avoids the misjudgment caused by the method of extracting the location in the text based on the place name dictionary, and improves the accuracy of location recognition. Moreover, compared with the recognition effect of the traditional single-task model, its location recognition accuracy is higher.
[0097] As a possible implementation, the structure diagram of the multi-task location recognition model in the embodiment of the present application is as follows: Figure 3 As shown, the multi-task location recognition model may include: an input layer, a shared network layer, a first task network layer, and a second task network layer, wherein the shared network layer is connected to the first task network layer and the second task network layer, respectively, wherein the first task network layer may include a first fully connected layer, a first classifier, and a first output layer, and the second task network layer may include a second fully connected layer, a second classifier, and a second output layer. The shared network layer includes a pre-trained model, the input layer is connected to the shared network layer, that is, the input layer is connected to the pre-trained model, the pre-trained model is connected to the first fully connected layer and the second fully connected layer, respectively, the first fully connected layer is connected to the first classifier, the first classifier is connected to the first output layer, the second fully connected layer is connected to the second classifier, and the second classifier is connected to the second output layer. The above-mentioned multi-task location recognition model is obtained by training according to a preset multi-task learning deep neural network model based on a sample object text set, that is to say: the structure of the trained multi-task learning deep neural network model is the same as the structure of the multi-task location recognition model. During the training process, a sample object text set consisting of a large number of news texts, texts containing information-related information, or forum article texts can be used to extract text association information from each sample object text in the sample object text set and account information that publishes the corresponding sample object text as input to the multi-task learning deep neural network model. The pre-trained model can be, but is not limited to, a pre-trained language representation model: the ERNIE model. The first fully connected layer and the second fully connected layer can both be fully connected layers with the same initial parameters. The first classifier and the second classifier can both use Softmax classifiers, which is not limited in the embodiment of the present invention. The output of the first task can be expressed by the following formula:
[0098]
[0099] Wherein, y1 represents the output result of the first output layer of the first task, that is, the probability that the content of the sample object text belongs to local information, the probability that the content of the sample object text belongs to non-local information, and the probability that the content of the sample object text is unknown, and the sum of the probability that the content of the sample object text belongs to local information, the probability that it belongs to non-local information, and the probability that it is unknown is equal to 1; x represents the input string, that is, the string obtained by concatenating the title information of the sample object text, the category information of the sample object text, the object text fragment containing the place name or words with local attribute characteristics in the sample object text, the account name information and the account location information that publishes the sample object text; ERNIE(x) represents the input of the string x into the pre-trained language representation model ERNIE model in the shared network layer, the word vector corresponding to the string x is obtained, the output of ERNIE(x) (that is, the word vector corresponding to the string x) is used as the input of the first fully connected layer, the output of the first fully connected layer is input into the softmax classifier connected after the first fully connected layer, and the output result y1 is obtained by classification through the softmax function, w1 represents the weight parameter of the first fully connected layer, and b1 represents the bias parameter of the first fully connected layer.
[0100] The output of the second task can be expressed as follows:
[0101]
[0102] Among them, y2 represents the output result of the second output layer of the second task, that is, the predicted probability of each location label information of the sample object text, and the sum of the probabilities of each location label information is equal to 1; x represents the input character string, that is: the character string obtained by concatenating the title information of the sample object text, the category information of the sample object text, the object text fragment containing the place name or words with local attribute characteristics in the sample object text, and the account name information and account location information of the account that publishes the sample object text; ERNIE(x) represents the input of the character string x into the pre-trained language representation model ERNIE model in the shared network layer, and the word vector corresponding to the character string x is obtained, and the output of ERNIE(x) (that is, the word vector corresponding to the character string x) is used as the input of the second fully connected layer, and the output of the second fully connected layer is input into the softmax classifier connected after the second fully connected layer, and the output result y2 is obtained by classification through the softmax function, w2 represents the weight parameter of the second fully connected layer, and b2 represents the bias parameter of the second fully connected layer.
[0103] As a possible implementation, in the embodiment of the present application, in order to enhance the prediction effect and accuracy of the second task, a second fully connected layer can be connected after the input layer, so that the input information of the input layer and the output information of the shared network layer (ie, the pre-trained model) are used as the input of the second fully connected layer, thereby forming a residual network structure, thereby forming a multi-task location recognition model such as Figure 4 As shown in Figure 4 As shown by the thick solid line in . At this time, the output of the second task can be expressed as follows:
[0104] y2=softmax(∑(w2*(ERNIE(x)+x))+b2)
[0105] Among them, y2 represents the output result of the second output layer of the second task, that is, the predicted probability of each location label information of the sample object text, and the sum of the probabilities of each location label information is equal to 1; x represents the input string, that is: the title information of the sample object text, the category information of the sample object text, the object text fragment containing the place name or words with local attribute characteristics in the sample object text, and the account name information and account location information of the sample object text; ERNIE(x) represents the word vector corresponding to the string x obtained by inputting the string x into the pre-trained language representation model ERNIE model in the shared network layer, and the output of ERNIE(x) (that is, the word vector corresponding to the string x) and the input string x of the input layer are used together as the input of the second fully connected layer, and the output of the second fully connected layer is input into the softmax classifier connected after the second fully connected layer, and the output result y2 is obtained by classification through the softmax function, w2 represents the weight parameter of the second fully connected layer, and b2 represents the bias parameter of the second fully connected layer.
[0106] During the training process of the multi-task learning deep neural network model, the first task and the second task can respectively use cross entropy as the loss function, and the loss function of the multi-task learning deep neural network model can be the weighted sum of the loss function of the first task and the loss function of the second task. During the training process, the parameters of the multi-task learning deep neural network model are continuously adjusted until the model converges to obtain a multi-task location recognition model.
[0107] The specific formula of the loss function of the multi-task learning deep neural network model is as follows:
[0108] Loss=W1*Loss task1 +W2*Loss task2
[0109] Among them, Loss represents the loss function of the multi-task learning deep neural network model;
[0110] Loss task1 Represents the loss function of the first task, W1 represents Loss task1 The weight of
[0111] Loss task2 Represents the loss function of the second task, W2 represents Loss task2 The weight of .
[0112] The values of W1 and W2 can be set according to the importance of the first task and the second task, W1+W2=1.
[0113] As a possible implementation method, Figure 4 The multi-task location recognition model structure shown in Figure 5 The process shown executes step S22 to obtain the attribute information of the object text to be recognized and the location tag information of the object text to be recognized, which specifically includes the following steps:
[0114] S31. Input the character string obtained by concatenating the text association information of the object text to be identified and the account information that publishes the object text to be identified into the input layer of the multi-task location recognition model. The input layer inputs the character string into the pre-trained model to obtain the word vectors corresponding to the text association information and the account information.
[0115] In the specific implementation, the title information of the extracted object text to be identified, the category information of the object text to be identified, the object text fragment containing place names or words with local attribute characteristics in the object text to be identified, the account name information and account location information of the object text to be identified are segmented according to [SEP] and spliced into a string input into the input layer of the multi-task location recognition model, and then the input layer inputs the string into the shared network layer, that is, the pre-trained model ERNIE model, to obtain the word vector corresponding to the input string.
[0116] S32. Input the word vector into the first fully connected layer to obtain the first feature vector, input the first feature vector into the first classifier for classification, obtain the attribute information classification result of the object text to be identified, and output the attribute information classification result of the object text to be identified through the first output layer.
[0117] In the specific implementation, the word vector output by the ERNIE model is input into the first fully connected layer to obtain the first feature vector, and then the first feature vector is input into the first classifier softmax classifier connected thereto for classification, so as to obtain the attribute information classification result of the text to be identified, namely: the probability that the content of the text to be identified belongs to local information, the probability that the content of the text to be identified belongs to non-local information and the probability that the content of the text to be identified is unknown, and the classification result is output through the first output layer.
[0118] S33. Input the character string obtained by concatenating the text association information and the account information and the word vector into the second fully connected layer to obtain a second feature vector, input the second feature vector into the second classifier for classification, obtain the classification result of the location label information of the object text to be identified, and output the classification result of the location label information of the object text to be identified through the second output layer.
[0119] In the specific implementation, the title information of the object text to be identified, the category information of the object text to be identified, the object text fragment containing place names or words with local attribute characteristics in the object text to be identified, the concatenated character string of the account name information and account location information that publishes the object text to be identified, and the word vector output by the ERNIE model are taken as the input of the second fully connected layer, and the second feature vector is obtained through the second fully connected layer. The second feature vector is input into the second classifier softmax classifier connected thereto for classification, and the classification result of the location label information of the object text to be identified is obtained, that is, the predicted probability of each location label information of the object text to be identified, and the classification result of the location label information is output through the second output layer.
[0120] If the structure of the multi-task place recognition model is Figure 3 The structure shown in Figure 1 is as follows. In this step, only the word vector output by the ERNIE model is used as the input of the second fully connected layer, which will not be described in detail here.
[0121] It should be noted that step S32 and step S33 can be executed in parallel.
[0122] As a possible implementation method, in the present application embodiment, the following Figure 6 The process shown in FIG. 1 executes step S23 to determine the location recognition result according to the attribute information of the object text to be recognized and the location tag information of the object text to be recognized. Specifically, the following steps are included:
[0123] S41. When it is determined that the content of the object text to be recognized is non-local information, it is determined that the location recognition result is empty.
[0124] In specific implementation, if in the attribute information classification result of the object text to be identified corresponding to the first task, the probability that the content of the object text to be identified is non-local information is greater than or equal to the first specified threshold, then the content of the object text to be identified is determined to be non-local information, and the location identification result is determined to be empty, which can be represented by "null", then the output location identification result can be "null", wherein the first specified threshold can be set according to actual conditions, for example, it can be set to 0.6, and the embodiment of the present application is not limited to this.
[0125] In another embodiment, when it is determined that the content of the object text to be identified is non-local information, the classification result of the location label information of the object text to be identified and the classification result of the attribute information of the object text to be identified can also be output: null, that is, the location label information with the highest probability of the location label information of the object text to be identified predicted by the second task is output.
[0126] Taking a news text as an example, when the text to be identified is a news text, the output result of the first task of the multi-task location recognition model includes: the probability that the news text is local news, the probability that the news text is non-local news, and the probability that the news text is unknown news, and the output result of the second task includes: the probability of each location label information contained in the identified news text. Assuming that the location label information with the highest probability in the news text is: Chaoyang District, Changchun City, Jilin Province, and the news text is non-local news, the output location recognition result can be "Jilin, Changchun, Chaoyang, null".
[0127] S42. When it is determined that the content of the object text to be recognized is local information, determine whether the content of the object text to be recognized is strong local information or weak local information, obtain a first determination result, and determine the first determination result and the location label information with the highest probability as the location recognition result.
[0128] In specific implementation, the content of the to-be-recognized object text is determined to be strong local information or weak local information in the following manner to obtain a first determination result:
[0129] When it is determined that the content of the object text to be identified is local information, if the probability that the content of the object text to be identified is local information is greater than or equal to a preset threshold, the content of the object text to be identified is determined to be strong local information; if the probability that the content of the object text to be identified is local information is less than the preset threshold, the content of the object text to be identified is determined to be weak local information. Among them, the preset threshold is greater than the first specified threshold, and the preset threshold can be set in combination with the first specified threshold. For example, when the first specified threshold is set to 0.6, the preset threshold can be set to 0.7, and the embodiments of the present application are not limited to this. Strong local information can be represented by "true" and weak local information can be represented by "false", and the embodiments of the present application are not limited to this.
[0130] In the specific implementation process, if the probability that the content of the object text to be identified is local information in the attribute information classification result of the object text to be identified corresponding to the first task is greater than or equal to the first specified threshold, then the content of the object text to be identified is determined to be local information.
[0131] Furthermore, the first determination result and the location tag information with the highest probability are determined as the location recognition result.
[0132] Continuing with the above example, suppose the location label information with the highest probability in the news text is: Binjiang District, Hangzhou City, Zhejiang Province. If the first judgment result is: the news text is strong local news, then the output location recognition result may be "Zhejiang, Hangzhou, Binjiang, true". If the first judgment result is: the news text is weak local news, then the output location recognition result may be "Zhejiang, Hangzhou, Binjiang, false".
[0133] S43. When it is determined that the content of the object text to be identified is unknown information, the content of the object text to be identified is determined to be weak local information, a second determination result is obtained, and the second determination result and the location label information with the highest probability are determined as the location recognition result.
[0134] In a specific implementation, in order to avoid missed detection, if the content of the object text to be identified is unknown information, the content of the object text to be identified is also determined as weak local information.
[0135] Specifically, if in the attribute information classification result of the object text to be identified corresponding to the first task, the probability that the content of the object text to be identified is unknown information is greater than or equal to the first specified threshold, then the content of the object text to be identified is determined to be weak local information, and a second judgment result is obtained, and the second judgment result and the location label information with the highest probability are determined as the location recognition result.
[0136] Continuing with the above example, assuming that the location label information with the highest probability in the news text is: Binjiang District, Hangzhou City, Zhejiang Province, if the second judgment result is: the news text is unknown news, then the output location recognition result may be "Zhejiang, Hangzhou, Binjiang, false".
[0137] Since the two related tasks of whether the content of the object text is local information and the location tag information extraction in the object text are integrated into the same model, namely the multi-task location recognition model, in the embodiment of the present application, the total number of parameters contained in the multi-task location recognition model in the embodiment of the present application is less than the sum of the parameters of the models for the above two tasks respectively. The reduction in the number of parameters improves the computing speed and saves computing resources. Moreover, when the multi-task location recognition model in the embodiment of the present application is used for location recognition, the accuracy and recall rate of the two tasks are significantly improved compared with the existing methods.
[0138] Among them, precision represents the proportion of true positive examples among samples predicted as positive examples, and recall represents the proportion of true positive examples predicted as positive examples to all positive examples.
[0139] In order to verify the recognition effect of the multi-task location recognition model proposed in the embodiment of the present application, taking the recognition of locations in batches of news texts as an example, since the present application focuses more on local news, for the first task of determining whether a news text is local news, the inventors evaluated the precision and recall for local news. The evaluation data for the second task of location tag information recognition are all local news, and the main focus is on whether the location tag information is correct. Only the precision of the location tag information can be evaluated. In the first task of determining whether a news text is local news, the local news precision indicates the proportion of real local news in the sample predicted to be local news, and the local news recall indicates the proportion of real local news predicted to be local news to all local news. The inventor of the embodiment of the present application used 10,000 news texts as test samples, including 2,000 local news and 8,000 non-local news. The multi-task location recognition model was used to predict 2,050 local news articles, of which 1,950 were predicted correctly, that is, 1,950 of the 2,050 predicted local news articles were real local news. The local news accuracy is: 1,950 / 2,050 = 95.12%, and the local news recall is: 1,950 / 2,000 = 97.5%. Similar to the calculation of the local news accuracy, the accuracy of the location tag information is calculated to be 97.36%, which will not be repeated here. It can be seen that the accuracy of location recognition using the multi-task location recognition model proposed in the embodiment of the present application is relatively high.
[0140] Exemplary Devices
[0141] After introducing the method for identifying a location in an object text according to an exemplary embodiment of the present application, next, an apparatus for identifying a location in an object text according to an exemplary embodiment of the present application will be introduced.
[0142] like Figure 7 , which is a schematic diagram of the structure of the device 50 for identifying a location in an object text provided in an embodiment of the present application. In one embodiment, the device 50 for identifying a location in an object text comprises: an acquisition unit 501 , an identification unit 502 and a determination unit 503 .
[0143] An acquisition unit 501 is used to acquire text association information of an object text to be recognized and account information for publishing the object text;
[0144] The recognition unit 502 is used to input the character string obtained by concatenating the text association information and the account information into a multi-task location recognition model to obtain the attribute information of the object text and the location label information of the object text, wherein the attribute of the object text represents whether the content of the object text belongs to local information, and the multi-task location recognition model is obtained by training the text association information in each sample object text extracted from the sample object text set and the account information that publishes the sample object text according to a preset multi-task learning deep neural network model;
[0145] The determination unit 503 is used to determine a location recognition result according to the attribute information of the object text and the location tag information of the object text.
[0146] In a possible implementation, the multi-task location recognition model includes an input layer, a shared network layer, a first task network layer, and a second task network layer; the shared network layer is connected to the first task network layer and the second task network layer respectively;
[0147] The first task network layer includes a first fully connected layer, a first classifier and a first output layer; the second task network layer includes a second fully connected layer, a second classifier and a second output layer.
[0148] In a possible implementation, the shared network layer includes a pre-trained model; the input layer is connected to the pre-trained model, the pre-trained model is respectively connected to the first fully connected layer and the second fully connected layer, the first fully connected layer is connected to the first classifier, the first classifier is connected to the first output layer, the second fully connected layer is connected to the second classifier, and the second classifier is connected to the second output layer.
[0149] In a possible implementation, the input layer is further connected to the second fully connected layer, so that the input information of the input layer and the output information of the pre-trained model serve as inputs of the second fully connected layer.
[0150] In a possible implementation, the recognition unit 502 is specifically configured to input a character string obtained by concatenating the text association information and the account information into the input layer, and the input layer inputs the character string into the pre-trained model to obtain word vectors corresponding to the text association information and the account information;
[0151] Inputting the word vector into the first fully connected layer to obtain a first feature vector, inputting the first feature vector into the first classifier for classification, obtaining a classification result of the attribute information of the object text, and outputting the classification result of the attribute information of the object text through the first output layer; and
[0152] The character string obtained by concatenating the text association information and the account information and the word vector are input into the second fully connected layer to obtain a second feature vector, the second feature vector is input into the second classifier for classification, the location label information classification result of the object text is obtained, and the location label information classification result of the object text is output through the second output layer.
[0153] In a possible implementation, the text association information of the object text includes the title information of the object text, the category information of the object text, and the object text fragment containing the place name or words with local attribute characteristics in the object text; the account information includes the account name information and the account location information.
[0154] In a possible implementation manner, the attribute information of the object text includes: the content of the object text is local information, the content of the object text is non-local information, and the content of the object text is unknown information;
[0155] The determining unit 503 is specifically configured to determine that the location recognition result is empty when it is determined that the content of the object text is non-local information;
[0156] When it is determined that the content of the object text is local information, it is determined whether the content of the object text is strong local information or weak local information, a first determination result is obtained, and the first determination result and the location tag information with the highest probability are determined as the location recognition result;
[0157] When it is determined that the content of the object text is unknown information, the content of the object text is determined to be weak local information, a second determination result is obtained, and the second determination result and the location tag information with the highest probability are determined as the location recognition result.
[0158] In a possible implementation, the determination unit 503 is specifically used to, when determining that the content of the object text is local information, determine that the content of the object text is strong local information if the probability that the content of the object text is local information is greater than or equal to a preset threshold; and determine that the content of the object text is weak local information if the probability that the content of the object text is local information is less than the preset threshold.
[0159] In a possible implementation, the acquisition unit 501 is specifically configured to acquire the account location information in the following manner:
[0160] The account location information corresponding to the account name information is obtained according to the stored correspondence list between the account name information and the account location information.
[0161] Based on the same inventive concept as the above-mentioned method for identifying a location in an object text, the present embodiment of the application further provides an electronic device 60. Figure 8 As shown, the electronic device 60 may include a processor 601 and a memory 602 .
[0162] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and can implement or execute the methods, steps and logic block diagrams for identifying locations in each object text disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method for identifying locations in an object text disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0163] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 602 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0164] It should be noted that, although several units or subunits of the place identification device in the object text are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.
[0165] In addition, although the operations of the location identification method in the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0166] Although the spirit and principle of the present application have been described with reference to several specific embodiments, it should be understood that the present application is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present application is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A method for identifying a location in an object text, characterized in that: include: Obtaining text-related information of the object text to be identified and account information that published the object text; Inputting a character string obtained by concatenating the text association information and the account information into a multi-task location recognition model to obtain attribute information of the object text and location label information of the object text, wherein the attribute of the object text represents whether the content of the object text belongs to local information, and the multi-task location recognition model is obtained by training the text association information in each sample object text extracted from the sample object text set and the account information that publishes the sample object text according to a preset multi-task learning deep neural network model; A location recognition result is determined according to the attribute information of the object text and the location tag information of the object text.
2. The method according to claim 1, characterized in that: The multi-task location recognition model includes an input layer, a shared network layer, a first task network layer and a second task network layer; the shared network layer is connected to the first task network layer and the second task network layer respectively; The first task network layer includes a first fully connected layer, a first classifier and a first output layer; the second task network layer includes a second fully connected layer, a second classifier and a second output layer.
3. The method according to claim 2, characterized in that The shared network layer includes a pre-trained model; the input layer is connected to the pre-trained model, the pre-trained model is respectively connected to the first fully connected layer and the second fully connected layer, the first fully connected layer is connected to the first classifier, the first classifier is connected to the first output layer, the second fully connected layer is connected to the second classifier, and the second classifier is connected to the second output layer.
4. The method according to claim 3, characterized in that The input layer is also connected to the second fully connected layer, so that the input information of the input layer and the output information of the pre-trained model serve as the input of the second fully connected layer.
5. The method according to claim 4, characterized in that The character string obtained by concatenating the text association information and the account information is input into the multi-task location recognition model to obtain the attribute information of the object text and the location label information of the object text, specifically including: Inputting a character string obtained by concatenating the text association information and the account information into the input layer, and the input layer inputs the character string into the pre-trained model to obtain word vectors corresponding to the text association information and the account information; Inputting the word vector into the first fully connected layer to obtain a first feature vector, inputting the first feature vector into the first classifier for classification, obtaining a classification result of the attribute information of the object text, and outputting the classification result of the attribute information of the object text through the first output layer; and The character string obtained by concatenating the text association information and the account information and the word vector are input into the second fully connected layer to obtain a second feature vector, the second feature vector is input into the second classifier for classification, the location label information classification result of the object text is obtained, and the location label information classification result of the object text is output through the second output layer.
6. The method according to claim 1, characterized in that The text association information of the object text includes the title information of the object text, the category information of the object text and the object text fragment containing the place name or words with local attribute characteristics in the object text; the account information includes the account name information and the account location information.
7. The method according to any one of claims 1 to 6, characterized in that: The attribute information of the object text includes: the content of the object text is local information, the content of the object text is non-local information, and the content of the object text is unknown information; Determining a location recognition result according to the attribute information of the object text and the location tag information of the object text specifically includes: When it is determined that the content of the object text is non-local information, then determining that the location recognition result is empty; When it is determined that the content of the object text is local information, it is determined whether the content of the object text is strong local information or weak local information, a first determination result is obtained, and the first determination result and the location tag information with the highest probability are determined as the location recognition result; When it is determined that the content of the object text is unknown information, the content of the object text is determined to be weak local information, a second determination result is obtained, and the second determination result and the location tag information with the highest probability are determined as the location recognition result.
8. The method according to claim 7, characterized in that When it is determined that the content of the object text is local information, determining whether the content of the object text is strong local information or weak local information, and obtaining a first determination result specifically includes: When it is determined that the content of the object text is local information, if the probability that the content of the object text is local information is greater than or equal to a preset threshold, the content of the object text is determined to be strong local information; if the probability that the content of the object text is local information is less than the preset threshold, the content of the object text is determined to be weak local information.
9. The method according to claim 6, characterized in that The location information of the account can be obtained by: The account location information corresponding to the account name information is obtained according to the stored correspondence list between the account name information and the account location information.
10. A device for identifying locations in object text, characterized in that: include: An acquisition unit, used to acquire text association information of the object text to be identified and account information for publishing the object text; A recognition unit, used to input a character string obtained by concatenating the text association information and the account information into a multi-task location recognition model to obtain attribute information of the object text and location label information of the object text, wherein the attribute of the object text represents whether the content of the object text belongs to local information, and the multi-task location recognition model is obtained by training the text association information in each sample object text extracted from the sample object text set and the account information that publishes the sample object text according to a preset multi-task learning deep neural network model; A determination unit is used to determine a location recognition result according to the attribute information of the object text and the location tag information of the object text.
11. The device according to claim 10, characterized in that The multi-task location recognition model includes an input layer, a shared network layer, a first task network layer and a second task network layer; the shared network layer is connected to the first task network layer and the second task network layer respectively; The first task network layer includes a first fully connected layer, a first classifier and a first output layer; the second task network layer includes a second fully connected layer, a second classifier and a second output layer.
12. The device according to claim 11, characterized in that The shared network layer includes a pre-trained model; the input layer is connected to the pre-trained model, the pre-trained model is respectively connected to the first fully connected layer and the second fully connected layer, the first fully connected layer is connected to the first classifier, the first classifier is connected to the first output layer, the second fully connected layer is connected to the second classifier, and the second classifier is connected to the second output layer.
13. The device according to claim 12, characterized in that The input layer is also connected to the second fully connected layer, so that the input information of the input layer and the output information of the pre-trained model serve as the input of the second fully connected layer.
14. The device according to claim 13, characterized in that The recognition unit is specifically configured to input a character string obtained by concatenating the text association information and the account information into the input layer, and the input layer inputs the character string into the pre-trained model to obtain word vectors corresponding to the text association information and the account information; Input the word vector into the first fully connected layer to obtain a first feature vector, input the first feature vector into the first classifier for classification, obtain a classification result of the attribute information of the object text, and output the classification result of the attribute information of the object text through the first output layer; as well as The character string obtained by concatenating the text association information and the account information and the word vector are input into the second fully connected layer to obtain a second feature vector, the second feature vector is input into the second classifier for classification, the location label information classification result of the object text is obtained, and the location label information classification result of the object text is output through the second output layer.
15. The device according to claim 10, characterized in that The text association information of the object text includes the title information of the object text, the category information of the object text and the object text fragment containing the place name or words with local attribute characteristics in the object text; the account information includes the account name information and the account location information.
16. The device according to any one of claims 10 to 15, characterized in that: The attribute information of the object text includes: the content of the object text is local information, the content of the object text is non-local information, and the content of the object text is unknown information; The determining unit is specifically configured to determine that the location recognition result is empty when it is determined that the content of the object text is non-local information; When it is determined that the content of the object text is local information, it is determined whether the content of the object text is strong local information or weak local information, a first determination result is obtained, and the first determination result and the location tag information with the highest probability are determined as the location recognition result; When it is determined that the content of the object text is unknown information, the content of the object text is determined to be weak local information, a second determination result is obtained, and the second determination result and the location tag information with the highest probability are determined as the location recognition result.
17. The device according to claim 16, characterized in that The determination unit is specifically used to, when determining that the content of the object text is local information, determine that the content of the object text is strong local information if the probability that the content of the object text is local information is greater than or equal to a preset threshold; and determine that the content of the object text is weak local information if the probability that the content of the object text is local information is less than the preset threshold.
18. The device according to claim 15, characterized in that The acquisition unit is specifically used to acquire the account location information in the following manner: The account location information corresponding to the account name information is obtained according to the stored correspondence list between the account name information and the account location information.
19. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method for identifying a place in an object text according to any one of claims 1 to 9 are implemented.
20. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the steps of the method for identifying a place in an object text as claimed in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Address identification method and device and storage medium
CN108920457A
Method and device for recognizing regional attributes of text information, and electronic device
CN109271640A