A travel review analysis method and system
By using convolutional neural networks to extract and classify thematic and sentiment features of tourism reviews, this approach solves the problem of single-dimensional classification in existing technologies, enables multi-dimensional text analysis, and provides an intuitive assessment of scenic spot satisfaction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAMEN MEIYA PICO INFORMATION CO LTD
- Filing Date
- 2022-07-18
- Publication Date
- 2026-04-14
AI Technical Summary
Existing deep learning methods can only classify texts in a single dimension in tourism review analysis, and cannot effectively classify both themes and emotions simultaneously, resulting in less intuitive and accurate analysis of scenic spot satisfaction.
A convolutional neural network is used to extract thematic and sentiment features from travel reviews. The features are transformed into two column vectors through convolutional and pooling layers, and then merged into a matrix using a fully connected layer for classification training, outputting the classification results of thematic and sentiment.
It enables multi-dimensional analysis of travel reviews, quickly uncovering text types and sentiment trends, and providing intuitive analysis of scenic spot advantages and disadvantages to help managers and tourists make decisions.
Smart Images

Figure CN115203417B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text classification technology, and in particular to a method and system for analyzing tourism reviews. Background Technology
[0002] Tourist attraction reviews are evaluations of various aspects of a tourist attraction, directly reflecting tourist satisfaction. Many travel websites now offer reviews, but these numerous textual comments don't provide a clear picture of the attraction's specifics. Tourists and attraction staff would have to read countless reviews to get detailed information, which is time-consuming and doesn't yield intuitive results. Therefore, we can input the reviews we need for analysis into a system for processing, obtaining quantitative results that more intuitively and accurately demonstrate tourist satisfaction levels.
[0003] Deep learning was initially used for image recognition and later widely applied to other fields. In text classification, with its development, deep learning methods have gradually replaced traditional machine learning methods such as Naive Bayes, KNN, and SVM. As deep learning methods have become more widespread, the accuracy of text classification has also greatly improved. The use of deep learning methods to analyze travel reviews has emerged. Travel reviews are characterized by relatively singular themes and rich emotional attitudes; using CNNs for feature extraction can effectively extract textual features for analysis.
[0004] Currently, deep learning-based text classification methods only classify texts along one dimension, such as topic classification or sentiment classification. However, this invention classifies travel reviews simultaneously along both topic and sentiment dimensions. Summary of the Invention
[0005] This invention proposes a tourism review analysis method and system to address the shortcomings of the existing technology mentioned above.
[0006] In one aspect, the present invention proposes a method for analyzing travel reviews, the method comprising the following steps:
[0007] S1: The text of travel reviews is used to form a training set. The convolutional layer of the convolutional neural network is used to extract features from the text in the training set from two dimensions: topic and sentiment, to obtain topic features and sentiment features respectively.
[0008] S2: In the convolutional neural network, the topic features and the sentiment features are pooled into two column vectors respectively;
[0009] S3: After merging the two column vectors into a matrix using the fully connected layer of the convolutional neural network, the two column vectors of the matrix are then classified and trained separately to output the results, thereby obtaining the classification results for the two dimensions of topic and sentiment.
[0010] S4: After training the training set according to S1 to S3, save the model of the convolutional neural network. Use the model to calculate the number of reviews belonging to each category of the two dimensions for the text of the travel reviews to be analyzed, and analyze the results.
[0011] The above method transforms the vectors of the fully connected layers of a convolutional neural network into matrices for two-dimensional analysis. Based on the convolutional neural network, it first extracts features from the text in two dimensions at the convolutional layer; then, it performs pooling on the features in both dimensions separately; finally, at the fully connected layer, it combines the two vectors of the same length obtained from the classification into a matrix, normalizes the two columns of this matrix, and outputs the results of the two classifications, thus obtaining classifications for the two dimensions of topic and sentiment. After training, the model is saved. When used, simply inputting the comment to be analyzed will yield the analysis results and the number of comments in each category. By performing two-dimensional text classification, it is possible to quickly uncover the text type and sentiment tendency, and count the number of texts with each sentiment in each type. This is of great significance for tourism review analysis. Users do not need to read the specific content of each review to gain a general understanding of a scenic spot, understand its advantages and disadvantages, and help scenic spot managers and tourists make decisions. This method can achieve multi-dimensional text analysis, which not only has important guiding significance for tourism reviews but also for other text classifications. Through text classification and quantification, intuitive results can be obtained.
[0012] In a specific embodiment, the text of the crawled travel reviews forms a training set, specifically including:
[0013] The system scrapes reviews of tourist attractions from travel websites, saves all the scraped reviews for the same tourist attraction in the same text file, and uses all the text files to form a training set.
[0014] In a specific embodiment, S1 further includes preprocessing the training set, specifically including:
[0015] Regular expressions were used to remove duplicate comments and reduce noise in the text of the training set.
[0016] The text that has been processed by regular expressions is manually segmented using jieba to remove stop words, and then mapped into word vectors using the word2vec method.
[0017] The word vectors are then labeled.
[0018] In specific embodiments, the topics include: city overview, shopping and consumption, food and beverage, hotel accommodation, transportation guidance, scenic area services, and scenic spots.
[0019] In a specific embodiment, the emotion specifically includes the level of satisfaction reflected in the text of the travel review, and the level of satisfaction is represented by setting scores for different levels of satisfaction.
[0020] In a specific embodiment, the step of using the convolutional layers of a convolutional neural network to extract features from the text in the training set from two dimensions: topic and sentiment, to obtain topic features and sentiment features respectively, specifically includes:
[0021] Using the convolutional layers of a convolutional neural network, the text in the training set is classified from two dimensions: topic and sentiment. The number of categories classified from the topic dimension is the same as the number of categories classified from the sentiment dimension.
[0022] The text in the training set after classification is then processed using the convolutional layer to extract features from the two dimensions of topic and sentiment, respectively, to obtain topic features and sentiment features.
[0023] In a specific embodiment, the two column vectors in S2 have the same length.
[0024] In a specific embodiment, S3 specifically includes:
[0025] The softmax function is used in the fully connected layer to map the output of the fully connected layer into a probability distribution. The two column vectors are then trained using the probability distribution to obtain the classification result that maximizes the probability.
[0026] The method for calculating the probability distribution includes: merging the two column vectors into a matrix, and then calculating the probability distribution column-by-column. The formula for calculating the probability distribution column-by-column is as follows:
[0027]
[0028] The matrix has two columns. Calculate the x-th column, which has 7 values, a. (j,x) Let represent the j-th value in the x-th column; where j represents the j-th category; x represents the x-th column of the matrix, corresponding to the column vectors of the topic features and the sentiment features, respectively; a (k,x) This represents the kth value in column x; T is the number of categories; and j ranges from 1 to T.
[0029] In a specific embodiment, S4 specifically includes:
[0030] The text of the tourism reviews to be analyzed is processed, and the text of tourism reviews corresponding to the same tourist attractions are saved in the same txt text file to form a test set. The test set is then classified using the model, thereby generating an analysis result table for each tourist attraction.
[0031] According to a second aspect of the invention, a computer-readable storage medium is provided on which a computer program is stored, which, when executed by a computer processor, performs the above-described method.
[0032] According to a third aspect of the present invention, a tourism review analysis system is proposed, the system comprising:
[0033] Feature extraction module: Configure the text used to crawl travel reviews to form a training set, and use the convolutional layer of the convolutional neural network to extract features from the text in the training set from two dimensions: topic and sentiment, to obtain topic features and sentiment features respectively;
[0034] Feature pooling module: configured to pool the topic features and the sentiment features into two column vectors in the convolutional neural network respectively;
[0035] Classification module: Configured to use the fully connected layer of the convolutional neural network to merge the two column vectors into a matrix, and then perform classification training on the two column vectors of the matrix respectively to output the results, thereby obtaining the classification results of the two dimensions of topic and sentiment.
[0036] Recognition module: Configured to save the model of the convolutional neural network after training the training set according to the feature extraction module and the classification module, and use the model to calculate the number of reviews belonging to each category of the two dimensions of the travel reviews to be analyzed, and analyze the results.
[0037] The present invention forms a training set by capturing the text of travel reviews, and uses the convolutional layer of a convolutional neural network to extract features from the text in the training set in two dimensions of theme and sentiment, respectively obtaining theme features and sentiment features; in the convolutional neural network, the theme features and the sentiment features are respectively pooled into two column vectors; then, using the fully connected layer of the convolutional neural network, the two column vectors are combined to form a matrix, and then the two column vectors of the matrix are respectively classified and trained to output results, so as to obtain the classification results of each of the two dimensions of theme and sentiment; after the convolutional neural network completes the training of the training set, the model of the convolutional neural network is saved, and the model is used to calculate the number of reviews of each classification belonging to the two dimensions for the text of the travel reviews to be analyzed, and analyze according to the calculation results. By performing text classification in the above two dimensions, the type and sentiment tendency of the text can be quickly mined, and the number of texts of each sentiment in various types can be counted, which has great significance for travel review analysis. Users can generally understand a scenic spot without viewing the specific content of each review, understand the advantages and disadvantages of the scenic area, and help scenic area managers and tourists make decisions. The present invention realizes multi-dimensional text analysis, which not only has important guiding significance for travel reviews, but also for other text classifications. Through text classification and quantification, intuitive results can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated in and constitute a part of this specification. The drawings illustrate the embodiments and together with the description are used to explain the principles of the invention. Other embodiments and many of the intended advantages of the embodiments will be readily apparent as they become better understood by reference to the following detailed description. The other features, objects, and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments read in conjunction with the accompanying drawings:
[0039] Figure 1 is an exemplary system architecture diagram to which the present application can be applied;
[0040] Figure 2 is a flowchart of a travel review analysis method according to an embodiment of the present invention;
[0041] Figure 3 is an analysis result table of a specific embodiment of the present invention;
[0042] Figure 4 is a convolutional neural network structure diagram of a specific embodiment of the present invention;
[0043] Figure 5 is a framework diagram of a travel review analysis system according to an embodiment of the present invention;
[0044] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments. Detailed Implementation
[0045] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0046] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0047] Figure 1 An exemplary system architecture 100 is shown that can be applied to a travel review analysis method according to embodiments of this application.
[0048] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0049] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various applications can be installed on terminal devices 101, 102, and 103, such as data processing applications, data visualization applications, and web browser applications.
[0050] Terminal devices 101, 102, and 103 can be either hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices, including but not limited to smartphones, tablets, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software programs or software modules (e.g., software programs or software modules used to provide distributed services) or as a single software program or software module. No specific limitations are imposed here.
[0051] Server 105 can be a server that provides various services, such as a background information processing server that supports the training set displayed on terminal devices 101, 102, and 103. The background information processing server can process the acquired topic features and sentiment features and generate processing results (such as classification results).
[0052] It should be noted that the method provided in this application embodiment can be executed by server 105 or by terminal devices 101, 102, and 103. The corresponding device is generally set in server 105 or can be set in terminal devices 101, 102, and 103.
[0053] It should be noted that a server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules (such as software programs or software modules used to provide distributed services), or as a single software program or software module. No specific limitations are made here.
[0054] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0055] A tourism review analysis method according to an embodiment of the present invention, Figure 2 A flowchart illustrating a tourism review analysis method according to an embodiment of the present invention is shown. Figure 2 As shown, the method includes the following steps:
[0056] S1: The text of travel reviews is used to form a training set. The convolutional layer of the convolutional neural network is used to extract features from the text in the training set from two dimensions: topic and sentiment, to obtain topic features and sentiment features respectively.
[0057] S2: In the convolutional neural network, the topic features and the sentiment features are pooled into two column vectors respectively;
[0058] S3: After merging the two column vectors into a matrix using the fully connected layer of the convolutional neural network, the two column vectors of the matrix are then classified and trained separately to output the results, thereby obtaining the classification results for the two dimensions of topic and sentiment.
[0059] S4: After training the training set according to S1 to S3, save the model of the convolutional neural network. Use the model to calculate the number of reviews belonging to each category of the two dimensions for the text of the travel reviews to be analyzed, and analyze the results.
[0060] In a specific embodiment, the text of the crawled travel reviews forms a training set, specifically including:
[0061] The system scrapes reviews of tourist attractions from travel websites, saves all the scraped reviews for the same tourist attraction in the same text file, and uses all the text files to form a training set.
[0062] In a specific embodiment, S1 further includes preprocessing the training set, specifically including:
[0063] Regular expressions were used to remove duplicate comments and reduce noise in the text of the training set.
[0064] The text that has been processed by regular expressions is manually segmented using jieba to remove stop words, and then mapped into word vectors using the word2vec method.
[0065] The word vectors are then labeled.
[0066] In specific embodiments, the topics include: city overview, shopping and consumption, food and beverage, hotel accommodation, transportation guidance, scenic area services, and scenic spots.
[0067] In a specific embodiment, the emotion specifically includes the level of satisfaction reflected in the text of the travel review, and the level of satisfaction is represented by setting scores for different levels of satisfaction.
[0068] In a specific embodiment, the step of using the convolutional layers of a convolutional neural network to extract features from the text in the training set from two dimensions: topic and sentiment, to obtain topic features and sentiment features respectively, specifically includes:
[0069] Using the convolutional layers of a convolutional neural network, the text in the training set is classified from two dimensions: topic and sentiment. The number of categories classified from the topic dimension is the same as the number of categories classified from the sentiment dimension.
[0070] The text in the training set after classification is then processed using the convolutional layer to extract features from the two dimensions of topic and sentiment, respectively, to obtain topic features and sentiment features.
[0071] In a specific embodiment, the two column vectors in S2 have the same length.
[0072] In a specific embodiment, S3 specifically includes:
[0073] The softmax function is used in the fully connected layer to map the output of the fully connected layer into a probability distribution. The two column vectors are then trained using the probability distribution to obtain the classification result that maximizes the probability.
[0074] The method for calculating the probability distribution includes: merging the two column vectors into a matrix, and then calculating the probability distribution column-by-column. The formula for calculating the probability distribution column-by-column is as follows:
[0075]
[0076] The matrix has two columns. Calculate the x-th column, which has 7 values, a. (j,x) Let represent the j-th value in the x-th column; where j represents the j-th category; x represents the x-th column of the matrix, corresponding to the column vectors of the topic features and the sentiment features, respectively; a (k,x) This represents the kth value in column x; T is the number of categories; and j ranges from 1 to T.
[0077] In a specific embodiment, S4 specifically includes:
[0078] The text of the tourism reviews to be analyzed is processed, and the text of tourism reviews corresponding to the same tourist attractions are saved in the same txt text file to form a test set. The test set is then classified using the model, thereby generating an analysis result table for each tourist attraction.
[0079] The following specific embodiment illustrates the solution of the present invention:
[0080] This embodiment, considering the characteristics of travel reviews, categorizes them based on two dimensions: theme and sentiment, using individual scenic spots as the unit. The theme categories are divided into seven subcategories: city overview, shopping and consumption, dining and food, hotel accommodation, transportation guidance, scenic spot services, and scenic views. Sentiment analysis categories are also divided into seven subcategories, specifically represented by converting sentiment statements into corresponding scores of 1, 2, 3, 4, 5, 6, and 7, with higher scores indicating higher satisfaction. Therefore, the classification results are theme category and sentiment score. For example, if three reviews related to shopping and food are input, and the reviews are rated as very dissatisfied, neutral, and very satisfied respectively, the analysis results are as follows: Figure 3 As shown.
[0081] The specific implementation steps of this embodiment are as follows:
[0082] 1) Web crawling to retrieve reviews: Retrieve a large number of reviews of tourist attractions from travel websites and save all the retrieved reviews of the same attraction into a single txt file;
[0083] 2) Preprocessing: Regular expressions were used to preprocess these comments to remove duplicates and reduce noise; for example, invalid comments such as "positive review" were deleted. To obtain a more accurate model, the comments were manually preprocessed again after regular expression processing. Since there are no delimiters between Chinese words, the processed sentences were segmented using jieba, stop words were removed, and then word vectors were mapped using the word2vec method. This paper adopts supervised learning to label the topic type and sentiment type of the text. The dataset was divided into a training set (70%), a validation set (10%), and a test set (20%).
[0084] 3) Text Topic Classification and Sentiment Classification: Both topic classification and sentiment classification are divided into seven categories. Sentiment classification assigns a sentiment score to each sentence, with 1, 2, 3, 4, 5, 6, and 7 representing very dissatisfied, dissatisfied, somewhat dissatisfied, neutral, satisfied, and very satisfied, respectively. Higher scores indicate higher satisfaction. A convolutional neural network is used to train the model on the training set. Each comment undergoes two convolutions for feature extraction and pooling, followed by a fully connected layer to form a matrix. Finally, the classification result is output at the output layer. The model is saved after training.
[0085] 4) Since this method is a text multi-class classification method, the softmax function is used in the fully connected layer to map the output of the fully connected layer into a probability distribution. The training objective is to maximize the probability of samples belonging to class k after softmax. The fully connected layer in this method is a matrix, and the probability distribution is calculated column-wise as follows:
[0086]
[0087] 5) In the above formula, a (j,x) Let represent the j-th value in the x-th column; where j represents the j-th category; x represents the x-th column of the matrix, corresponding to the column vectors of the topic features and the sentiment features, respectively; a (k,x) This represents the kth value in column x; T is the number of categories; j ranges from 1 to T. Because e x Since the numerator is always greater than 0, it is always positive. The denominator is the sum of multiple positive numbers, so it must also be positive. Therefore, S... (j,x) It is a positive number, and its range is (0,1).
[0088] 6) Load the model for classification: Load the tourism review analysis model, classify the input scenic spot review texts, store each scenic spot review as a text, and output the classification results after analysis. Output an analysis result table for each scenic spot.
[0089] Figure 4The diagram illustrates a convolutional neural network (CNN) architecture according to a specific embodiment of the present invention. In the diagram, travel review text is input into the CNN. During the training phase, the travel review text is passed through topic classification convolutional layers and sentiment classification convolutional layers to obtain their respective features. After passing through pooling layers, the two pooled vectors are combined into a matrix in a fully connected layer for classification training to obtain the training result, which is then output as the final CNN model. In the recognition phase, the travel review text to be recognized (e.g., "The scenery here is very beautiful") is input into the trained CNN model. Similarly, features are extracted from two dimensions through convolutional layers, then pooled through pooling layers before being input into a fully connected layer for recognition to obtain the analysis result.
[0090] Figure 5 A framework diagram of a tourism review analysis system according to an embodiment of the present invention is shown. The system includes a feature extraction module 501, a feature pooling module 502, a classification module 503, and a recognition module 504.
[0091] In a specific embodiment, the feature extraction module 501 is configured to extract text from travel reviews to form a training set, and use the convolutional layer of a convolutional neural network to extract features from the text in the training set from two dimensions: topic and sentiment, to obtain topic features and sentiment features respectively.
[0092] The feature pooling module 502 is configured to pool the topic features and the sentiment features into two column vectors in the convolutional neural network, respectively.
[0093] The classification module 503 is configured to combine the two column vectors into a matrix using the fully connected layer of the convolutional neural network, and then perform classification training on the two column vectors of the matrix respectively to output the results, thereby obtaining the classification results for the two dimensions of topic and sentiment.
[0094] The recognition module 504 is configured to save the model of the convolutional neural network after training the training set according to the feature extraction module and the classification module, use the model to calculate the number of reviews belonging to each category of the two dimensions for the text of the travel reviews to be analyzed, and perform analysis based on the calculation results.
[0095] This system constructs a training set by capturing the text of travel reviews, and uses the convolutional layer of a convolutional neural network to extract features from the text in the training set from two dimensions: theme and sentiment, respectively obtaining theme features and sentiment features; in the convolutional neural network, pooling the theme features and the sentiment features respectively into two column vectors; then using the fully connected layer of the convolutional neural network to combine the two column vectors into a matrix, and then performing classification training on the two column vectors of the matrix respectively and outputting the results, so as to obtain the classification results of each of the two dimensions of theme and sentiment; after the convolutional neural network completes the training on the training set, save the model of the convolutional neural network, use the model to calculate the number of reviews of each classification belonging to the two dimensions for the text of the travel reviews to be analyzed, and perform analysis based on the calculation results. By performing text classification in the above two dimensions, it is possible to quickly discover the type and sentiment tendency of the text, and count the number of texts with each sentiment in various types, which is of great significance for travel review analysis. Users can generally understand a scenic spot without viewing the specific content of each review, understand the advantages and disadvantages of the scenic area, and help scenic area managers and tourists make decisions. The present invention realizes multi-dimensional text analysis, which not only has an important guiding role for travel reviews, but also for other text classifications. Through the classification and quantification of the text, intuitive results can be obtained.
[0096] Reference is made below to Figure 6 , which shows a schematic structural diagram of a computer system 600 of an electronic device suitable for use in implementing embodiments of the present application. Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functions and scope of use of the embodiments of the present application.
[0097] As Figure 6 shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0098] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a liquid crystal display (LCD) and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card and a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.
[0099] Specifically, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined in the methods of this application. It should be noted that the computer-readable storage medium described in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. The computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable storage medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0100] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0101] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0102] The modules described in the embodiments of this application can be implemented in software or hardware. The described units can also be located in a processor, and the names of these units do not necessarily limit the unit itself.
[0103] Embodiments of the present invention also relate to a computer-readable storage medium storing a computer program that, when executed by a computer processor, performs the methods described above. The computer program includes program code for performing the methods shown in the flowchart. It should be noted that the computer-readable medium of this application may be a computer-readable signal medium, a computer-readable medium, or any combination of the two.
[0104] The present invention forms a training set by capturing the texts of travel reviews, and uses the convolutional layer of a convolutional neural network to extract features from the texts in the training set in two dimensions of theme and sentiment, respectively obtaining theme features and sentiment features; in the convolutional neural network, pooling is performed on the theme features and the sentiment features respectively to form two column vectors; then, after using the fully connected layer of the convolutional neural network to combine the two column vectors into a matrix, classification training is respectively performed on the two column vectors of the matrix and the results are output, so as to obtain the classification results of each of the two dimensions of theme and sentiment; after the convolutional neural network completes training on the training set, the model of the convolutional neural network is saved, and the model is used to calculate the number of reviews of the text of the travel reviews to be analyzed belonging to each classification of the two dimensions respectively, and analysis is performed according to the calculation results. By performing text classification in two dimensions through the above method, the type and sentiment tendency of the text can be quickly mined, and the number of texts of each sentiment in various types can be counted, which is of great significance for travel review analysis. Users can generally understand a scenic spot without viewing the specific content of each review, understand the advantages and disadvantages of the scenic area, and help scenic area managers and tourists make decisions. The present invention realizes multi-dimensional text analysis, which not only has an important guiding role for travel reviews, but also for other text classifications. Through the classification and quantification of texts, intuitive results can be obtained.
[0105] The above description is only the preferred embodiment of the present application and the explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features with similar functions disclosed in the present application.
Claims
1. A method for analyzing tourism reviews, characterized in that, Includes the following steps: S1: The text of travel reviews is used to form a training set. The text in the training set is classified from two dimensions: topic and sentiment. The number of categories classified from the topic dimension is the same as the number of categories classified from the sentiment dimension. Then, the text in the training set after classification is used to extract features from the two dimensions of topic and sentiment, respectively, to obtain topic features and sentiment features. S2: In the convolutional neural network, the topic features and the sentiment features are pooled into two column vectors with the same length. S3: The softmax function is used in the fully connected layer of the convolutional neural network to map the output of the fully connected layer into a probability distribution. The two column vectors are trained using the probability distribution to obtain the classification result that maximizes the probability. The method for calculating the probability distribution includes: merging the two column vectors into a matrix, and then calculating the probability distribution column-by-column. The formula for calculating the probability distribution column-by-column is as follows: The matrix has two columns. The x-th column has 7 values. a(j,x) represents the j-th value in the x-th column, where j represents the j-th category; x represents the x-th column of the matrix, corresponding to the column vectors of the topic features and the sentiment features, respectively; a(k,x) represents the k-th value in the x-th column; T is the number of categories; and j ranges from 1 to T. S4: After training the training set according to S1 to S3, save the model of the convolutional neural network. Use the model to calculate the number of reviews belonging to each category of the two dimensions for the text of the travel reviews to be analyzed, and analyze the results.
2. The method according to claim 1, characterized in that, The process of creating a training set from the collected travel reviews specifically involves: scraping reviews of tourist attractions from travel websites, storing all the scraped reviews of the same tourist attraction in the same txt file, and then using all the txt files as the training set.
3. The method according to claim 1, characterized in that, S1 further includes preprocessing the training set, specifically including: using regular expressions to remove duplicate comments and denoise the text in the training set; The text that has been processed by regular expressions is manually segmented using jieba to remove stop words, and then mapped into word vectors using the word2vec method. The word vectors are then labeled.
4. The method according to claim 1, characterized in that, The specific topics include: city overview, shopping and consumption, food and beverage, hotel accommodation, transportation guide, scenic area services and tourist attractions.
5. The method according to claim 1, characterized in that, The emotion specifically includes the level of satisfaction reflected in the text of the travel review, and the level of satisfaction is represented by setting scores for different levels of satisfaction.
6. The method according to claim 1, characterized in that, S4 specifically includes: The text of the tourism reviews to be analyzed is processed, and the text of tourism reviews corresponding to the same tourist attractions are saved in the same txt text file to form a test set. The test set is then classified using the model, thereby generating an analysis result table for each tourist attraction.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a computer processor, the computer program performs the method as described in any one of claims 1 to 6.
8. A tourism review analysis system, characterized in that, include: Feature extraction module: Configure the text used to crawl travel reviews to form a training set. Use the convolutional layer of the convolutional neural network to classify the text in the training set from two dimensions: topic and sentiment. The number of categories classified from the topic dimension is the same as the number of categories classified from the sentiment dimension. Then, use the convolutional layer to extract features from the classified text in the training set from the two dimensions of topic and sentiment, respectively, to obtain topic features and sentiment features. Feature pooling module: configured to pool the topic features and the sentiment features in the convolutional neural network into two column vectors with the same length; Classification module: Configured to use the softmax function in the fully connected layer of the convolutional neural network to map the output of the fully connected layer into a probability distribution, and to train the two column vectors using the probability distribution to obtain the classification result that maximizes the probability; The method for calculating the probability distribution includes: merging the two column vectors into a matrix, and then calculating the probability distribution column-by-column. The formula for calculating the probability distribution column-by-column is as follows: The matrix has two columns. The x-th column has 7 values. a(j,x) represents the j-th value in the x-th column, where j represents the j-th category; x represents the x-th column of the matrix, corresponding to the column vectors of the topic features and the sentiment features, respectively; a(k,x) represents the k-th value in the x-th column; T is the number of categories; and j ranges from 1 to T. Recognition module: Configured to save the model of the convolutional neural network after training the training set according to the feature extraction module and the classification module, and use the model to calculate the number of reviews belonging to each category of the two dimensions of the travel reviews to be analyzed, and analyze the results.
Citation Information
Patent Citations
A user comment emotion analysis system and method based on attention convolution neural network
CN109284506A
Character-level convolutional neural network-based guest opinion mining method
CN109829166A