Text analysis method, device, electronic device and storage medium
By obtaining the part-of-speech, syntax and semantic annotation information of the text and combining it with the database sequence set to determine the text category, the problem of low efficiency in text information classification is solved, and efficient and accurate text classification is achieved.
Patent Information
- Application Number
- CN202110721016.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-28
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2041-06-28
AI Technical Summary
In the prior art, obtaining the overall evaluation information represented by text information under a certain topic takes a lot of time, and manual processing is inefficient and cannot be efficiently classified.
By obtaining the part-of-speech tagging information, syntactic tagging information and semantic tagging information of the text to be analyzed, combined with the superposition of feature word information, the sequence set in the target comprehensive database is used to determine the target part-of-speech combination sequence, syntactic dependency sequence and semantic dependency sequence, and the text category is determined based on probability information.
It achieves more accurate and efficient classification of text information, reduces manual processing time and improves processing efficiency.
Smart Images

Figure CN113822075B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology, and in particular to a text analysis method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of internet communication technology, text information generated by various industries is increasing. Text information on music, health, finance, technology, and agriculture is ubiquitous. However, text information on the same topic can fall into different categories. For example, if a text message is an evaluation of something, the category it describes can be positive, negative, or neutral.
[0003] For those who want to obtain the overall evaluation information expressed in the text information on a certain topic, it takes a lot of time to read and summarize, and human energy is often limited. If all the work is done manually, not only will a lot of time and resources be wasted, but the number of staff will be insignificant compared to the huge amount of text information. Summary of the Invention
[0004] To solve the problems of the prior art, embodiments of the present invention provide a text analysis method, device, electronic device, and storage medium. The technical solution is as follows:
[0005] In a first aspect, a text analysis method is provided to obtain a text to be analyzed;
[0006] Determine the part-of-speech tagging information, syntactic tagging information and semantic tagging information of the text to be analyzed;
[0007] Based on the characteristic words in the text to be analyzed, the part-of-speech tagging information, the syntactic tagging information and the semantic tagging information are respectively superimposed with characteristic word information to obtain target part-of-speech tagging information, target syntactic tagging information and target semantic tagging information with characteristic word information;
[0008] Based on the sequence set in the target comprehensive database, a target part-of-speech combination sequence is determined from the target part-of-speech tagging information, a target syntactic dependency sequence is determined from the target syntactic tagging information, and a target semantic dependency sequence is determined from the target semantic tagging information;
[0009] Based on the target comprehensive database, the probability information of the target part-of-speech combination sequence, the target syntactic dependency sequence, the target semantic dependency sequence and the feature words in the text to be analyzed are determined respectively, and the category information of the text to be analyzed is determined according to the profile information.
[0010] In a second aspect, a text analysis device is provided, the device comprising:
[0011] A text acquisition module is used to obtain the text to be analyzed;
[0012] A first tagging information determination module is used to determine the part-of-speech tagging information, syntactic tagging information and semantic tagging information of the text to be analyzed;
[0013] The second tagging information determination module is used to superimpose the feature word information on the part-of-speech tagging information, the syntactic tagging information and the semantic tagging information based on the feature words in the text to be analyzed, so as to obtain the target part-of-speech tagging information, the target syntactic tagging information and the target semantic tagging information with the feature word information;
[0014] A sequence determination module is used to determine a target part-of-speech combination sequence from the target part-of-speech tagging information, a target syntactic dependency sequence from the target syntactic tagging information, and a target semantic dependency sequence from the target semantic tagging information based on the sequence set in the target comprehensive database;
[0015] The type information determination module is used to determine the target part-of-speech combination sequence, target syntactic dependency sequence, target semantic dependency sequence and probability information of feature words in the text to be analyzed based on the target comprehensive database, and determine the category information to which the text to be analyzed belongs based on the profile information.
[0016] In a third aspect, a computer-readable storage medium is provided, in which at least one instruction or at least one program is stored. The at least one instruction or at least one program is loaded and executed by a processor to implement the text analysis method as described in the first aspect above.
[0017] In a fourth aspect, a computer program product or computer program is provided. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the text analysis method provided in the first aspect.
[0018] The embodiment of the present invention superimposes feature word information on part-of-speech tagging information, syntactic tagging information, and semantic tagging information based on feature words in the text to be analyzed, thereby obtaining target part-of-speech tagging information, target syntactic tagging information, and target semantic tagging information with feature word information; based on a sequence set in a target comprehensive database, a target part-of-speech combination sequence is determined from the target part-of-speech tagging information, a target syntactic dependency sequence is determined from the target syntactic tagging information, and a target semantic dependency sequence is determined from the target semantic tagging information; based on the target comprehensive database, the target part-of-speech combination sequence, target syntactic dependency sequence, target semantic dependency sequence, and probability information of the feature words in the text to be analyzed are determined, and the category information to which the text to be analyzed belongs is determined based on the profile information. The above method constructs a fine-grained analysis based on probability values by fusing feature words and multi-dimensional features (part-of-speech combination sequence, syntactic dependency sequence, semantic dependency sequence), thereby obtaining a more accurate and easier to interpret category information determination method, which has high practical value and reference significance. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention;
[0021] Figure 2 1 is a flow chart of a text analysis method provided by an embodiment of the present invention;
[0022] Figure 3 1 is a flow chart of a method for determining annotation information provided by an embodiment of the present invention;
[0023] Figure 4 is a schematic diagram of a syntax annotation provided by an embodiment of the present invention;
[0024] Figure 5 is a schematic diagram of semantic annotation provided by an embodiment of the present invention;
[0025] Figure 6 This is a flow chart of a method for determining annotation information provided by an embodiment of the present invention;
[0026] Figure 7 Schematic diagram of a feature word encoding method provided by an embodiment of the present invention;
[0027] Figure 8This is a structural block diagram of a text analysis device provided by an embodiment of the present invention;
[0028] Figure 9 This is a hardware structure block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar texts and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] See also Figure 1 , which shows a schematic diagram of an implementation environment provided by an embodiment of the present invention, the implementation environment may include a client 100 and a server 110, wherein after the server 110 receives the text to be analyzed uploaded by the client 100, it can judge the category information of the text to be analyzed, and finally obtain the category information to which the text to be analyzed belongs.
[0032] Among them, server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms. The present invention does not impose any restrictions on this.
[0033] Cloud computing is a computing model that distributes computing tasks across a resource pool consisting of a large number of computers, enabling various application systems to access computing power, storage space, and information services as needed. The network that provides these resources is called the "cloud." To users, these resources appear infinitely scalable and can be accessed at any time, used on demand, expanded at any time, and paid for on a per-use basis. As a provider of cloud computing infrastructure capabilities, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established. Various types of virtual resources will be deployed in the resource pool for external customers to choose from. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices. According to logical functional division, the PaaS (Platform as a Service) layer can be deployed on the IaaS (Infrastructure as a Service) layer, and the SaaS (Software as a Service) layer can be deployed on the PaaS layer. SaaS can also be deployed directly on IaaS. PaaS is a platform for software operation, such as databases and web containers. SaaS is a variety of business software, such as web portals and SMS mass senders. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.
[0034] Optionally, the server 101 can obtain the text to be analyzed, determine the part-of-speech tagging information, syntactic tagging information and semantic tagging information of the text to be analyzed, and superimpose the feature word information of the part-of-speech tagging information, syntactic tagging information and semantic tagging information based on the feature words in the text to be analyzed, to obtain target part-of-speech tagging information, target syntactic tagging information and target semantic tagging information with feature word information, and based on the sequence set in the target comprehensive database, determine the target part-of-speech combination sequence from the target part-of-speech tagging information, determine the target syntactic dependency sequence from the target syntactic tagging information, and determine the target semantic dependency sequence from the target semantic tagging information; based on the target comprehensive database, determine the target part-of-speech combination sequence, target syntactic dependency sequence, target semantic dependency sequence and the probability information of the feature words in the text to be analyzed, and determine the category information to which the text to be analyzed belongs according to the profile information.
[0035] The client 100 may be a device that transmits the text to be analyzed. Optionally, the client 100 includes, but is not limited to, electronic devices such as smartphones, desktop computers, tablet computers, laptop computers, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, and smart wearable devices. It may also be software running on these electronic devices, such as applications and applets. Optionally, the operating system running on the electronic device may include, but is not limited to, Android, iOS, Linux, Windows, Unix, and the like.
[0036] See also Figure 2 , Figure 2 The figure shows a flow chart of a text analysis method provided by an embodiment of the present invention, which can be applied to Figure 1 The system shown. It should be noted that this specification provides method operation steps as described in the embodiments or flow charts, but more or fewer operation steps may be included based on conventional or non-creative work. The order of steps listed in the embodiments is only one way of executing the steps among many steps, and does not represent the only execution order. When the actual system or product is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, in a parallel processor or multi-threaded processing environment). Specifically, Figure 2 As shown, the method can be executed on a server, and can also be applied to other node devices and edge devices. The above method may include:
[0037] S201: Obtain the text to be analyzed.
[0038] In an embodiment of the present application, the server can obtain a text to be analyzed from the client. The text to be analyzed can be a review text edited by the user to which the client belongs. For example, it can be a review text of the service of a store on an e-commerce platform, a review text of a product, a recommendation text of an article on an information platform, an analysis text of stocks on a financial platform, and so on. For example, the text to be analyzed is a review text of the service of a store on an e-commerce platform, which is "The service attitude is very good, I will come again next time." The following will use the above example to illustrate the implementation plan of the full text.
[0039] S203: Determine the part-of-speech tagging information, syntactic tagging information, and semantic tagging information of the text to be analyzed.
[0040] In the embodiment of the present application, in order to prepare for obtaining more accurate category information, the server may analyze the text to be analyzed from one dimension or multiple dimensions.
[0041] Optionally, the server may determine one of the part-of-speech tagging information, syntactic tagging information, and semantic tagging information of the text to be analyzed. Alternatively, the server may determine any two of the part-of-speech tagging information, syntactic tagging information, and semantic tagging information of the text to be analyzed. Alternatively, the server may determine the part-of-speech tagging information, syntactic tagging information, and semantic tagging information of the text to be analyzed.
[0042] Optionally, taking the example of the server being able to determine the part-of-speech tagging information, syntactic tagging information, and semantic tagging information of the text to be analyzed, and combining the above example "The service attitude is very good, I will come again next time" for specific explanation, Figure 3 FIG. 1 is a flow chart of a method for determining annotation information provided by an embodiment of the present invention, including:
[0043] S301: Perform word segmentation and part-of-speech tagging on the text to be analyzed to obtain part-of-speech tagging information.
[0044] Optionally, the server can perform word segmentation on the text to be analyzed. For example, the server can segment the text "The service attitude is quite good, I will come again next time" into the words "service", "attitude", "quite", "good", "next time", "still", "will", and "come". After word segmentation, the server can perform part-of-speech tagging on the above words.
[0045] Optionally, in order to maintain the uniformity of part-of-speech tagging, the embodiment of the present application can uniformly tag nouns as n, verbs as v, adjectives as a, and punctuation marks as wp... Of course, in addition to the above-mentioned part-of-speech tagging method, there can also be other methods. For example, for more detailed tagging, nouns can be tagged separately according to different types of nouns, such as marking time nouns as nt. Other types of nouns also have other tagging symbols.
[0046] In this way, we can get the corresponding tagging information "service / nattitude / nquite / dgood / a, / wpnwill / vcome / v next time" in "the service attitude is pretty good, I will come again next time", and then get the corresponding part-of-speech tagging information " / n / n / d / a / wp / n / d / v / v".
[0047] S303: Perform syntactic analysis on the text to be analyzed to obtain syntactic annotation information.
[0048] In the embodiment of the present application, the syntactic analysis process is actually the analysis of the sentence structure of the text to be analyzed, such as the subject-predicate relationship, the verb-object relationship, the parallel relationship, etc.
[0049] Optionally, to maintain uniformity in syntactic annotation, the server can annotate subject-verb relationships as SBV, verb-object relationships as VOB, and parallel relationships as COO. Figure 4The figure shows a schematic diagram of syntactic annotation provided by an embodiment of the present invention. As shown in the figure, when performing sequence conversion, the sequence is first annotated from front to back. Among them, there are two syntactic relationships to "Blue and White Porcelain", including ATT (modifier-head relationship) and RAD (right adjunct relationship). Then, following the principle of "far first and near later", ATT is the syntactic relationship between "Blue and White Porcelain" and "composing music", and RAD is the syntactic relationship between "Blue and White Porcelain" and "of". Therefore, the ATT relationship is farther than the RAD relationship and is placed in front. According to this principle, the syntactic annotation information converted from the entire syntactic relationship sequence is: HED ATT RAD SBV VOB.
[0050] According to the above syntactic processing and analysis, the syntactic annotation information "HED ATT SBV ADV COO WP ADV ADVADV" of "The service attitude is very good and I will come again next time" can be obtained.
[0051] S305: Perform semantic dependency analysis processing on the text to be analyzed to obtain semantic annotation information.
[0052] In the embodiment of the present application, syntax is the basis and necessary condition for a sentence to be formed. A sentence that conforms to syntax is a correct sentence. However, just because a sentence is syntactically correct does not mean that others can understand what you are saying. It also needs to clearly express the semantics, that is, the meaning of the discourse.
[0053] Based on this, the server can perform semantic dependency analysis processing on the text to be analyzed, or call a semantic analysis tool to perform semantic dependency analysis processing on the text to be analyzed to obtain semantic annotation information.
[0054] In this way, the following can be obtained Figure 5 The shown semantic annotation schematic diagram: The semantic annotation information "RootFEAT EXP mDEPDeSUCCmPUNC TIMEmDEPDmDEPD" of "The service attitude is very good and I will come again next time", the semantic annotation information "RooteSUCCeSUCCmPUNC LOC#FEAT#EXP&mDEPD*mDEPD" of "Staying at Marriott, the hotel's cost performance is really quite high" can be obtained, and the semantic annotation information "Root#FEAT#EXP mDEPD&mDEPD*mPUNCmDEPDmDEPD MEAS" of "The hotel rooms are still very good and worth recommending" can be obtained.
[0055] The above analysis of the text to be analyzed based on three dimensions is only an optional embodiment. Of course, it can also include analysis of other dimensions, thereby providing more reference information for subsequent analysis.
[0056] S205: Superimposing the feature word information on the part-of-speech tagging information, the syntactic tagging information and the semantic tagging information based on the feature words in the text to be analyzed, to obtain target part-of-speech tagging information, target syntactic tagging information and target semantic tagging information with the feature word information.
[0057] In the embodiment of the present application, different analysis methods can be used for different texts. For example, the service for a certain store can focus on fine-grained sentiment analysis intent, while the market value of a certain company in a certain financial market can focus on fine-grained objective facts. Based on this, the server can determine the characteristic words in the text to be analyzed, that is, the key words centered on the analysis intent. Optionally, the characteristic words in the text to be analyzed can be determined based on the analysis intent.
[0058] Figure 6 FIG. 1 is a flow chart of a method for determining annotation information provided by an embodiment of the present invention, including:
[0059] S601: Determine the analysis intent corresponding to the text to be analyzed.
[0060] Optionally, the server may determine the analysis intent corresponding to the text to be analyzed based on the desired analysis result corresponding to the text to be analyzed. For example, if the analysis result determines that the text to be analyzed is positive or negative, the analysis intent corresponding to the text to be analyzed is determined to be a sentiment analysis intent.
[0061] S603: Determine a target feature vocabulary based on the analysis intention.
[0062] Optionally, the server may determine a target feature word library based on a determined analysis intent, such as the sentiment analysis intent described above. The target feature word library may be pre-built, and different feature words may be mined over time and added to the target feature word library.
[0063] In the embodiment of the present application, taking sentiment analysis intent as an example, the target feature vocabulary may include at least attribute words, sentiment words, degree adverbs, negation words, etc. For example, attribute words may include "service", "attitude", "hotel", "price / performance ratio"... Sentiment words may include "good", "high", "excellent"..., degree adverbs may include "very", "very", "extremely"..., and negation words may include "not", "not"...
[0064] S605: Determine the feature words in the text to be analyzed from the target feature word library.
[0065] Optionally, the server can determine the feature words in the text to be analyzed from the target feature vocabulary. For example, the server can determine the feature words in the text to be analyzed "The service attitude is pretty good, I will come again next time" from the target feature vocabulary as "service", "attitude", "pretty" and "good".
[0066] S607: Determine the marking symbol corresponding to the feature word according to the preset feature word marking symbol.
[0067] Optionally, the server can determine that "service", "attitude", "barbaric" and "good" correspond to attribute words, attribute words, degree adverbs and emotional words respectively, and determine the marking symbol of attribute words as #, the marking symbol of degree adverbs as &, and the marking symbol of emotional words as * according to the preset feature word marking symbols... Among them, the marking symbols corresponding to each type of words can be preset.
[0068] In this way, the server can obtain the feature words "service", "attitude", "barbaric" and "good" as "#", "#", "&" and "*".
[0069] S609: superimposing the feature word information on the part-of-speech tagging information, the syntactic tagging information and the semantic tagging information respectively using the tagging symbols corresponding to the feature words to obtain target part-of-speech tagging information, target syntactic tagging information and target semantic tagging information with the feature word information.
[0070] In an embodiment of the present application, the server can use the marking symbols corresponding to the feature words to superimpose the feature word information on the part-of-speech tagging information, syntactic tagging information and semantic tagging information respectively, and obtain the target part-of-speech tagging information, target syntactic tagging information and target semantic tagging information with the feature word information.
[0071] So, we get:
[0072] Target part-of-speech tagging information: # / n# / n& / d* / a / wp / n / d / v / v;
[0073] Target syntax annotation information: HED#ATT#SBV&ADV*COO WP ADV ADVADV;
[0074] Target semantic annotation information: Root#FEAT#EXP&mDEPD*eSUCCmPUNC TIMEmDEPDmDEPD.
[0075] S207: Based on the sequence set in the target comprehensive database, determine a target part-of-speech combination sequence from the target part-of-speech tagging information, determine a target syntactic dependency sequence from the target syntactic tagging information, and determine a target semantic dependency sequence from the target semantic tagging information.
[0076] In an embodiment of the present application, the target comprehensive database is the analysis cornerstone of the subsequent text to be analyzed. Generally speaking, it can contain multiple sample texts, such as 100,000 sample texts, and the sample texts are all focused on the intention of sentiment analysis. Optionally, each sample text can carry its own category information. If the category information is based on two categories, each sample text can carry category information of "1" or "-1", where "1" means "commendation" and "-1" means "derogatory". Optionally, if it is based on three categories, it can carry category information of "1", "0" or "-1", where "1" means "commendation", "-1" means "derogatory", and "0" means "neutral".
[0077] In an optional embodiment, taking binary classification as an example, 100,000 sample texts in the target comprehensive database can be manually annotated with category information, and then the target part-of-speech tagging information, target syntactic tagging information and target semantic tagging information of each of the 100,000 sample texts can be obtained using all the upper or lower technical solutions involved in the above steps S201-S205.
[0078] Taking three sample texts from the 100,000 sample texts, "The product quality is quite good, I will come again next time", "I stayed at Marriott, the hotel price-performance ratio is really high", and "The hotel room is still very good, worth recommending", as examples, using all the upper and lower technical solutions involved in steps S201-S205 above, we can obtain the following:
[0079] The target part-of-speech tagging information is:
[0080] # / n# / n& / d* / a / wp / n / d / v / v,
[0081] / v / v / n / wp# / n# / n / a& / d* / a,
[0082] # / n# / n / d& / d* / a / u / wp / v / v / m.
[0083] The target syntax annotation information is:
[0084] HED#ATT#SBV&ADV*COO WP ADV ADVADV,
[0085] HED COO WP COO VOB#ATT#SBV&ADV*ADV,
[0086] HED#ATT#SBV VOB VOB&ADV*WP RAD ADV CMP.
[0087] The target semantic annotation information is:
[0088] Root#FEAT#EXP&mDEPD*eSUCCmPUNC TIMEmDEPDmDEPD,
[0089] RooteSUCCeSUCCmPUNC LOC#FEAT#EXP&mDEPD*mDEPD,
[0090] Root#FEAT#EXP mDEPD&mDEPD*mPUNCmDEPDmDEPD MEAS.
[0091] The above three sample texts are just examples. In actual situations, the operation will be performed on 100,000 sample texts.
[0092] In this embodiment of the present application, in order to mine the common patterns among the 100,000 sample texts and prepare for the subsequent identification of the category information of the samples to be analyzed, the present application can use an algorithm for mining data association rules to mine the common patterns among the 100,000 sample texts. Optionally, the algorithm for mining data association rules can include the Apriori algorithm, the FTtree algorithm, or the prefixspan algorithm, etc.
[0093] The following will take the prefixspan algorithm as an example and analyze it in combination with the above three sample texts:
[0094] Optionally, the first step can be to analyze the mining relationship of the target part-of-speech tag information:
[0095] Based on the prefixspan algorithm, the frequent sequence patterns of part-of-speech tagging sequences with feature word category labels are mined, and the target part-of-speech tagging information is used as the mining text. At the same time, the multiple minimum support strategy is used, and the calculation method of the minimum support is shown in formula (1).
[0096] min_sup=a×n (1)
[0097] Where n is the number of part-of-speech sequence samples mined, a is the minimum support rate, and the minimum support rate parameter is adjusted according to the number of part-of-speech sequence sample sets.
[0098] The specific steps of the algorithm are as follows:
[0099] (1) Find the context sequence prefix and corresponding projection dataset of the part-of-speech sequence element with a unit length of 1;
[0100] (2) Count the frequencies of prefixes in the context sequence where the part-of-speech sequence elements are located and add prefixes whose support is higher than the minimum support threshold to the dataset to obtain the frequent item set sequence pattern;
[0101] (3) Recursively mine all prefixes of length i that meet the minimum support requirement:
[0102] (4) Mining the prefix projection data set, if the projection data is an empty set, return to recursion;
[0103] (5) Calculate the minimum support of each item in the corresponding projected data set, merge each item that meets the support requirement with the current prefix to obtain a new prefix, and recursively return if it does not meet the support requirement;
[0104] (6) Let i = i + 1, prefix be the new prefix after merging the single items, and recursively execute step 3 respectively;
[0105] (7) Finally, all frequent sequence patterns in the context sequence sample set where the part-of-speech sequence element is located are returned.
[0106] The above is a description of the principle of the Prefixspan algorithm. The following example illustrates the specific mining process. The target part-of-speech tagging information text is:
[0107] Target part-of-speech tagging information text # / n# / n& / d* / a / wp / n / d / v / v / v / v / n / wp# / n# / n / a& / d* / a # / n# / n / d& / d* / a / u / wp / v / v / m
[0108] Step 1: Use the Prefixspan algorithm to mine the sequence patterns contained in the context of the part-of-speech sequence elements. Assuming that the minimum support rate threshold is set to 0.5, first count the number of occurrence samples of all part-of-speech sequence elements. For example, / n appears in all three target part-of-speech tagging information texts, so the number of occurrence samples is 3. / m appears in the last target part-of-speech tagging information text among the three target part-of-speech tagging information texts, so the number of occurrence samples is 1. And so on, the final presentation is:
[0109]
[0110]
[0111] Filter out the part-of-speech sequence elements that do not meet the preset support rate threshold. The minimum support rate threshold set is 0.5. That is, the part-of-speech sequence elements must appear in at least two samples among the above three samples to meet the support rate threshold. Therefore, the two part-of-speech sequence elements / u and / m can be filtered out. The final threshold filtered sample is:
[0112] Single item support threshold filtering results # / n# / n& / d* / a / wp / n / d / v / v / v / v / n / wp# / n# / n / a& / d* / a # / n# / n / d& / d* / a / wp / v / v
[0113] Step 2: Continue mining based on the sequential pattern algorithm. In each iteration, only prefixes and suffixes containing the feature words to be mined are retained. For example, mining fine-grained emotions requires sequence samples with the mark symbol * (emotional words) and the mark symbol # (attribute words) in the context. Construct a prefix and its corresponding suffix for the part-of-speech sequence elements that meet the threshold. The result is:
[0114]
[0115] Step 3: Taking a prefix of " / n" as an example, continue to mine two prefixes and corresponding suffixes that meet the minimum support threshold:
[0116]
[0117]
[0118] Step 3: Taking the binary prefix "# / n# / n" as an example, continue to mine the three prefixes and corresponding suffixes that meet the minimum support threshold:
[0119]
[0120] Step 4: Taking the three prefixes "# / n# / n& / d" as an example, continue to mine the four prefixes and corresponding suffixes that meet the minimum support threshold:
[0121]
[0122] Step 5: Continue to mine the five prefixes and corresponding suffixes that meet the minimum support threshold:
[0123]
[0124] Step 6: Continue to mine the six prefixes and corresponding suffixes that meet the minimum support threshold:
[0125]
[0126]
[0127] Step 7: Continue to mine seven prefixes and corresponding suffixes that meet the minimum support threshold:
[0128] Seven prefixes Corresponding suffix # / n# / n& / d* / a / wp / v / v
[0129] At this point, the iteration ends, and the inclusion relationship judgment is performed on the sequence patterns of various lengths mined, and sub-pattern filtering is performed.
[0130] If all the item sets of a sequence A can be found in the item sets of sequence B, then A is a subsequence of B. According to this definition, for a sequence A={a1,a2,...a n} and sequence B={b1,b2,...b m}, n≤m, if there exists a sequence of numbers 1≤j1≤j2≤...≤j n ≤m, satisfying Then A is said to be a subsequence of B. Conversely, B is a supersequence of A. For each frequent word / character sequence mined, if the supersequence itself contains more reference information, that is, the supersequence contains contextual auxiliary words that are not included in the subsequence, the supersequence is retained as the pattern and the subsequence is deleted.
[0131] Taking the supersequence "# / n# / n& / d* / a / wp / v / v" and the subsequence "# / n# / n& / d* / a / wp / v" as an example, the supersequence also contains " / v" on top of the subsequence, so the supersequence pattern "# / n# / n& / d* / a / wp / v / v" is retained, and the subsequence pattern is deleted. The final mined frequent part-of-speech sequence pattern is as follows:
[0132] Part-of-speech combination sequence pattern # / n# / n& / d* / a / wp / v / v
[0133] Similarly, other grammatical relationship sequences are mined in the same way to obtain the sentiment sequence patterns corresponding to each grammatical relationship in the feature word context. The construction result example is as follows:
[0134]
[0135] As can be seen, the above part-of-speech combination sequence pattern # / n# / n& / d* / a / wp / v / v is the final supersequence pattern of the three sample texts, which contains many subsequences. The above supersequence pattern is only one of the supersequence patterns presented in the three sample texts. Other supersequence patterns can be presented in the same way as above, so I will not elaborate on them here.
[0136] Similarly, the syntactic dependency sequence pattern HED#ATT#SBV&ADV* is the final supersequence pattern for the three sample texts, which contains many subsequences. The above supersequence pattern is just one of the supersequence patterns presented in the three sample texts. Other supersequence patterns can be presented in the same way as above, so I will not elaborate on them here.
[0137] Similarly, the semantic dependency sequence pattern Root#FEAT#EXP&mDEPD* is the final supersequence pattern of the three sample texts, which contains many subsequences. The above supersequence pattern is just one of the supersequence patterns presented in the three sample texts. Other supersequence patterns can be presented in the same way as above, so I will not elaborate on them here.
[0138] In an embodiment of the present application, the target comprehensive database includes a first target database, a second target database, and a third target database. The sequence set includes a part-of-speech combination sequence set, a syntactic dependency sequence set, and a semantic dependency sequence set. The part-of-speech combination sequence set includes a supersequence obtained by different part-of-speech combinations and a subsequence under the supersequence, the syntactic dependency sequence set includes a supersequence obtained by different grammatical combinations and a subsequence under the supersequence, and the semantic dependency sequence set includes a supersequence obtained by different semantic combinations and a subsequence under the supersequence.
[0139] Optionally, the above-mentioned target comprehensive database can be stored in a server, wherein the server can be a separate server, a cloud server, or even presented as a service storage node in the form of a blockchain.
[0140] Blockchain is a new application model for computer technologies, including distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a series of data blocks linked using cryptographic methods. Each block contains information about a batch of online transactions, used to verify the validity of that information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product and service layer, and the application service layer.
[0141] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operation monitoring. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the corresponding relationship between the user's real identity and the blockchain address (authority management), etc., and under authorization, it supervises and audits the transactions of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records the valid requests to the storage after consensus is reached. For a new business request, the basic service first adapts the interface to parse and authenticate the request (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration, issuance, triggering and execution of contracts. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the contract logic is triggered by calling keys or other events to trigger execution. The contract logic is completed, and the contract upgrade and cancellation functions are also provided. The operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarms, network status monitoring, and node device health monitoring.
[0142] The platform's product service layer provides the basic capabilities and implementation framework for typical applications. Developers can build on these basic capabilities, overlay business features, and complete the blockchain implementation of business logic. The application service layer provides application services based on blockchain solutions for business participants to use.
[0143] In some possible embodiments, the first target database may include a set of part-of-speech combination sequences and 100,000 sample texts; the second target database may include a set of syntactic dependency sequences and 100,000 sample texts; and the third target database may include a set of semantic dependency sequences and 100,000 sample texts.
[0144] Optionally, the server may determine a target part-of-speech combination sequence from the target part-of-speech tagging information based on the part-of-speech combination sequence set in the first target database. That is, the server may determine a part-of-speech combination sequence in the part-of-speech combination sequence set in the first target database whose matching degree with the target part-of-speech tagging information satisfies a first preset condition as a target part-of-speech combination sequence. Wherein, satisfying the first preset condition may mean that the target part-of-speech combination sequence may be the longest group of corresponding part-of-speech combinations in the part-of-speech combination sequence set (for example, the corresponding part-of-speech combinations may include # / n, # / n# / n, # / n& / d, # / n* / a, # / n# / n& / d, # / n# / n& / d* / a, and the longest group is # / n# / n& / d* / a).
[0145] Optionally, the server may determine the target syntactic dependency sequence from the target syntactic annotation information based on the syntactic dependency sequence set in the second target database. That is, the server may determine the syntactic dependency sequence in the syntactic dependency sequence set in the second target database, whose matching degree with the target syntactic annotation information satisfies the second preset condition, as the target syntactic dependency sequence. Here, satisfying the second preset condition may mean that the target syntactic dependency sequence may be the longest group of corresponding syntactic combinations in the syntactic combination sequence set.
[0146] Optionally, the server may determine the target semantic dependency sequence from the target semantic annotation information based on the semantic dependency sequence set in the third target database. That is, the server may determine the semantic dependency sequence in the semantic dependency sequence set in the third target database, whose matching degree with the target semantic annotation information satisfies the third preset condition, as the target semantic dependency sequence. Here, satisfying the third preset condition may mean that the target semantic combination sequence may be the longest group of corresponding semantic combinations in the semantic combination sequence set.
[0147] The reason why the target part-of-speech combination sequence described above can be the longest group of corresponding part-of-speech combinations in the part-of-speech combination sequence set, the target syntactic dependency sequence can be the longest group of corresponding syntactic combinations in the syntactic combination sequence set, and the target semantic combination sequence can be the longest group of corresponding semantic combinations in the semantic combination sequence set is because only when the target semantic combination sequence, the target syntactic dependency sequence or the target semantic combination sequence is longer can more similar ones be found from 100,000 sample texts.
[0148] Optionally, the target comprehensive database also includes a fourth target database, which may include feature words in each sample text and 100,000 sample texts. For example, the feature word of "The product quality is quite good, I will come again next time" is "The product quality is quite good", and the feature word of "Staying at Marriott, the hotel is really cost-effective" is "The hotel is really cost-effective".
[0149] S209: Based on the target comprehensive database, determine the probability information of the target part-of-speech combination sequence, the target syntactic dependency sequence, the target semantic dependency sequence and the feature words in the text to be analyzed, and determine the category information of the text to be analyzed based on the profile information
[0150] Optionally, the server can determine the first probability information of the target part-of-speech combination sequence based on the probability information in the target comprehensive database, determine the second probability information of the target syntactic dependency sequence, determine the third probability information of the target semantic dependency sequence, and determine the fourth probability information of the feature words in the text to be analyzed.
[0151] Specifically, the server can determine the first probability information of the target part-of-speech combination sequence based on the first target database, determine the second probability information of the target syntactic dependency sequence based on the second target database, determine the third probability information of the target semantic dependency sequence based on the third target database, and determine the fourth probability information of the feature words in the text to be analyzed based on the fourth target database.
[0152] In the embodiment of the present application, in order to facilitate machine calculation, each part-of-speech combination sequence in the part-of-speech combination sequence set included in the first target data may be encoded.
[0153] Optionally, it can be encoded as follows:
[0154] Part-of-speech encoding Part of speech name Dictionary encoding Part-of-speech encoding Part of speech name Dictionary encoding Ag Morphemes 000001 ns Place name 010101 a adjective 000010 nt Institutions and Groups 010110 ad Adverbials 000011 nz Other proper names 010111 an noun-adjective 000100 o Onomatopoeia 011000 b Distinguishing words 000101 p preposition 011001 c conjunction 000110 q quantifier 011010 dg adverbial morphemes 000111 r pronoun 011011 d adverb 001000 s Place words 011100 e interjection 001001 tg tense morphemes 011101 f Directional words 001010 t Time Words 011110 g Morphemes 001011 u particle 011111 h Preceding component 001100 vg verb morpheme 100000 i idiom 001101 v verb 100001 j Abbreviations 001110 vd Adverbs 100010 k Followed by components 001111 vn Noun Verb 100011 l Idioms 010000 w Punctuation 100100 m numeral 010001 x Non-morpheme words 100101 Ng Noun morphemes 010010 y modal particles 100110 n noun 010011 z Status Word 100111 nr Name 010100 un Unknown word 101000
[0155] Each syntactic dependency sequence in the syntactic dependency sequence set included in the second target data may be encoded.
[0156] Optionally, it can be encoded as follows:
[0157] Dependency Encoding Type Name Dictionary encoding SBV Subject-predicate relationship 0001 VOB Verb-Object Relationship 0010 IOB Interpersonal relationship 0011 FOB preposed object 0100 DBL Jianyu 0101 ATT Central-South relationship 0110 ADV mid-body structure 0111 CMP Verb-complement structure 1000 COO Parallel relationship 1001 POB prepositional relationship 1010 LAD Left-attached relation 1011 RAD Right-attached relation 1100 IS Independent structure 1101 HED Core Relationships 1110
[0158] Similarly, the semantic dependency sequence set included in the third target data can also be encoded, and the feature words in each sample text included in the fourth target database can also be encoded according to word vectors or character vectors.
[0159] For example, Figure 7 A schematic diagram of a feature word encoding method provided by an embodiment of the present invention includes constructing feature words in each sample text based on characters and words.
[0160] Optional, such as Figure 7 As shown in (a) in the figure, the encoding of feature words can be constructed in units of words. Assuming that "the position is very close" can be split into three words: "position", "very" and "near", each word can be encoded according to the preset dimension. Assuming the dimension is 300 dimensions, "position" can be converted into the first encoding of 300 dimensions, "very" can be converted into the second encoding of 300 dimensions, and "near" can be converted into the third encoding of 300 dimensions.
[0161] Optional, such as Figure 7 As shown in (b) in the figure, the encoding of feature words can be constructed in units of characters. Assuming that "the position is very close" can be split into four characters "position", "place", "very" and "near", each character can be encoded according to the preset dimension. Assuming the dimension is 300 dimensions, "position" can be converted into the first encoding of 300 dimensions, "place" can be converted into the second encoding of 300 dimensions, "very" can be converted into the third encoding of 300 dimensions, and "near" can be converted into the fourth encoding of 300 dimensions.
[0162] Optional, such as Figure 7 As shown in (c) in the figure, the encoding of feature words can be constructed based on the splicing structure of words and characters. Assuming that "position" can be split into two splicing structures: "position" + "bit", and "position" + "placement", and assuming that the total dimension is 300 dimensions, we can get the encoding of "position" with 200 dimensions + "bit" with 100 dimensions as shown in the figure, and the encoding of "position" with 200 dimensions + "placement" with 100 dimensions.
[0163] In this way, the embodiment of the present application can determine the first probability information of the encoded target part-of-speech combination sequence based on the first target database, determine the second probability information of the encoded target syntactic dependency sequence based on the second target database, determine the third probability information of the encoded target semantic dependency sequence based on the third target database, and determine the fourth probability information of the encoded feature words in the text to be analyzed based on the fourth target database.
[0164] Specifically, the server determines first probability information of the target part-of-speech combination sequence based on the first target database, which can be expressed as follows: based on the total amount of sample texts in the first target database (assuming 100,000), determining a first ratio of 0.2 between the total amount of first sample texts (that is, each text in the first sample text has this target part-of-speech combination) corresponding to the target part-of-speech combination sequence and the total amount of sample texts (100,000), determining a second ratio of 0.5 between the total amount of second sample texts corresponding to preset category information (commendatory) (50,000) and the total amount of sample texts (100,000), and determining a third ratio of 0.38 for the sample texts corresponding to the target part-of-speech combination sequence (19,000) in the total amount of the second sample texts (50,000). The first probability information is determined based on the first ratio, the second ratio, and the third ratio, which can be understood as being determined based on the quotient of 0.95, which is the product of 0.19 of the second ratio and the third ratio and 0.2.
[0165] Similarly, the second probability information of the encoded target syntactic dependency sequence determined based on the second target database, the third probability information of the encoded target semantic dependency sequence determined based on the third target database, and the fourth probability information of the feature words in the encoded text to be analyzed determined based on the fourth target database can all be determined by the server by referring to the first probability information of the target part-of-speech combination sequence determined based on the first target database, and will not be repeated here.
[0166] In an optional embodiment, the server can determine the target probability information belonging to the preset category information based on the above-mentioned first probability information, second probability information, third probability information and fourth probability information. If the target probability information is within the probability range, it is determined that the category information to which the text to be analyzed belongs is the preset category information.
[0167] Specifically, the server can determine the target probability information belonging to the preset category information based on the product of the first probability information, the second probability information, the third probability information and the fourth probability information, assuming it is 0.8. If the target probability information (probable probability information) is within the probability range (0.6-1), it is determined that the category information to which the text to be analyzed belongs is the preset category information (positive).
[0168] Optionally, the obtained text to be analyzed and its determined category information can also be added to the original sample text as a new sample, so that the entire database can be iterated based on the latest sample text. In this way, the scalability and generalization capabilities of the embodiment of the present application are well reflected.
[0169] The above method determines the first probability information of the target part-of-speech combination sequence based on the probability information in the target comprehensive database, determines the second probability information of the target syntactic dependency sequence, determines the third probability information of the target semantic dependency sequence, determines the fourth probability information of the feature words in the text to be analyzed, and determines the category information to which the text to be analyzed belongs based on the first probability information, the second probability information, the third probability information and the fourth probability information. It can be understood that the calculation is performed according to the Bayesian model. In fact, it is a change in the calculation formula based on the Bayesian model, which makes the calculation simpler and more intuitive.
[0170] For a given input feature Q, P(Q) is the probability of the input feature Q. Specifically, in this embodiment, it is the probability q1 that the text to be classified contains the feature words in the text to be analyzed, the probability q2 of the target part-of-speech combination sequence, the probability q3 of the target syntactic dependency sequence, and the probability q4 of the target semantic dependency sequence. Assuming that the preset category information - commendatory is A, construct P(A|Q) to maximize this conditional probability. Using the Bayesian formula, For a given text to be classified, the embodiment of the present application returns the classification probability as output, that is, P(A)=P(a), where a is the classification category label, and based on the constructed input features, the probability is: therefore,
[0171]
[0172] therefore,
[0173] The final model results are: That is, the mutual information of the probability q1 of the feature words in the text to be analyzed, the probability q2 of the target part-of-speech combination sequence, the probability q3 of the target syntactic dependency sequence, and the probability q4 of the target semantic dependency sequence are calculated. These parts of mutual information are summarized and the mutual information filtering threshold is set. If P(A|Q) meets the threshold requirement, the text to be identified is judged as this classification category.
[0174] In summary, if Figure 8 As shown, an embodiment of the present application proposes a Bayesian fine-grained analysis method that integrates feature words and multi-dimensional features (part-of-speech combination sequence, syntactic dependency sequence, and semantic dependency sequence). This method utilizes the dependency syntactic relationship, part-of-speech combination relationship, and semantic dependency relationship of the feature word context to mine sequence patterns, construct precise classification features, and model Bayesian for fine-grained analysis, so that the subsequent category information of the text to be analyzed can be presented accurately, efficiently, and explainably.
[0175] At the same time, this method is suitable for related scenarios of fine-grained analysis technology, such as product review analysis, shopping recommendations, social forum opinion extraction, etc. The application of this application method has high practical value and reference significance.
[0176] See also Figure 8 , which shows a structural diagram of a text analysis device provided by an embodiment of the present invention, the device has the function of implementing the text analysis method in the above method embodiment, and the function can be implemented by hardware or by hardware executing corresponding software. Figure 6 As shown, the device may include:
[0177] The text acquisition module 801 is used to acquire the text to be analyzed;
[0178] A first tag information determination module 802 is used to determine the part-of-speech tag information, syntactic tag information, and semantic tag information of the text to be analyzed;
[0179] A second tagging information determining module 803 is configured to superimpose feature word information on the part-of-speech tagging information, the syntactic tagging information, and the semantic tagging information based on feature words in the text to be analyzed, to obtain target part-of-speech tagging information, target syntactic tagging information, and target semantic tagging information with feature word information;
[0180] A sequence determination module 804 is configured to determine, based on the sequence set in the target comprehensive database, a target part-of-speech combination sequence from the target part-of-speech tagging information, a target syntactic dependency sequence from the target syntactic tagging information, and a target semantic dependency sequence from the target semantic tagging information;
[0181] The type information determination module 905 is used to determine the target part-of-speech combination sequence, the target syntactic dependency sequence, the target semantic dependency sequence and the probability information of the feature words in the text to be analyzed based on the target comprehensive database, and determine the category information to which the text to be analyzed belongs based on the profile information.
[0182] As a possible implementation, the feature words in the text to be analyzed are determined based on the analysis intention;
[0183] The second annotation information determination module is used to:
[0184] Determine the analysis intent corresponding to the text to be analyzed;
[0185] Determine the target feature vocabulary based on the analysis intention;
[0186] Determine the feature words in the text to be analyzed from the target feature word library;
[0187] Determine the marking symbol corresponding to the feature word according to the preset feature word marking symbol;
[0188] The tagging symbols corresponding to the feature words are used to superimpose the feature word information on the part-of-speech tagging information, the syntactic tagging information and the semantic tagging information, so as to obtain the target part-of-speech tagging information, the target syntactic tagging information and the target semantic tagging information with the feature word information.
[0189] As a possible implementation, the first annotation information determination module is configured to:
[0190] Perform word segmentation and part-of-speech tagging on the text to be analyzed to obtain part-of-speech tagging information;
[0191] Perform syntactic analysis on the text to be analyzed to obtain syntactic annotation information;
[0192] Perform semantic dependency analysis on the text to be analyzed to obtain semantic annotation information.
[0193] As a possible implementation, the target comprehensive database includes a first target database, a second target database, and a third target database; the sequence set includes a part-of-speech combination sequence set, a syntactic dependency sequence set, and a semantic dependency sequence set;
[0194] Sequence determination module, used to:
[0195] Determining, from the set of part-of-speech combination sequences in the first target database, a part-of-speech combination sequence whose matching degree with the target part-of-speech tagging information satisfies a first preset condition as a target part-of-speech combination sequence;
[0196] Determining, from the set of syntactic dependency sequences in the second target database, a syntactic dependency sequence whose matching degree with the target syntactic annotation information satisfies a second preset condition as a target syntactic dependency sequence;
[0197] A semantic dependency sequence in the set of semantic dependency sequences in the third target database whose matching degree with the target semantic annotation information satisfies a third preset condition is determined as a target semantic dependency sequence.
[0198] As a possible implementation, the type information determination module is used to:
[0199] Based on the probability information in the target comprehensive database, determining first probability information of the target part-of-speech combination sequence, determining second probability information of the target syntactic dependency sequence, determining third probability information of the target semantic dependency sequence, and determining fourth probability information of the feature words in the text to be analyzed;
[0200] The category information to which the text to be analyzed belongs is determined based on the first probability information, the second probability information, the third probability information, and the fourth probability information.
[0201] As a possible implementation, the target comprehensive database further includes a fourth target database;
[0202] The probability determination module is used to:
[0203] Determining first probability information of a target part-of-speech combination sequence based on a first target database;
[0204] Determining second probability information of the target syntactic dependency sequence based on the second target database;
[0205] determining third probability information of the target semantic dependency sequence based on the third target database;
[0206] Fourth probability information of the feature words in the text to be analyzed is determined based on the fourth target database.
[0207] The probability determination module is used to:
[0208] Determining a first ratio of the total amount of the first sample text corresponding to the target part-of-speech combination sequence to the total amount of the sample text based on the total amount of the sample text in the first target database;
[0209] Determining a second ratio of the total amount of the second sample text corresponding to the preset category information to the total amount of the sample text;
[0210] determining a third ratio of the sample text corresponding to the target part-of-speech combination sequence to the total amount of the second sample text;
[0211] First probability information is determined based on the first ratio, the second ratio, and the third ratio.
[0212] As a possible implementation, the type information determination module is used to:
[0213] Determining target probability information belonging to a preset category of information based on the product of the first probability information, the second probability information, the third probability information, and the fourth probability information;
[0214] If the target probability information is within the probability range, it is determined that the category information to which the text to be analyzed belongs is the preset category information.
[0215] It should be noted that the apparatus provided in the above embodiments, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0216] An embodiment of the present invention provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the text analysis method provided in the above method embodiment.
[0217] The memory can be used to store software programs and modules. The processor executes various functional applications and text analysis by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, application programs required for functions, etc.; the data storage area can store data created based on the use of the device, etc. In addition, the memory can include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory can also include a memory controller to provide the processor with access to the memory.
[0218] The method embodiments provided by the embodiments of the present invention may be executed in a computer terminal, a server or a similar computing device. Figure 9 This is a hardware structure diagram of an electronic device for running a text analysis method provided by an embodiment of the present invention, such as Figure 9 As shown, the internal structure of the electronic device may include but is not limited to: a processor, a network interface and a memory. The processor, network interface and memory in the electronic device may be connected via a bus or other means. Figure 9 The bus connection is taken as an example.
[0219] The processor (also known as the CPU (Central Processing Unit)) is the computing and control core of the electronic device. The network interface may optionally include a standard wired interface or a wireless interface (such as Wi-Fi, mobile communication interface, etc.). Memory is a storage device in an electronic device used to store programs and data. It is understood that the memory here can be a high-speed RAM storage device or a non-volatile memory device, such as at least one disk storage device; optionally, it can be at least one storage device located remotely from the aforementioned processor. The memory provides storage space that stores the operating system of the electronic device, which may include but is not limited to: Windows system (an operating system), Linux (an operating system), Android (a mobile operating system), iOS (a mobile operating system), etc., although the present invention is not limited to this. Furthermore, the storage space also stores one or more instructions suitable for being loaded and executed by the processor. These instructions may be one or more computer programs (including program code). In the embodiments of this specification, the processor loads and executes one or more instructions stored in the memory to implement the text analysis method provided in the above method embodiments.
[0220] An embodiment of the present invention also provides a computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program related to implementing a text analysis method. The at least one instruction or the at least one program is loaded and executed by the processor to implement the text analysis method provided by the above method embodiment.
[0221] Embodiments of the present invention also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the text analysis methods provided in the various optional implementations described above.
[0222] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0223] It should be noted that the order in which the embodiments of the present invention are described above is for illustrative purposes only and does not represent the superiority or inferiority of the embodiments. The above description is of specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0224] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0225] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0226] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A text analysis method, characterized in that: The method comprises: Get the text to be analyzed; Determining part-of-speech tagging information, syntactic tagging information, and semantic tagging information of the text to be analyzed; Based on the characteristic words in the text to be analyzed, the part-of-speech tagging information, the syntactic tagging information and the semantic tagging information are respectively superimposed with characteristic word information to obtain target part-of-speech tagging information, target syntactic tagging information and target semantic tagging information with characteristic word information; Based on a sequence set in a target comprehensive database, a target part-of-speech combination sequence is determined from the target part-of-speech tagging information, a target syntactic dependency sequence is determined from the target syntactic tagging information, and a target semantic dependency sequence is determined from the target semantic tagging information; the target comprehensive database includes a first target database, a second target database, a third target database, and a fourth target database; first probability information of the target part-of-speech combination sequence is determined based on the first target database; Determining second probability information of the target syntactic dependency sequence based on the second target database; Determining third probability information of the target semantic dependency sequence based on the third target database; Determining fourth probability information of the feature words in the text to be analyzed based on the fourth target database; Category information to which the text to be analyzed belongs is determined based on the first probability information, the second probability information, the third probability information, and the fourth probability information.
2. The text analysis method according to claim 1, characterized in that The characteristic words in the text to be analyzed are determined based on the analysis intention; The method of superimposing the part-of-speech tagging information, the syntactic tagging information, and the semantic tagging information based on the feature words in the text to be analyzed to obtain target part-of-speech tagging information, target syntactic tagging information, and target semantic tagging information with the feature word information includes: Determining the analysis intent corresponding to the text to be analyzed; Determining a target feature vocabulary based on the analysis intention; Determining feature words in the text to be analyzed from the target feature word library; Determine the marking symbol corresponding to the feature word according to the preset feature word marking symbol; The feature word information is superimposed on the part-of-speech tagging information, the syntactic tagging information and the semantic tagging information using the tagging symbols corresponding to the feature words, to obtain target part-of-speech tagging information, target syntactic tagging information and target semantic tagging information with the feature word information.
3. The text analysis method according to claim 1, wherein: The determining of part-of-speech tagging information, syntactic tagging information, and semantic tagging information of the text to be analyzed includes: Performing word segmentation and part-of-speech tagging on the text to be analyzed to obtain part-of-speech tagging information; Performing syntactic analysis on the text to be analyzed to obtain syntactic annotation information; Perform semantic dependency analysis on the text to be analyzed to obtain semantic annotation information.
4. The text analysis method according to claim 1, wherein: The sequence set includes a part-of-speech combination sequence set, a syntactic dependency sequence set, and a semantic dependency sequence set; The method of determining a target part-of-speech combination sequence from the target part-of-speech tagging information based on a sequence set in a target comprehensive database, determining a target syntactic dependency sequence from the target syntactic tagging information, and determining a target semantic dependency sequence from the target semantic tagging information comprises: Determining, from the set of part-of-speech combination sequences in the first target database, a part-of-speech combination sequence whose matching degree with the target part-of-speech tagging information satisfies a first preset condition as a target part-of-speech combination sequence; Determining, in the set of syntactic dependency sequences in the second target database, a syntactic dependency sequence whose matching degree with the target syntactic annotation information satisfies a second preset condition as a target syntactic dependency sequence; A semantic dependency sequence in the set of semantic dependency sequences in the third target database whose matching degree with the target semantic annotation information satisfies a third preset condition is determined as a target semantic dependency sequence.
5. The text analysis method according to claim 1, characterized in that The determining of first probability information of the target part-of-speech combination sequence based on the first target database includes: Determining a first ratio of the total amount of first sample text corresponding to the target part-of-speech combination sequence to the total amount of the sample text based on the total amount of sample text in the first target database; Determining a second ratio of the total amount of the second sample text corresponding to the preset category information to the total amount of the sample text; determining a third ratio of the sample text corresponding to the target part-of-speech combination sequence to the total amount of the second sample text; The first probability information is determined according to the first ratio, the second ratio, and the third ratio.
6. The text analysis method according to claim 5, characterized in that Determining category information to which the to-be-analyzed text belongs based on the first probability information, the second probability information, the third probability information, and the fourth probability information includes: Determining target probability information belonging to the preset category information based on the product of the first probability information, the second probability information, the third probability information, and the fourth probability information; If the target probability information is within the probability range, it is determined that the category information to which the text to be analyzed belongs is the preset category information.
7. A text analysis device, characterized in that: The device comprises: A text acquisition module is used to obtain the text to be analyzed; A first tag information determination module is used to determine the part-of-speech tag information, syntactic tag information and semantic tag information of the text to be analyzed; A second tagging information determination module is configured to perform feature word information superposition on the part-of-speech tagging information, the syntactic tagging information, and the semantic tagging information based on feature words in the text to be analyzed, to obtain target part-of-speech tagging information, target syntactic tagging information, and target semantic tagging information with feature word information; a sequence determination module for determining, based on a sequence set in a target comprehensive database, a target part-of-speech combination sequence from the target part-of-speech tagging information, a target syntactic dependency sequence from the target syntactic tagging information, and a target semantic dependency sequence from the target semantic tagging information; the target comprehensive database includes a first target database, a second target database, a third target database, and a fourth target database; A type information determination module is used to determine first probability information of the target part-of-speech combination sequence based on the first target database; determine second probability information of the target syntactic dependency sequence based on the second target database; determine third probability information of the target semantic dependency sequence based on the third target database; determine fourth probability information of the feature words in the text to be analyzed based on the fourth target database; and determine category information to which the text to be analyzed belongs based on the first probability information, the second probability information, the third probability information and the fourth probability information.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the text analysis method according to any one of claims 1 to 6.
9. A computer-readable storage medium, wherein at least one instruction or at least one program is stored in the computer-readable storage medium, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the text analysis method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Text recognition method and device, computer equipment and storage medium
CN112989055A