Improvement and Application of TF-IDF Algorithm in Text Orientation Analysis

Wei Wang, Yongxin Tang2016

Abstract

In this paper, an improved method based on the traditional TF-IDF algorithm is proposed for text orientation analysis. By incorporating position weight coefficients and word class weight coefficients, the algorithm balances the influence of high-frequency terms. Experimental results demonstrate that the improved algorithm achieves superior precision and recall rates, ensuring that keyword selection more accurately reflects the document's content orientation.

Introduction

In the era of Web 2.0, text orientation analysis—determining the sentiment or emotional lean of a document—has become essential for applications ranging from public opinion monitoring to financial forecasting. The industry standard for keyword weighting has long been TF-IDF (Term Frequency-Inverse Document Frequency). However, traditional TF-IDF treats every word occurrence as equally important, ignoring the structural and grammatical context that often defines sentiment.

This research addresses two primary limitations of the standard approach: it ignores the physical location of a word (e.g., title vs. body) and fails to distinguish between grammatical roles (e.g., nouns vs. verbs). To solve this, the authors propose an "Improved TF-IDF" model that integrates structural awareness and linguistic importance.

Methodology

The authors introduce three specific modifications to the traditional TF-IDF formula to create a more balanced and context-aware weighting system:

  1. Position Weight Coefficient ($b_t$): Recognizing that web documents have a hierarchy, weights are assigned based on HTML-style tags. Words appearing in titles or headers are given higher priority than those in the body text.
Table 1: Keyword tag position and weight coefficients
  1. Word Class Weight Coefficient ($P_t$): Nouns are identified as the primary carriers of information and sentiment subjects. Consequently, nouns are assigned a weight of 2.5, while verbs, adjectives, and adverbs receive a weight of 1.0. Other word classes are excluded from the calculation.
  2. TF Balancing (The Cubic Root): To prevent highly repetitive words from skewing the results, the authors replace raw Term Frequency ($TF$) with its cubic root ($\sqrt[3]{TF}$). This smoothing technique ensures that a single repetitive term does not drown out other meaningful keywords.

The final weight for a word $t$ in document $d$ is calculated as: $$w(t, d) = \sqrt[n]{tf(t, d)} \times \log\left(\frac{N}{N_t}\right) \times P_t \times b_t$$

Experimental Evaluation

The algorithm was evaluated using the COAE2015 (Chinese Opinion Analysis Evaluation) corpus. A balanced dataset of 1,500 texts was selected, consisting of 500 positive, 500 negative, and 500 neutral samples. These texts covered diverse domains, including economy, entertainment, news, sports, commodities, and politics.

Results and Discussion

The improved algorithm was tested against standard TF-IDF and raw TF using a Support Vector Machine (SVM) classifier. The results showed consistent improvements across all key performance metrics.

Table 2: Comparison of Recall, Precision, and F-measure across algorithms

As shown in the results, the improved model reached an F-measure of 71.81%, outperforming the traditional TF-IDF (70.51%) and raw TF (69.69%). The model performed particularly well in categories like "Sports" and "Politics," where specific nouns and structural titles are highly indicative of the overall sentiment. By smoothing the term frequency and emphasizing structural hierarchy, the algorithm effectively filters noise and focuses on the most relevant orientation indicators.

Conclusion

The proposed improvements to the TF-IDF algorithm significantly enhance the accuracy of text orientation analysis. By accounting for word position and grammatical class, the model provides a more nuanced understanding of document content. Future work may involve using machine learning to automatically optimize weight coefficients and testing the algorithm's effectiveness across different languages and modern transformer-based architectures.

Summary updated

BibTeX
@misc{wang2016improvement,
  author = {Wei Wang and Yongxin Tang},
  title = {{Improvement and Application of TF-IDF Algorithm in Text Orientation Analysis}},
  year = {2016},
  doi = {10.2991/amsee-16.2016.61},
}
Figure