Resident emotional state monitoring method and system

By employing multi-source fusion and cross-validation methods, combined with BERT named entity recognition and machine learning algorithms, the problem of complex language and metaphorical expressions in emotion monitoring was solved, achieving accurate monitoring and precise localization of emotional states.

CN121117218APending Publication Date: 2025-12-12NANJING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511214894.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-28
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

Existing technologies cannot effectively handle complex and ever-changing online language, metaphorical expressions, and new emotional vocabulary, resulting in inaccurate emotional state monitoring results.

Method used

By acquiring geolocation information from social media texts, a multi-source fusion strategy and cross-validation are employed, combined with the BERT named entity recognition model and edit distance algorithm, to identify accurate geolocations. A sentiment dictionary and deep learning model are used to classify sentiments and calculate indices, quantifying the impact of sentiment types, regions, and topics. Machine learning algorithms are used to remove invalid content, construct standard text, and perform sentiment analysis.

Benefits of technology

It achieves accurate emotion monitoring of complex and ever-changing online language and metaphorical expressions, improves the accuracy of emotion state monitoring, and can accurately locate emotions from the macro-city level down to the street level.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121117218A_ABST
    Figure CN121117218A_ABST
Patent Text Reader

Abstract

The invention provides a resident emotional state monitoring method and system, and belongs to the technical field of data processing. The method comprises the steps of obtaining a plurality of original social media texts of a target area; converting the single original social media text into a text in a target format to serve as a standard text; determining an emotion type corresponding to the standard text; determining emotion type indexes of all the standard texts; obtaining an area and a theme mentioned by the standard text; determining region indexes of all the standard texts; determining topic indexes of all the standard texts; and according to the emotion type indexes, the region indexes and the theme indexes of all the standard texts, determining a resident emotion index for reflecting the emotional state of residents in the target region. According to the method, the influence degree of emotion types, regions and themes on the emotional state is quantified, complex and changeable network languages, metaphor expressions and new emotional vocabularies can be effectively processed, and the accuracy of an emotional state monitoring result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data processing technology, and in particular relates to a method and system for monitoring residents' emotional state. Background Technology

[0002] With the rapid development of social media, sharing information, expressing opinions, and conveying emotions on online platforms has become increasingly common. This massive amount of social media data contains rich emotional information, making it an important source for understanding residents' emotional state. As an emerging research field, resident emotion monitoring is of great significance for urban governance, public service optimization, and social harmony and stability.

[0003] Currently, commonly used methods for monitoring residents' emotional states rely on keyword matching for emotion assessment. First, publicly available text information related to the city is collected from social media platforms such as Weibo and Baidu Tieba. Second, a pre-defined emotion dictionary is used to segment the collected text and match it with emotional keywords to determine the category of emotion expressed (e.g., positive, negative, neutral). Finally, the statistically obtained emotion categories are aggregated and analyzed to obtain the distribution of residents' emotions in a specific area over a certain period. Throughout this process, emotion assessment primarily depends on keyword matching.

[0004] However, sentiment monitoring methods based on keyword matching rely on fixed sentiment dictionaries and simple keyword matching, which cannot effectively handle complex and ever-changing online language, metaphorical expressions, and new sentiment vocabulary, and are prone to inaccurate sentiment state monitoring results. Summary of the Invention

[0005] This invention provides a method and system for monitoring residents' emotional states, which can be used to solve the problem that existing technologies cannot effectively handle complex and ever-changing online language, metaphorical expressions, and new emotional vocabulary, leading to inaccurate emotional state monitoring results.

[0006] In a first aspect, the present invention provides a method for monitoring the emotional state of residents, comprising:

[0007] Obtain multiple raw social media texts from the target region;

[0008] Convert individual raw social media texts into text in the target format for use as standard text;

[0009] Determine the emotion type corresponding to the standard text;

[0010] Determine the sentiment type index for all standard texts;

[0011] Retrieve the regions and topics mentioned in the standard text;

[0012] Determine the regional index for all standard texts;

[0013] Determine the topic index for all standard texts;

[0014] Based on the sentiment type index, regional index, and theme index of all standard texts, a resident sentiment index is determined to reflect the emotional state of residents in the target area.

[0015] Optionally, obtaining multiple original social media texts of the target area includes:

[0016] The location information of the original social media text published by the social media platform is extracted through the API interface, and / or the geographic tags set by the user when publishing the original social media text content are obtained to get the first regional place name;

[0017] A BERT-based named entity recognition model is used to identify geographic location descriptions in original social media text to obtain second region place names;

[0018] Determine whether the place names in the first and second regions are from the same region.

[0019] If the place names are from the same region, then determine whether the first or second region name is the region to which the original social media text belongs;

[0020] If the place names are not from the same region, the similarity between the place names in the first region and the place names in the standard place name database is determined as the confidence level of the place names in the first region.

[0021] Determine the similarity between place names in the second region and place names in the standard place name database, and use this as the confidence level of place names in the second region;

[0022] The region with the highest confidence level between the first and second region place names is taken as the region to which the original social media text belongs;

[0023] Retrieve multiple original social media texts corresponding to the place names in the target area.

[0024] Optionally, the process of converting a single raw social media text into text in a target format for use as standard text includes:

[0025] Remove invalid or anomalous content from each original social media text to obtain the first original text;

[0026] The first raw text is converted into a second raw text that includes time format, geographic information, text encoding, data type, and field structure;

[0027] Machine learning algorithms are used to remove invalid or abnormal content from the second original text to obtain the standard text.

[0028] Optionally, determining the emotion type corresponding to the standard text includes:

[0029] The standard text is segmented to extract sentiment words.

[0030] The weight of each emotion word is obtained based on the emotion dictionary;

[0031] The first sentiment score (DictScore) of the standard text is calculated using the following formula:

[0032] DictScore = ∑(Wi·Fi);

[0033] Where Wi is the weight of the i-th emotion word in the standard text; Fi is the total number of the i-th emotion words in the standard text;

[0034] Use sentiment analysis models to obtain positive and negative sentiment scores for standard texts;

[0035] The difference between the positive sentiment score and the negative sentiment score of the standard text is used as the second sentiment score APIScore of the standard text.

[0036] The FinalScore, the overall sentiment score of the standard text, is calculated using the following formula:

[0037] FinalScore=α·DictScore+β·APIScore;

[0038] Where α is the preset weight of the first emotion score; β is the preset weight of the second emotion score;

[0039] The emotion type corresponding to the standard text is determined based on the second emotion score and the comprehensive emotion score.

[0040] Optionally, obtaining the preset weight of each emotion word based on the emotion dictionary includes:

[0041] Based on the Chinese emotional vocabulary ontology, multiple positive and negative emotional words from the fields of transportation, environment and ecology, public services and community life are added to construct an emotional dictionary;

[0042] The emotion dictionary is divided into five categories: joy, good, surprise, anger, sorrow, fear, and evil. Each category of emotion is assigned a corresponding weight.

[0043] Optionally, determining the sentiment type index for all standard texts includes:

[0044] The EI (Emotion Type Index) for all standard texts is calculated using the following formula:

[0045]

[0046] Where N is the total number of standard texts; S n W represents the overall sentiment score of the nth standard text. e (n) represents the weight of the sentiment type to which the nth standard text belongs.

[0047] Optionally, determining the regional index of all standard texts includes:

[0048] Calculate the regional index (RI) of all standard texts using the following formula:

[0049]

[0050] Where M is the total number of sub-regions within the target region; EI m W represents the sentiment type index of all standard texts referring to the m-th sub-region within the target region. r (m) represents the importance weight of the m-th sub-region within the target region.

[0051] Optionally, determining the topic index of all standard texts includes:

[0052] The topic index (TI) of all standard texts is calculated using the following formula:

[0053]

[0054] Where P is the total number of topics in all standard texts; EI p W represents the sentiment type index of all standard texts mentioning the p-th topic. t (p) represents the attention weight of the p-th topic.

[0055] Optionally, determining the residents' emotional index within the target area based on the sentiment type index, regional index, and topic index of all standard texts to represent the residents' emotional state within the target area includes:

[0056] The Resident Sentiment Index (CI) within the target area is calculated using the following formula:

[0057]

[0058] Where a is the importance coefficient of the Emotion Type Index (EI) for all standard texts; b is the importance coefficient of the Regional Index (RI) for all standard texts; and c is the importance coefficient of the Theme Index (TI) for all standard texts.

[0059] Secondly, the present invention provides a resident emotional state monitoring system, comprising:

[0060] The first acquisition module is used to acquire multiple raw social media texts from the target area;

[0061] The conversion module is used to convert individual raw social media texts into text in a target format for use as standard text.

[0062] The first determination module is used to determine the emotion type corresponding to the standard text;

[0063] The second determination module is used to determine the sentiment type index of all standard texts;

[0064] The second acquisition module is used to acquire the regions and topics mentioned in the standard text;

[0065] The third determination module is used to determine the regional index of all standard texts;

[0066] The fourth module is used to determine the topic index of all standard texts;

[0067] The fifth determination module is used to determine the resident sentiment index, which reflects the emotional state of residents in the target area, based on the sentiment type index, regional index, and theme index of all standard texts.

[0068] This invention provides a method and system for monitoring residents' emotional states. The method determines the emotion type corresponding to standard text and obtains the regions and topics mentioned in the standard text. It then determines the emotion type index, regional index, and topic index for all standard texts to measure the overall performance of different emotion categories, the distribution of emotions in different geographical regions, and the specific manifestation of emotions on different social topics. This invention quantifies the influence of emotion type, region, and topic on emotional states, effectively handling complex and ever-changing online language, metaphorical expressions, and new emotional vocabulary. Simultaneously, through multi-source geographic information fusion and cross-validation, it achieves a technological breakthrough from macro-city emotion perception to street-level precise positioning, enabling the identification of geographic location information in social media text and its correlation with emotional data, thereby improving the accuracy of emotional state monitoring results. Attached Figure Description

[0069] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0070] Figure 1 A flowchart illustrating a method for monitoring residents' emotional state provided in an embodiment of the present invention;

[0071] Figure 2 This is a schematic diagram of a resident emotional state monitoring system provided in an embodiment of the present invention. Detailed Implementation

[0072] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0073] Example 1

[0074] like Figure 1 As shown, this embodiment provides a method for monitoring residents' emotional state, including:

[0075] Step 101: Obtain multiple original social media texts from the target area.

[0076] In this step, a multi-source fusion strategy is used to obtain the target region's geographic location information corresponding to the original social media text:

[0077] The first category is direct geographic tag extraction, which involves extracting satellite (e.g., GPS) positioning information from the original social media text published by the social media platform through API interfaces. This includes longitude, latitude coordinates and accuracy range, and / or obtaining geographic tags set by the user when publishing the original social media text content, such as location markers like "@Nanjing Xinjiekou" or "Location: Xuanwu Lake", to obtain the first regional place name.

[0078] The second category: Geographic location identification in original social media text, which uses a BERT-based Named Entity Recognition (NER) model to identify geographic location descriptions in the original social media text and obtain second-region place names, specifically including:

[0079] (1) Landmark name recognition: Recognize well-known landmarks such as "Xinjiekou", "Confucius Temple", and "Sun Yat-sen Mausoleum"; (2) Road name recognition: Recognize road names such as "Zhongshan East Road", "Hanzhong Road", and "Daxinggong"; (3) Area name recognition: Recognize administrative divisions such as "Gulou District", "Jianye District", and "Jiangning District"; (4) Relative location recognition: Recognize relative location descriptions such as "nearby", "next to", and "opposite"; (5) Business district recognition: Recognize commercial landmarks such as "Wanda Plaza", "Deji Plaza", and "Golden Eagle World".

[0080] The third category is standardized geographic location matching, which is based on the administrative region database and includes a four-level geographic information system: (1) Province level: for example, Jiangsu Province; (2) City level: Nanjing City; (3) Region level: Xuanwu District, Qinhuai District, Jianye District, Gulou District, Pukou District, Qixia District, Yuhuatai District, Jiangning District, Liuhe District, Lishui District, Gaochun District; (4) Street level: includes detailed information on the street offices and townships under each district.

[0081] Using geocoding technology, the geographical location names identified in the original social media text are matched with place names in a standard place name database. The edit distance algorithm is used to calculate the similarity (confidence) between the place names identified in the original social media text and the place names in the standard place name database. In this embodiment, the similarity threshold is set to 0.8.

[0082] This embodiment employs a multi-source information cross-validation mechanism, that is, a consistency verification strategy is used to ensure the accuracy of the geographic location of the original social media text, namely:

[0083] Determine whether the place names in the first and second regions are from the same region.

[0084] If the place names are from the same region, then the region name of the first or second region will be determined as the region to which the original social media text belongs.

[0085] If the place names are not from the same region, the similarity between the place names in the first region and the place names in the standard place name database is determined as the confidence level of the place names in the first region.

[0086] Determine the similarity between place names in the second region and place names in the standard place name database, and use this as the confidence level of place names in the second region.

[0087] The region with the highest confidence level between the first and second region place names is taken as the region to which the original social media text belongs.

[0088] When at least two types of information—GPS information, original social media text information, and information from a standard place name database (e.g., a national place name database)—point to the same geographical area (e.g., a tolerance range of 500 meters), the accuracy of the geographical location is confirmed. When the information is inconsistent, the geographical location information with the highest confidence level is used first. In cases where the first and second regional place names are not the same, this embodiment directly uses the geographical location information with the highest confidence level as the region corresponding to the original social media text.

[0089] Standardized Geographic Location Matching Confidence Score (CS_match): This confidence score is calculated by comparing the identified place name with the string similarity of place names in a standard database. This embodiment uses the Levenshtein distance algorithm to calculate the similarity. The formula is: CS_match = 1 - (edit distance / length of the longer string). For example, matching the identified "Confucius Temple East Gate" with "Confucius Temple" in the administrative region database, with an edit distance of 2 and a longer string length of 5, the similarity (confidence score) is 1 - (2 / 5) = 0.6.

[0090] After cross-validation, the standardized geographic location information is output as shown in Table 1.

[0091] Table 1 Standardized Geographic Location Information

[0092] Field Name Field value illustrate Location ID 320106_001_015 System-generated unique geographic location identifier province Jiangsu Province Provincial-level administrative divisions City Nanjing Prefecture-level city administrative divisions districts and counties Gulou District County-level administrative divisions street Hunan Road Subdistrict Street-level administrative divisions Points of interest Xinjiekou business district Specific geographical location or landmark longitude 118.778074 GPS coordinates longitude value latitude 32.041544 GPS coordinates latitude and longitude values Confidence 0.92 Location accuracy rating (0-1) Information source GPS + Text + Database Data sources for geographic location information Verification results Verified The final result status of cross-validation

[0093] After determining how to obtain the target region's geographic location information corresponding to the original social media text, a precise search is performed based on the target region's (e.g., target city) name and keywords related to the target region's name to obtain multiple original social media texts about the target region. In other words, multiple original social media texts are obtained based on the target region's place name. The method is as follows:

[0094] Keyword combination strategy: Construct a multi-level keyword system, with the target city name (e.g., "Nanjing") as the core, forming the following keyword combinations:

[0095] (1) Core city keywords: Nanjing, Ning, Jinling (including city aliases); (2) Administrative region keywords: Gulou, Xuanwu, Qinhuai, Jianye, Yuhuatai, Qixia, Pukou, Jiangning, Liuhe, Lishui, Gaochun; (3) Famous landmark keywords: Xinjiekou, Confucius Temple, Sun Yat-sen Mausoleum, Xuanwu Lake, Zijin Mountain, Olympic Sports Center, Hexi CBD, Jiangbei New Area and other landmarks; (4) Transportation hub keywords: Nanjing Station, Nanjing South Station, Lukou Airport, subway station names and other transportation nodes; (5) University business district keywords: Nanjing University, Southeast University, Nanjing University of Science and Technology, Deji Plaza, Wanda Plaza, Golden Eagle and other institutions; (6) Hot topic keywords: Dynamically updated current affairs hotspots, policy keywords, sudden events and other related words.

[0096] Data source platform selection: Select representative social media platforms: (1) Weibo platform: high coverage, strong real-time performance, set API call frequency to 10 times per second; (2) Zhihu platform: high content quality, in-depth viewpoints, obtained through a combination of RSS subscription and API; (3) Douyin comments: short video comments express emotions directly, obtained through third-party data interfaces.

[0097] Time range setting strategy: Set flexible time windows according to different analysis needs: (1) Real-time monitoring: Data of the last 24 hours, updated once per hour; (2) Short-term analysis: Data of the last 7 days, updated once per day; (3) Medium-term analysis: Data of the last 30 days, updated once per week; (4) Long-term trend: Data of the last 365 days, updated once per month; (5) Event-specific: Special data collection around 15 days before and after a specific event.

[0098] Basic data quality requirements: Ensure that the collected data meets basic quality standards: the text must contain clear geographical location information, have a complete publication time, be of moderate length (10-1000 characters), and originate from real user accounts. Specific data screening and quality control will be carried out in detail during the data preprocessing stage.

[0099] The acquisition of original social media text employs a three-stage process:

[0100] Phase 1: Initial URL acquisition based on keywords.

[0101] Construct a search request: Combine parameters such as city name, time range, and content type to construct a search URL.

[0102] Configure access policies: Use a random delay mechanism to avoid anti-crawler restrictions, and set up user agent rotation and IP proxy pool.

[0103] Get the results list: Extract the content page links from the search results page and create a queue of URLs to be crawled.

[0104] Phase Two: Extracting Data from Content Pages.

[0105] Page parsing: Uses web page parsing technology to identify the page structure and locate key information such as text content, publication time, user information, and geographical location.

[0106] Information extraction: Extract complete text content, publication timestamps, user identifiers, interaction data, etc. from the page;

[0107] Quality check: Verify the completeness of the extracted information, filter out incomplete or abnormally formatted data, and save the verified data collection results to the database.

[0108] Step 102: Convert the single raw social media text into text in the target format as standard text.

[0109] In this step, the raw social media text data undergoes multiple preprocessing steps: first, basic data cleaning is performed to remove invalid content; then, data format is standardized; and finally, data quality is ensured through screening, resulting in structured and standardized text data.

[0110] The first preprocessing step removes invalid or anomalous content from each original social media text, resulting in the first original text:

[0111] Formatting cleanup: Based on regular expressions, remove non-text content such as HTML tags, special symbols, and emojis from original social media text, and handle abnormal characters and garbled text issues.

[0112] Content filtering: Filter advertising information based on keyword blacklists and remove duplicate content using existing text similarity algorithms.

[0113] Preliminary screening: Filtering out obvious junk content and irrelevant information to provide a clean data foundation for subsequent processing.

[0114] The second preprocessing step converts the first raw text into a second raw text that includes time formatting, geographic information, text encoding, data type, and field structure.

[0115] Time format: uniformly YYYY-MM-DD HH:mm:ss format, where YYYY represents the year, MM represents the month, DD represents the day, HH represents the hour, mm represents the minute, and ss represents the second.

[0116] Geographic information: Standardized into a four-level structure of province-city-region-street.

[0117] Text encoding: UTF-8 SIG encoding is used uniformly.

[0118] Data types: Normalized numeric types and string formats.

[0119] Field structure: Establish a unified data field system to ensure consistency in subsequent processing.

[0120] The third preprocessing step uses machine learning algorithms to remove invalid or abnormal content from the second original text, resulting in standard text. This involves precise quality control through machine learning algorithms, filtering out irrelevant and spam content.

[0121] 1) Spam content identification: Based on machine learning classification algorithms, spam content is identified and filtered: (1) Feature engineering: Extract multiple dimensions of features such as user behavior features (posting frequency, account registration time, interaction ratio, etc.), content features (text length, repetition, sensitive word density, etc.), and time features (posting time pattern, etc.); (2) Classification model: Use random forest classification model to distinguish between normal content and spam content; (3) Threshold setting: Text with spam content probability ≥ 0.75 is filtered.

[0122] 2) City relevance screening: City relevance judgment based on deep learning text classification model: (1) Training data preparation: 1000 text samples each of city relevance and city irrelevant were manually labeled; (2) Feature extraction: Text semantic features were extracted using a pre-trained Chinese BERT model; (3) Classification model training: A binary classification model was trained based on labeled data to judge the relevance between text and city; (4) Automatic screening: Texts with a relevance score lower than 0.6 were filtered out.

[0123] 3) Quality assessment; conduct quality assessment on the screened text: (1) Completeness check: ensure the integrity of key fields such as text, time, and geographic location; (2) Consistency verification: verify the logical consistency between the text content and the geographic location.

[0124] After data preprocessing, the original social media text is converted into structured, standardized text data. The following is a specific example of information extraction:

[0125] The original social media text read: "I was waiting for the subway at Xinjiekou Station in Nanjing at 8 am this morning. There were so many people that I waited for 20 minutes before I could get on the train. Could the subway company please run more trains? #NanjingMetro #Commuters". The information extraction results are shown in Table 2.

[0126] Table 2 Information Extraction Results

[0127]

[0128] Step 103: Determine the emotion type corresponding to the standard text.

[0129] In this step, a dual verification method combining an emotion dictionary and a deep learning model is used to classify emotions in standardized text data (standard text).

[0130] Details of the integration and implementation of the basic emotion dictionary: The "Chinese Emotion Lexicon Ontology Database" constructed by the Information Retrieval Research Laboratory of Dalian University of Technology is used as the basic lexicon.

[0131] Specific Implementation of Expanding City-Specific Emotional Vocabulary: This involves supplementing city-specific emotional vocabulary through a combination of corpus mining and expert annotation.

[0132] (1) 120 terms related to transportation:

[0133] Positive emotional words (35): punctual, smooth, fast, convenient, comfortable, efficient, unimpeded, green light all the way, etc.

[0134] Negative emotion words (85): traffic jam, crowd, delay, congestion, road rage, waiting anxiety, commuting fatigue, queuing, overcrowded carriages, etc.

[0135] (2) 85 vocabulary words in the environmental and ecological field:

[0136] Positive emotion words (42): fresh air, beautiful greenery, beautiful environment, birds singing and flowers blooming, good air quality, shady trees, etc.

[0137] Negative emotion words (43): noise nuisance, heavy haze, air pollution, litter everywhere, dirty and messy environment, noise disturbing residents, etc.

[0138] (3) 95 vocabulary words in the public service field:

[0139] Positive emotion words (47): warm service, smooth handling of affairs, high efficiency, good attitude, convenient service, one-stop processing, etc.

[0140] Negative emotion words (48): queuing annoyance, low efficiency, bad attitude, difficult to handle affairs, shifting the blame, complex procedures, etc.

[0141] (4) 78 vocabulary words in the community life field:

[0142] Positive emotion words (45): harmonious neighborhood, convenient facilities, clean environment, warm community, complete supporting facilities, convenient life, etc.

[0143] Negative emotion words (33): neighborhood disputes, aging facilities, noisy environment, parking difficulties, irresponsible property management, etc.

[0144] Detailed design of the emotion classification system: Based on a 7-category and 21-subcategory emotion system of a basic word library supplemented with specific emotion vocabulary, construct a dedicated classification for urban emotion perception:

[0145] (1) Joy category (happiness): Includes subcategories such as happiness (PA), peace of mind (PE), etc., with a weight of 0.8.

[0146] Basic vocabulary: happy, joyful, delighted, satisfied, pleasant, glad, delighted, excited, comfortable, cozy, etc.

[0147] Intensity grading: mild joy (0.3 - 0.5), moderate joy (0.5 - 0.7), strong joy (0.7 - 0.9), extreme joy (0.9 - 1.0).

[0148] Urban characteristic words: satisfaction, happiness, sense of gain, convenience for the people, comfort, etc.

[0149] (2) Good category: Includes subcategories such as respect (PD), praise (PH), trust (PG), love (PB), wish (PK), etc., with a weight of 0.8.

[0150] Basic vocabulary: good, great, excellent, praise, nice, satisfied, recognized, supported, affirmed, commended, etc.

[0151] Intensity rating: Mild approval (0.3-0.5), Moderate satisfaction (0.5-0.7), Strong praise (0.7-0.9), Extremely admirable (0.9-1.0).

[0152] City-specific keywords: good service, excellent environment, standardized management, high efficiency, convenient and beneficial to the people, etc.

[0153] (3) Surprise class (Surprise): contains the Surprise (PC) subclass, with a weight of 0.5.

[0154] Basic vocabulary: shock, surprise, astonishment, amazement, surprise, unexpected, etc.

[0155] Key terms related to the city: policy changes, urban development, infrastructure changes, etc.

[0156] (4) Anger category: contains the Anger (NA) subclass, with a weight of 0.9.

[0157] Basic vocabulary: angry, annoyed, irritable, indignant, furious, dissatisfied, annoyed, indignant, indignant, etc.

[0158] City-specific keywords: road rage, complaints, dissatisfaction, poor service, chaotic management, etc.

[0159] (5) Grief category: includes subclasses such as sadness (NB), disappointment (NJ), guilt (NH), and longing (PF), with a weight of 0.6.

[0160] Basic vocabulary: sad, heartbroken, disappointed, frustrated, sad, depressed, down, etc.

[0161] Key words for describing the city: living pressure, high housing prices, etc.

[0162] (6) Fear category: includes subclasses such as panic (NI), fear (NC), and shame (NG), with a weight of 0.7.

[0163] Basic vocabulary: fear, worry, anxiety, unease, fear, worry, tension, panic, etc.

[0164] Key words related to the city: safety hazards, public security concerns, food safety, traffic safety, etc.

[0165] (7) Evil category: includes subclasses such as boredom (NE), hatred (ND), blame (NN), envy (NK), and suspicion (NL), with a weight of 0.8.

[0166] Basic vocabulary: dislike, aversion, annoyance, disgust, loathing, boredom, opposition, etc.

[0167] Urban characteristics: dirty and chaotic, noise pollution, environmental pollution, poor service, etc.

[0168] Dynamic dictionary update mechanism: (1) New word discovery: Identify semantically similar new words through word2vec word vector model; (2) Dictionary version control: Update the dictionary once a month and retain historical versions for comparative analysis; (3) Effect evaluation: Evaluate the impact of new words on the accuracy of emotion recognition through A / B testing.

[0169] Deep learning for sentiment polarity recognition.

[0170] API call flow:

[0171] Text preprocessing: Format the standardized text to ensure it meets API input requirements.

[0172] API call: Call the Baidu PaddlePaddle sentiment analysis model API via HTTPS protocol.

[0173] Results Analysis: Analyze the sentiment polarity score and confidence level returned by the API.

[0174] Exception handling: Handle API call failures or timeouts with fault tolerance.

[0175] Criteria for identifying sentiment categories in sentiment analysis models:

[0176] Extreme negative emotions: negative emotion score ≥ 0.9.

[0177] Strong negative emotions: Negative emotion score between 0.7 and 0.89.

[0178] Moderate negative emotions: Negative emotions score between 0.5 and 0.69.

[0179] Mild negative emotions: Negative emotion score between 0.3 and 0.49.

[0180] Neutral emotions: Both positive and negative emotion scores are <0.3.

[0181] Mild positive emotions: Positive emotion score between 0.3 and 0.49.

[0182] Moderate positive emotion: Positive emotion score between 0.5 and 0.69.

[0183] Strong positive emotions: Positive emotion score between 0.7 and 0.89.

[0184] Extreme positive emotion: positive emotion score ≥ 0.9.

[0185] In this step, the input standardized text data (standard text) is further processed. For example, the Jieba word segmentation tool is used to segment Chinese words, and city-specific words are added through a custom dictionary.

[0186] For example, identifying the emotion type corresponding to the standard text includes:

[0187] The standard text is segmented to obtain the emotion words in the standard text.

[0188] The first sentiment score (DictScore) of the standard text is calculated using the following formula:

[0189] DictScore = ∑(Wi·Fi).

[0190] Where Wi is the weight of the i-th emotion word in the standard text; Fi is the total number of the i-th emotion words in the standard text.

[0191] The positive and negative sentiment scores of the standard text are obtained. In this embodiment, the positive or negative sentiment scores and the classification criteria are directly output from the existing sentiment analysis model.

[0192] The difference between the positive sentiment score PosScore and the negative sentiment score NegScore of the standard text is used as the second sentiment score APIScore of the standard text, i.e., APIScore = PosScore - NegScore.

[0193] The FinalScore, the overall sentiment score of the standard text, is calculated using the following formula:

[0194] FinalScore=α·DictScore+β·APIScore.

[0195] Where α is the preset weight of the first emotion score; β is the preset weight of the second emotion score.

[0196] The emotion type corresponding to the standard text is identified based on the second emotion score and the comprehensive emotion score.

[0197] In this embodiment, the emotion type of the standard text is finally determined based on the comprehensive emotion score FinalScore and the polarity score of the deep learning API. The determination logic combines the priority identification of extreme emotions with the interval division of normal emotions, as detailed below:

[0198] Extreme Emotion Priority Judgment: To accurately capture extreme emotions that may attract significant social attention, this implementation establishes a priority judgment rule. This rule combines high-confidence judgments from a deep learning model with strength verification based on a comprehensive score.

[0199] Extreme Positive: When the API positive score is ≥0.9 and the FinalScore is ≥0.8, it is considered extremely positive.

[0200] Extreme Negative: When the API negative score is ≥0.9 and the FinalScore is ≤-0.8, it is judged as extremely negative.

[0201] Standard Emotion Range Determination: For texts not classified as extreme emotions, they will be categorized based on the range of their FinalScore (Final Emotion Score). The specific mapping relationship between score ranges and emotion types is shown in Table 3.

[0202] Table 3. Mapping Relationship Between Score Range and Emotion Type

[0203] FinalScore range Emotion Types [0.7,0.8) Strongly positive [0.5,0.7) medium front [0.3,0.5) Slightly positive (-0.3,0.3) neutral (-0.5,-0.3] Slight negative (-0.7,-0.5] Moderate negative (-0.8,-0.7] Strongly negative

[0204] When the results from the emotion dictionary and the deep learning model are inconsistent, the method with higher confidence should be used. Table 4 shows the results of the double-validation emotion annotation examples.

[0205] Table 4. Results of Annotated Examples of Revalidated Emotions

[0206]

[0207] Step 104: Determine the sentiment type index for all standard texts.

[0208] Step 105: Obtain the regions and topics mentioned in the standard text.

[0209] Step 106: Determine the regional index for all standard texts.

[0210] Step 107: Determine the topic index for all standard texts.

[0211] Step 108: Based on the sentiment type index, regional index, and theme index of all standard texts, determine the resident sentiment index to reflect the emotional state of residents in the target area.

[0212] Steps 104-108 introduce three indices: the Emotion-category Index (EI), which measures the overall performance of different emotion categories (such as joy, anger, and sorrow); the Regional Index (RI), which reflects the distribution of emotions across different geographical regions (such as administrative districts and business districts); and the Thematic Index (TI), which reflects the specific performance of emotions on different social topics (such as transportation and the environment).

[0213] Three types of preset weights were also introduced:

[0214] Emotion category weights: These are set based on the potential impact of different emotion categories on urban governance. For example, extreme negative emotions (such as "anger") will have a higher weight than neutral emotions.

[0215] Regional importance weighting: This is based on factors such as population density, economic status, and social functions of a region. For example, areas such as core business districts and transportation hubs will have higher weightings.

[0216] Topic attention weight: Based on the social attention (such as media coverage and discussion volume) of a specific topic within a specific time period.

[0217] For example, the sentiment index EI for all standard texts is calculated according to the following formula:

[0218]

[0219] Where N is the total number of standard texts; S n W represents the overall sentiment score of the nth standard text. e (n) represents the weight of the sentiment type to which the nth standard text belongs.

[0220] Calculate the regional index (RI) of all standard texts using the following formula:

[0221]

[0222] Where M is the total number of sub-regions within the target region; EI m W represents the sentiment type index of all standard texts referring to the m-th sub-region within the target region. r (m) represents the importance weight of the m-th sub-region within the target region.

[0223] The topic index (TI) of all standard texts is calculated using the following formula:

[0224]

[0225] Where P is the total number of topics in all standard texts; EI p W represents the sentiment type index of all standard texts mentioning the p-th topic. t (p) represents the attention weight of the p-th topic.

[0226] The Resident Sentiment Index (CI) within the target area is calculated using the following formula:

[0227]

[0228] Where a is the importance coefficient of the Emotion Type Index (EI) for all standard texts; b is the importance coefficient of the Regional Index (RI) for all standard texts; and c is the importance coefficient of the Theme Index (TI) for all standard texts.

[0229] The original social media texts collected in the Xinjiekou business district of Nanjing are an example.

[0230] Data sources: 1247 posts from Weibo, 356 posts from Tieba, 89 posts from Zhihu, and 234 posts from Xiaohongshu, totaling 1926 pieces of social media text data.

[0231] Time range: 00:00-23:59 on March 15, 2024.

[0232] Geographical scope: Xinjiekou business district and surrounding area within 1 kilometer.

[0233] Sentiment Distribution Statistics: This section analyzes the distribution of 1926 text data points across different sentiment categories. The "Average Score" refers to the arithmetic mean of the FinalScores (the overall sentiment scores of all texts within a given category), reflecting the average intensity of that sentiment category.

[0234] Extremely positive emotions: 63 (3.3%), average score 0.91.

[0235] Strong positive emotions: 146 (7.6%), average score 0.78.

[0236] Moderate positive sentiment: 239 items (12.4%), average score 0.62.

[0237] Mild positive emotions: 131 (6.8%), average score 0.41.

[0238] Neutral mood: 771 items (40.0%), average score 0.02.

[0239] Mild negative emotions: 187 (9.7%), average score -0.38.

[0240] Moderate negative emotions: 234 items (12.1%), average score -0.58.

[0241] Strong negative emotions: 119 (6.2%), average score -0.76.

[0242] Extreme negative emotions: 36 items (1.9%), average score -0.93.

[0243] Regional weight settings:

[0244] Xinjiekou core business district: weight 0.9, data volume 856 records.

[0245] Xinjiekou Station on Metro Lines 1 and 2: Weight 0.8, 423 data entries.

[0246] Surrounding pedestrian streets: weight 0.7, data volume 347 records.

[0247] Peripheral radiation area: weight 0.6, data volume 300 records.

[0248] Topic weighting:

[0249] Business services theme: weight 0.4, data volume 674 records (shopping, dining, service experience).

[0250] Transportation theme: weight 0.3, data volume 512 records (subway, bus, parking, walking).

[0251] Environmental facilities theme: weight 0.3, data volume 467 records (environmental sanitation, infrastructure, landscape).

[0252] Other topics: weight 0.2, data volume 273 records.

[0253] Calculation process:

[0254] Step 1: Calculate the Emotional Type Index (EI).

[0255] Total positive emotion score = (63×0.91+146×0.78+239×0.62+131×0.41) = 385.08.

[0256] Total negative emotion score = (187×(-0.38)+234×(-0.58)+119×(-0.76)+36×(-0.93)) = -297.45.

[0257] Neutral mood score = 771 × 0.02 = 15.42.

[0258] EI=(385.08+(-297.45)+15.42) / 1926=103.05 / 1926=0.0535.

[0259] Step 2: Calculate the regional index RI.

[0260] Area 1 (core business district): 856 streets × 0.0535 × 0.9 = 41.24.

[0261] Area 2 (Metro Station): 423 lines × 0.0542 × 0.8 = 18.35.

[0262] Area 3 (pedestrian street): 347 streets × 0.0528 × 0.7 = 12.83.

[0263] Region 4 (outer region): 300 items × 0.0521 × 0.6 = 9.38.

[0264] RI=(41.24+18.35+12.83+9.38) / (0.9+0.8+0.7+0.6)=81.80 / 3.0=0.0545.

[0265] Step 3: Calculate the Theme Index (TI).

[0266] Commercial services: 674 items × 0.0612 × 0.4 = 16.49.

[0267] Transportation: 512 routes × 0.0434 × 0.3 = 6.67.

[0268] Environmental facilities: 467 items × 0.0487 × 0.3 = 6.82.

[0269] Other topics: 273 items × 0.0521 × 0.2 = 2.84.

[0270] TI=(16.49+6.67+6.82+2.84) / (0.4+0.3+0.3+0.2)=32.82 / 1.2=0.0548.

[0271] Step 4: Calculate the Resident Sentiment Index (CI).

[0272] CI=(0.3×0.0535+0.3×0.0545+0.4×0.0548) / (0.3+0.3+0.4)=(0.01605+0.01635+0.02192) / 1.0

[0273] =0.05432.

[0274] For example, the Resident Sentiment Index (CI) is standardized, that is, mapped to a 0-100 point scale.

[0275] Standardized score = (0.05432 + 1.0) / 2.0 × 100 = 52.16 points.

[0276] In summary, this embodiment provides a method for monitoring residents' emotional states. By combining a Chinese emotion dictionary with a deep learning API, and employing a weighted fusion method for emotion recognition, it significantly improves the accuracy of emotion analysis, especially the ability to accurately identify extreme emotions (API score ≥ 0.9).

[0277] Street-level precise geolocation technology: Through the fusion and cross-validation of multi-source geographic information, it achieves a technological breakthrough from macro-urban sentiment perception to street-level precise positioning, and can identify geographic location information in social media text and associate it with sentiment data.

[0278] City-specific emotion recognition and fine-grained classification: This method expands the city-specific emotion dictionary to address the unique emotion words and expressions of cities, enabling multi-level emotion intensity classification and solving the problem of coarse emotion classification in traditional methods.

[0279] A multi-dimensional integrated urban mood index construction model: Through the fusion algorithm of emotion category weight, regional weight and theme weight, the model can accurately quantify the emotional state of urban residents.

[0280] Based on the same inventive concept as Embodiment 1, this embodiment provides a resident emotional state monitoring system. Since the principle of this system in solving the problem is similar to the resident emotional state monitoring method provided in Embodiment 1, the implementation of this system can refer to the implementation of the resident emotional state monitoring method provided in Embodiment 1.

[0281] like Figure 2 As shown, the resident emotional state monitoring system includes:

[0282] The first acquisition module 10 is used to acquire multiple raw social media texts of the target area.

[0283] The conversion module 20 is used to convert a single raw social media text into text in a target format for use as standard text.

[0284] The first determining module 30 is used to determine the emotion type corresponding to the standard text.

[0285] The second determination module 40 is used to determine the sentiment type index of all standard texts.

[0286] The second acquisition module 50 is used to acquire the regions and topics mentioned in the standard text.

[0287] The third determination module 60 is used to determine the regional index of all standard texts.

[0288] The fourth determination module 70 is used to determine the topic index of all standard texts.

[0289] The fifth determination module 80 is used to determine the resident sentiment index, which reflects the emotional state of residents in the target area, based on the sentiment type index, regional index, and theme index of all standard texts.

[0290] For more detailed information on the working process of each of the above modules, please refer to the relevant content disclosed in Example 1, which will not be repeated here.

[0291] Example 3

[0292] This embodiment provides a computer device, including a processor and a memory; wherein, when the processor executes a computer program stored in the memory, it implements the steps of the resident emotional state monitoring method described in Embodiment 1.

[0293] For a more detailed explanation of the above method, please refer to the relevant content disclosed in Example 1, which will not be repeated here.

[0294] Example 4

[0295] This embodiment provides a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, it implements the steps of the resident emotional state monitoring method described in Embodiment 1.

[0296] For a more detailed explanation of the above method, please refer to the relevant content disclosed in Example 1, which will not be repeated here.

[0297] Example 5

[0298] This embodiment provides a computer program product, including computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, they implement the steps of the resident emotional state monitoring method described in Embodiment 1.

[0299] For a more detailed explanation of the above method, please refer to the relevant content disclosed in Example 1, which will not be repeated here.

[0300] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems, devices, storage media, and computer program products disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.

[0301] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments of the present invention.

[0302] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.

[0303] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).

[0304] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.

[0305] The present invention has been described in detail above with reference to specific embodiments and exemplary examples; however, these descriptions should not be construed as limiting the present invention. Those skilled in the art will understand that various equivalent substitutions, modifications, or improvements can be made to the technical solutions and embodiments of the present invention without departing from the spirit and scope of the invention, and all such modifications and improvements fall within the scope of the present invention. The scope of protection of the present invention is defined by the appended claims.

Claims

1. A method for monitoring residents' emotional state, characterized in that, include: Obtain multiple raw social media texts from the target region; Convert individual raw social media texts into text in the target format for use as standard text; Determine the emotion type corresponding to the standard text; Determine the sentiment type index for all standard texts; Retrieve the regions and topics mentioned in the standard text; Determine the regional index for all standard texts; Determine the topic index for all standard texts; Based on the sentiment type index, regional index, and theme index of all standard texts, a resident sentiment index is determined to reflect the emotional state of residents in the target area.

2. The method for monitoring residents' emotional state according to claim 1, characterized in that, The acquisition of multiple original social media texts from the target region includes: The location information of the original social media text published by the social media platform is extracted through the API interface, and / or the geographic tags set by the user when publishing the original social media text content are obtained to get the first regional place name; A BERT-based named entity recognition model is used to identify geographic location descriptions in original social media text to obtain second region place names; Determine whether the place names in the first and second regions are from the same region. If the place names are from the same region, then determine whether the first or second region name is the region to which the original social media text belongs; If the place names are not from the same region, the similarity between the place names in the first region and the place names in the standard place name database is determined as the confidence level of the place names in the first region. Determine the similarity between place names in the second region and place names in the standard place name database, and use this as the confidence level of place names in the second region; The region with the highest confidence level between the first and second region place names is taken as the region to which the original social media text belongs; Retrieve multiple original social media texts corresponding to the place names in the target area.

3. The method for monitoring residents' emotional state according to claim 1, characterized in that, The process of converting a single raw social media text into text in a target format for use as standard text includes: Remove invalid or anomalous content from each original social media text to obtain the first original text; The first raw text is converted into a second raw text that includes time format, geographic information, text encoding, data type, and field structure; Machine learning algorithms are used to remove invalid or abnormal content from the second original text to obtain the standard text.

4. The method for monitoring residents' emotional state according to claim 1, characterized in that, Determining the emotion type corresponding to the standard text includes: The standard text is segmented to extract sentiment words. The weight of each emotion word is obtained based on the emotion dictionary; The first sentiment score (DictScore) of the standard text is calculated using the following formula: DictScore = ∑(Wi·Fi); Where Wi is the weight of the i-th emotion word in the standard text; Fi is the total number of the i-th emotion words in the standard text; Use sentiment analysis models to obtain positive and negative sentiment scores for standard texts; The difference between the positive sentiment score and the negative sentiment score of the standard text is used as the second sentiment score APIScore of the standard text. The FinalScore, the overall sentiment score of the standard text, is calculated using the following formula: FinalScore=α·DictScore+β·APIScore; Where α is the preset weight of the first emotion score; β is the preset weight of the second emotion score; The emotion type corresponding to the standard text is determined based on the second emotion score and the comprehensive emotion score.

5. The method for monitoring residents' emotional state according to claim 4, characterized in that, The process of obtaining the preset weight for each emotion word based on the emotion dictionary includes: Based on the Chinese emotional vocabulary ontology, multiple positive and negative emotional words from the fields of transportation, environment and ecology, public services and community life are added to construct an emotional dictionary; The emotion dictionary is divided into five categories: joy, good, surprise, anger, sorrow, fear, and evil. Each category of emotion is assigned a corresponding weight.

6. The method for monitoring residents' emotional state according to claim 4, characterized in that, The determination of the sentiment type index for all standard texts includes: The EI (Emotion Type Index) for all standard texts is calculated using the following formula: Where N is the total number of standard texts; S n W represents the overall sentiment score of the nth standard text. e (n) represents the weight of the sentiment type to which the nth standard text belongs.

7. The method for monitoring residents' emotional state according to claim 1, characterized in that, The determination of the regional indices for all standard texts includes: Calculate the regional index (RI) of all standard texts using the following formula: Where M is the total number of sub-regions within the target region; EI m W represents the sentiment type index of all standard texts referring to the m-th sub-region within the target region. r (m) represents the importance weight of the m-th sub-region within the target region.

8. The method for monitoring residents' emotional state according to claim 1, characterized in that, The determination of the topic index for all standard texts includes: The topic index (TI) of all standard texts is calculated using the following formula: Where P is the total number of topics in all standard texts; EI p W represents the sentiment type index of all standard texts mentioning the p-th topic. t (p) represents the attention weight of the p-th topic.

9. The method for monitoring residents' emotional state according to claim 1, characterized in that, The step of determining the residents' emotional index within the target area based on the emotional type index, regional index, and topic index of all standard texts to represent the residents' emotional state within the target area includes: The Resident Sentiment Index (CI) within the target area is calculated using the following formula: Where a is the importance coefficient of the Emotion Type Index (EI) for all standard texts; b is the importance coefficient of the Regional Index (RI) for all standard texts; and c is the importance coefficient of the Theme Index (TI) for all standard texts.

10. A resident emotional state monitoring system, characterized in that, include: The first acquisition module is used to acquire multiple raw social media texts from the target area; The conversion module is used to convert individual raw social media texts into text in a target format for use as standard text. The first determination module is used to determine the emotion type corresponding to the standard text; The second determination module is used to determine the sentiment type index of all standard texts; The second acquisition module is used to acquire the regions and topics mentioned in the standard text; The third determination module is used to determine the regional index of all standard texts; The fourth module is used to determine the topic index of all standard texts; The fifth determination module is used to determine the resident sentiment index, which reflects the emotional state of residents in the target area, based on the sentiment type index, regional index, and theme index of all standard texts.