Subject extraction method for opening and closing announcement of place, electronic device and medium
By extracting feature vectors through a pre-trained model and constructing a text binary classification and subject extraction model, the problems of low accuracy and poor efficiency in subject extraction of venue opening and closing announcements are solved, and efficient and accurate subject extraction is achieved.
Patent Information
- Application Number
- CN202210346482.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2042-03-31
AI Technical Summary
The existing technology for extracting the subject of venue opening and closing announcements has low accuracy and poor efficiency, resulting in inaccurate results and requiring repeated manual screening, which is time-consuming and labor-intensive.
A pre-trained model is used to extract feature vectors, and a text binary classification model and a subject extraction model are constructed. The effective announcements and the location subjects are identified by the feature vector type, and the model parameters are adjusted by setting a threshold to improve accuracy.
This improved the accuracy and efficiency of subject extraction for venue opening and closing announcements, reduced manual intervention, and ensured the accuracy of the results and the precise location of the venue.
Smart Images

Figure CN114818875B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of natural language processing, and particularly relates to a subject extraction method for opening and closing announcements of a place, an electronic device and a medium. BACKGROUND
[0002] Subject extraction is a relatively mature natural language processing technology in the field of artificial intelligence. Through a deep learning model, effective subject information is extracted from unstructured text, avoiding reading lengthy texts and reducing manual operation time and effort. Due to factors such as the epidemic, weather, and equipment maintenance, many places such as scenic spots, hospitals, and shopping malls frequently publish information related to the opening and closing of the place. However, in existing subject extraction technology, only the subject of the place is extracted. A considerable portion of these subjects does not involve information about the opening and closing of the place. Therefore, there are many false screening situations, and the precision is low, making the results inaccurate. Manual re-screening of the subject extraction results is required, which is not only time-consuming and labor-intensive, but also often results in errors and omissions. SUMMARY
[0003] The technical problem to be solved by the present application is to overcome the low precision and poor efficiency of existing subject extraction technology for opening and closing announcements of a place. The present application provides a subject extraction method for opening and closing announcements of a place, an electronic device, and a medium. The opening and closing announcements include valid announcements and invalid announcements. Valid announcements are announcements related to the actual opening and closing of the place, and invalid announcements are announcements unrelated to the actual opening and closing information of the place. The efficiency is improved while ensuring the accuracy of the subject.
[0004] The present application solves the above technical problems by the following technical solutions:
[0005] S11, extracting text information of opening and closing announcements of a place;
[0006] S12, extracting a feature vector from the text information using a pre-trained model;
[0007] S13, training a first original model based on the feature vector to obtain a text binary classification model, and training a second original model based on the feature vector to obtain a subject extraction model. The text binary classification model can classify announcements into valid announcements and invalid announcements, and the subject extraction model can extract the subject of the place;
[0008] S14, identifying the type of the feature vector based on the text binary classification model. When the type of the feature vector corresponds to a valid announcement, the subject extraction model extracts the subject of the place from the text information as the subject extraction result. When the type of the feature vector corresponds to an invalid announcement, the subject of the place extracted by the subject extraction model from the text information is not used as the subject extraction result.
[0009] Preferably, the step S12 comprises converting the text information into a text sequence in a fixed format suitable for subject extraction, and extracting a feature vector from the text sequence, specifically:
[0010] converting English letters into upper and lower cases;
[0011] converting Chinese characters from traditional form into simplified form;
[0012] converting English punctuation marks into Chinese punctuation marks;
[0013] removing symbols meaningless for the extraction of the feature vector;
[0014] truncating the text information to obtain a text sequence, so that the text length of the text sequence is within a preset length range of the pre-trained model;
[0015] The truncation of the text information comprises a case where there is repeated text between the plurality of text sequences;
[0016] The text sequence comprises valid marks, invalid marks, and place subject marks.
[0017] Preferably, the step of truncating the text information comprises:
[0018] searching for a keyword corresponding to the place opening and closing information in the text information, and the truncated text sequence comprises a context of the keyword; for a text sequence not containing the keyword, the text sequence becomes a fixed length after truncation.
[0019] Preferably, the output end of the text binary classification model is provided with a first evaluation index, the output end of the subject extraction model is provided with a second evaluation index, and the feature vector comprises a test vector, and the step S13 specifically comprises:
[0020] After the text binary classification model and the subject extraction model are trained by the feature vector, the test vector is used to test the text binary classification model and the subject extraction model, and after the test, if the test result of the text binary classification model does not reach the first evaluation index, or the test result of the subject extraction model does not reach the second evaluation index, the parameters of the non-compliant model are adjusted, and the non-compliant model is retrained;
[0021] If the test result of the text binary classification model reaches the first evaluation index, it is determined that the text binary classification model can classify the announcement into valid announcement and invalid announcement; if the test result of the subject extraction model reaches the second evaluation index, it is determined that the subject extraction model can extract the place subject.
[0022] Preferably, the specific steps of the step S14 comprise:
[0023] S51, combine the text binary classification model and the subject extraction model into a text binary classification and subject extraction combined model, the combined model comprising a text binary classification output end, a semantic output end and a place subject output end;
[0024] S52, the combined model judges whether the text information corresponding to the feature vector is a valid announcement, and outputs a classification result between x and y at the text binary classification output end, so that the classification result corresponding to the valid announcement is closer to x than the classification result corresponding to the invalid announcement;
[0025] The combined model performs character-by-character recognition on the text information corresponding to the feature vector, so that each character corresponds to at least one semantic output result between x and y at the place subject output end, and the semantic output result corresponding to the character of the place subject is closer to x than the semantic output result corresponding to the character irrelevant to the place subject;
[0026] S53, the subject extraction result is the product of each semantic output result and the corresponding classification result;
[0027] S54, the place subject output end is provided with a threshold value, when the subject extraction result is greater than or less than the threshold value, the text corresponding to the subject extraction result is the place subject of the valid announcement.
[0028] Preferably, the specific steps of setting the threshold value comprise:
[0029] S61, set an initial threshold value between x and y, record the subject extraction result, compare the subject extraction result and the corresponding text sequence to obtain an error, and record the subject extraction result corresponding to the error as an error result;
[0030] S62, when the average of the error result is closer to y than the initial threshold value, the value of the threshold value is adjusted to be closer to y than the initial threshold value; when the average of the error result is closer to x than the initial threshold value, the value of the threshold value is adjusted to be closer to x than the initial threshold value;
[0031] Step S62 comprises directly adjusting the threshold value to the maximum or minimum value in the error result, and also comprises adjusting the threshold value within the range of values x and y.
[0032] The application also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the channel estimation method of the application.
[0033] The application also provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to implement the steps of the channel estimation method of the application.
[0034] The positive progress effect of the present application is that:
[0035] By the text binary classification model, it is determined which text information is truly related to the opening and closing information of the place. By the subject extraction model, the subject information of the place is extracted. By the joint text binary classification model and the subject extraction model, the subject extraction result is not only subordinate to the subject of the opening and closing information, but also can accurately locate the position of the subject of the place, greatly improving the work efficiency and the accuracy of the result. In addition, by setting a threshold for the subject output end of the place, when the subject extraction result is higher or lower than the threshold, the corresponding position of the subject extraction result is the subject of the place, which can actively regulate the accuracy of the result. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 The subject extraction method flowchart of the embodiment 1 of the present application.
[0037] Figure 2 The structural schematic diagram of the electronic device of the embodiment 3 of the present application. DETAILED DESCRIPTION
[0038] The present application will be further described by way of examples, but the present application is not limited in the scope of the examples.
[0039] Embodiment 1
[0040] As shown in the embodiment, the subject extraction method based on the opening and closing announcement of the place includes: Figure 1
[0041] Step S1, through the official website, WeChat public number and other ways of the place, the announcement published by the place is collected, and the text information in the announcement is extracted. The place can include hospital, scenic spot, supermarket, shopping mall and the like.
[0042] Step S2, the text information is converted into a text sequence. First, the length of the text information is truncated so that the length of the truncated text information does not exceed the maximum length of the pre-training model, and each piece of text information after truncation is manually labeled to obtain a text sequence. The text sequence includes valid marks, invalid marks and subject marks. Specifically, for the text sequence that truly exists the opening and closing information of the place, the text sequence is labeled as valid, and the text sequence that does not truly exist the opening and closing information of the place is labeled as invalid. The label field is label (tag). For the text sequence with valid label, if there is a subject of the place, the subject of the place also needs to be labeled. The label field is subject (subject).
[0043] Step S3, a pre-training model is constructed. The pre-training model can be selected from BERT model and the like of Chinese. The text sequence is input into the pre-training model to extract the feature vector of the text sequence.
[0044] Step S4, constructing a text binary classification model and a subject extraction model, training the text binary classification model and the subject extraction model respectively using the feature vectors, until the text binary classification model can identify whether the input text sequence is a valid text sequence or an invalid text sequence, and the subject extraction model can identify the place subject in the text sequence.
[0045] Step S5, combining the text binary classification model and the subject extraction model, so that the final subject extraction result can integrate the output of the text binary classification model and the output of the subject extraction model, that is, when a text sequence is input, if the output corresponding to the text binary classification model is valid, the place subject extracted by the subject extraction model is the subject extraction result; if the output corresponding to the text binary classification model is invalid, the subject extraction result is that there is no place subject.
[0046] Step S6, deploying the combined text binary classification model and subject extraction model online to perform subject extraction on the place announcement.
[0047] Embodiment 2
[0048] The subject extraction method of this embodiment is a further limitation of Embodiment 1, specifically:
[0049] Step S2 includes:
[0050] Step S21, text preprocessing, processing the text information into a text format supported by the pre-training model, specifically including: converting the capital letters of English into lowercase letters; converting Chinese traditional into Chinese simplified; converting English punctuation symbols into Chinese punctuation symbols; removing useless symbols in the text, such as spaces, line breaks, tabs, etc.
[0051] Step S22, truncating the text information after step S21 to a length within the maximum text length supported by the pre-training model, specifically, first performing sentence segmentation on the text, selecting sentences containing opening and closing keywords, and truncating the context of the keywords as training samples, that is, placing the keywords in the middle position of the truncated text sequence, thereby obtaining a text sequence; for sentences that do not contain keywords, the text information is truncated to a fixed text length by default to obtain a text sequence. The opening and closing keywords include: temporary closing, resuming opening, etc. which can be used as related vocabulary to express the dynamic of the opening and closing of the place.
[0052] Step S3 includes:
[0053] Step S31, using the pre-training model to extract the corresponding feature vector {H0, H1, …, H n} from the text sequence, where H0 is the CLS corresponding feature vector, H n is the SEP corresponding feature vector.
[0054] Step S32, randomly divide the feature vector corresponding to each text sequence into a training set and a test set, the feature vector in the training set is referred to as a training vector, and the feature vector in the test set is referred to as a test vector. The ratio of the training set to the test set can be 8:2.
[0055] Step S4 includes:
[0056] Step S41, when constructing the text binary classification model, H0 is selected for the construction of the text binary classification model, followed by a single neuron, the activation function adopts the Sigmoid function, and the loss function adopts the binary entropy loss.
[0057] The text binary classification model outputs a classification result in the range of 0 to 1 according to the feature vector. When the classification result is close to 1, it means that the feature vector corresponds to the text related to the real opening and closing information of the place; if the output result is close to 0, it means that the feature vector corresponds to the text without real opening and closing information of the place.
[0058] Step S42, when constructing the subject extraction model, the feature vector sequence {H0, H1, …, Hn} is used as the input of the subject extraction model, followed by two layers of neurons with a length of n, the first layer is used as the subject head prediction sequence, and the second layer is used as the subject tail prediction sequence. The activation function adopts the Sigmoid function, and the loss function adopts the category entropy loss. n} as the input of the subject extraction model, followed by two layers of neurons with a length of n, the first layer is used as the subject head prediction sequence, and the second layer is used as the subject tail prediction sequence. The activation function adopts the Sigmoid function, and the loss function adopts the category entropy loss.
[0059] The subject extraction model outputs a semantic extraction result in the range of 0 to 1 according to the feature vector. If a certain semantic extraction result in the subject head prediction sequence is close to 1, it means that the corresponding position is the head of the subject of the place. If a certain semantic extraction result in the subject head prediction sequence is close to 0, it means that the corresponding position is not the head of the subject of the place. If a certain semantic extraction result in the subject tail prediction sequence is close to 1, it means that the corresponding position is the tail of the subject of the place. If a certain semantic extraction result in the subject tail prediction sequence is close to 0, it means that the corresponding position is not the tail of the subject of the place.
[0060] Step S43, training the text binary classification model and the subject extraction model using the training vector.
[0061] Step S44, testing the text binary classification model and the subject extraction model using the test vector. Specifically, the first evaluation index is set for the text binary classification model, and the second evaluation index is set for the subject extraction model. Both the first evaluation index and the second evaluation index adopt the F1 value.
[0062] After the test, if the test result of the text binary classification model does not reach the first evaluation index, or the test result of the subject extraction model does not reach the second evaluation index, the hyperparameters of the substandard model are adjusted, and the step S43 is returned to;
[0063] If the test result of the text binary classification model reaches the first evaluation index, and the test result of the subject extraction model reaches the second evaluation index, it is determined that the text binary classification model can classify the announcement into valid announcement and invalid announcement, and the subject extraction model can extract the place subject.
[0064] Step S5 includes:
[0065] Step S51, the joint text binary classification model and the subject extraction model, the joint model includes three output ends, respectively, the text binary classification output end, the semantic output end and the place subject output end, the text binary classification output end outputs the classification result, the semantic output end outputs the semantic extraction result, the text binary classification output end outputs the subject extraction result, the subject extraction result is the product of the corresponding classification result and the semantic extraction result, and is divided into the subject head extraction sequence and the subject tail extraction sequence, corresponding to the semantic output result.
[0066] Step S52, the initial threshold value 0.5 is set for the place subject output end, because the numerical value of the classification result and the semantic extraction result is between 0 and 1, the numerical value of the subject extraction result is also between 0 and 1. When the numerical value of the subject extraction result is greater than the initial threshold value, if it is located in the subject head extraction sequence, it belongs to the head of the place subject, which represents that the text at the corresponding position is the head or tail of the place subject, if it is located in the subject tail extraction sequence, it belongs to the tail of the place subject, which represents that the text at the corresponding position is the tail of the place subject, according to the head and tail of the place subject, the place subject can be extracted, and the place subject is truly published.
[0067] Step S53, record the subject extraction result, compare the subject extraction result with the corresponding text sequence to get the error, and record the subject extraction result corresponding to the error as the error result.
[0068] Step S54, statistics of all error results, if the overall trend of the error result is biased to 1, the threshold value is adjusted from 0.5 to close to 1, if the overall trend of the error result is biased to 0, the threshold value is adjusted from 0.5 to close to 0. The overall trend of the error result can refer to the mode, mean and the like of all error results, and the adjustment of the threshold value includes fine tuning of the threshold value according to the need, and also includes adjusting the threshold value to the maximum or minimum value in the error result.
[0069] Example 3
[0070] Figure 2A structural schematic diagram of an electronic device is provided in the present embodiment. The electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the channel estimation method of Embodiment 1 or Embodiment 2 when executing the program. Figure 2 The electronic device 30 shown is merely an example and should not limit the functions and use range of the embodiments of the present application.
[0071] As shown in Figure 2 The electronic device 30 can be in the form of a general computing device, for example, it can be a server device. The components of the electronic device 30 can include, but are not limited to, the at least one processor 31, the at least one memory 32, and the bus 33 connecting different system components, including the memory 32 and the processor 31.
[0072] The bus 33 includes a data bus, an address bus, and a control bus.
[0073] The memory 32 can include volatile memory, such as random access memory (RAM) 321 and / or cache memory 322, and can further include non-volatile memory, such as read-only memory (ROM) 323.
[0074] The memory 32 can further include a program / utility 325 having a set (at least one) of program modules 324, such as an operating system, one or more application programs, other program modules, and program data, and each of these examples, or some combination thereof, can include implementation of a network environment.
[0075] The processor 31 performs various function applications and data processing by running the computer program stored in the memory 32, such as the channel estimation method of Embodiment 1 or Embodiment 2 of the present application.
[0076] The electronic device 30 can also communicate with one or more external devices 34 (such as a keyboard, a pointing device, etc.) via an input / output (I / O) interface 35. Furthermore, the model generating device 30 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 36. As shown, the network adapter 36 communicates with other modules of the model generating device 30 via the bus 33. It should be understood that although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model generating device 30, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Array of Independent Disks) systems, tape drives, and data backup storage systems, etc.
[0077] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, such a division is merely exemplary and not mandatory. Indeed, according to embodiments of the application, the features and functionalities of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functionalities of one unit / module described above can be further divided into embodied by a plurality of units / modules.
[0078] Embodiment 4
[0079] The embodiment provides a computer readable storage medium, which stores a computer program, the program is executed by a processor to implement the steps of the channel estimation method of the embodiment 1 or the embodiment 2.
[0080] More specifically, the readable storage medium can include, but is not limited to, a portable disc, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0081] In possible embodiments, the application can also be implemented in the form of a program product, which includes program codes for causing a terminal device to perform the steps of the channel estimation method of the embodiment 1 or the embodiment 2 when the program product is run on the terminal device.
[0082] The program codes for implementing the application can be written in any combination of one or more programming languages, and can be executed entirely on the user device, partially on the user device, as a standalone software package, partially on the user device and partially on a remote device, or entirely on a remote device.
[0083] Although the specific embodiments of the application are described above, those skilled in the art should understand that this is only an example, and the protection scope of the application is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of the application, and these changes and modifications all fall within the protection scope of the application.
[0084] Although the specific embodiments of the application are described above, those skilled in the art should understand that this is only an example, and the protection scope of the application is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of the application, and these changes and modifications all fall within the protection scope of the application.
Claims
1. A subject extraction method for opening and closing announcements of a site, characterized by, The opening and closing announcement includes a valid announcement and an invalid announcement, the valid announcement is related to the real opening and closing of the place, and the invalid announcement is not related to the real opening and closing information of the place, and the method specifically includes the following steps: S11, extracting text information of the place opening and closing announcement; S12, extracting a feature vector from the text information by using a pre-trained model; S13, training a first original model based on the feature vector to obtain a text binary classification model, and training a second original model based on the feature vector to obtain a subject extraction model, the text binary classification model can classify the announcement into the valid announcement and the invalid announcement, and the subject extraction model can extract the place subject; S14, identifying the type of the feature vector based on the text binary classification model, when the type of the feature vector corresponds to the valid announcement, the subject extraction model extracts the place subject from the text information as a subject extraction result, and when the type of the feature vector corresponds to the invalid announcement, the place subject extracted from the text information by the subject extraction model is not used as the subject extraction result.
2. The place opening and closing announcement subject extraction method according to claim 1, wherein Step S12 includes converting the text information into a fixed format text sequence suitable for subject extraction, and extracting the feature vector from the text sequence, specifically: Convert English letters to uppercase and lowercase; Convert Chinese traditional to Chinese simplified; Convert English punctuation marks to Chinese punctuation marks; Remove symbols meaningless to extract the feature vector; Truncate the text information to obtain the text sequence, so that the text length of the text sequence is within the preset length range of the pre-trained model; The truncation of the text information includes the case that there is repeated text between a plurality of text sequences; The text sequence includes valid marks, invalid marks and place subject marks.
3. The place opening and closing announcement subject extraction method according to claim 2, characterized by, The step of truncating the text information includes: Search for keywords corresponding to the place opening and closing information in the text information, and the context of the keywords is included in the truncated text sequence; for the text sequence not containing the keywords, the length after truncation is fixed.
4. The place opening and closing announcement subject extraction method according to claim 1, wherein The output end of the text binary classification model is provided with a first evaluation index, the output end of the subject extraction model is provided with a second evaluation index, the feature vector includes a test vector, and step S13 specifically includes: After the text binary classification model and the subject extraction model are trained by the feature vector, the test vector is used to test the text binary classification model and the subject extraction model, and after testing, if the test result of the text binary classification model does not reach the first evaluation index, or the test result of the subject extraction model does not reach the second evaluation index, the parameters of the unqualified model are adjusted, and the unqualified model is retrained; If the test result of the text binary classification model reaches the first evaluation index, it is determined that the text binary classification model can classify the announcement into the valid announcement and the invalid announcement; if the test result of the subject extraction model reaches the second evaluation index, it is determined that the subject extraction model can extract the place subject.
5. The place opening and closing announcement subject extraction method of claim 1, wherein, The specific steps of step S14 include: S51, combining the text binary classification model and the subject extraction model into a text binary classification and subject extraction combined model, the combined model including a text binary classification output end, a semantic output end, and a place subject output end; S52, the combined model judging whether the text information corresponding to the feature vector is the valid announcement, and outputting a classification result between x and y at the text binary classification output end, so that the classification result corresponding to the valid announcement is closer to x than the classification result corresponding to the invalid announcement; The combined model performs character-by-character recognition on the text information corresponding to the feature vector, so that each character corresponds to at least one semantic output result between x and y at the place subject output end, and the semantic output result corresponding to the character of the place subject is closer to x than the semantic output result corresponding to the character irrelevant to the place subject; S53, the subject extraction result being the product of each semantic output result and the corresponding classification result; S54, the place subject output end being provided with a threshold value, when the subject extraction result is greater than the threshold value, the text corresponding to the subject extraction result is the place subject of the valid announcement.
6. The place opening and closing announcement subject extraction method according to claim 5, wherein The setting step of the threshold value includes: S61, setting an initial threshold value between x and y, recording the subject extraction result, comparing the subject extraction result and the corresponding text sequence to obtain an error, and recording the subject extraction result corresponding to the error as an error result; S62, when the average of the error result is closer to y than the initial threshold value, the value of the threshold value is adjusted to be closer to y than the initial threshold value; when the average of the error result is closer to x than the initial threshold value, the value of the threshold value is adjusted to be closer to x than the initial threshold value; Step S62 includes directly adjusting the threshold value to the maximum or minimum value in the error result, and also includes adjusting the threshold value within the range of values x and y.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the subject extraction method of any one of claims 1-6.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the subject extraction method of any one of claims 1-6.