Learning to Recommend Quotes for Writing

Jiwei Tan, Xiaojun Wan, Jianguo Xiao

Introduction

Citing a well-timed proverb or a famous saying can significantly enhance the persuasiveness and elegance of prose. However, writers frequently encounter a "tip-of-the-tongue" phenomenon: they possess a conceptual idea they wish to bolster with a quotation but cannot recall the specific phrasing or the author. Traditional keyword-based search engines often fail in this domain due to the vocabulary gap. Quotes are frequently metaphorical or utilize archaic language that does not overlap with modern prose. For instance, a writer discussing "hard work" might seek the quote "Diligence is the mother of good luck," yet a search for "success" or "hard work" may miss this entirely. This paper proposes a novel framework to bridge this semantic gap by learning to recommend quotes based on the context of a writer's work.

Methodology

The researchers frame quote recommendation as a Learning to Rank (LTR) problem. Rather than relying on simple retrieval, they developed a model that ranks candidate quotes using three distinct feature categories:

  1. Quote-Based Features: These capture the intrinsic authority of a quote, utilizing metrics such as user votes from quote repositories, author popularity, and a "Quote-Rank" based on PageRank algorithms.
  2. Relevance-Based Features: To address the vocabulary gap, the model employs semantic techniques including Latent Semantic Analysis (LSA), Latent Dirichlet Allocation (LDA), and Word2Vec to identify similarities in a latent "concept space."
  3. Context-Based Features: This novel component analyzes the historical contexts—the sentences surrounding a quote in existing literature—to compare a user's current writing against established usage patterns.

The ranking is optimized using Coordinate Ascent, a listwise LTR method that directly targets evaluation metrics such as Normalized Discounted Cumulative Gain (NDCG).

Dataset and Benchmark

To evaluate the system, the authors constructed a massive new benchmark by crawling approximately 380,000 quotes from the Library of Quotes and processing 20GB of raw text from Project Gutenberg. This resulted in a filtered dataset of 64,323 context-quote pairs involving 3,158 unique quotes, providing a realistic foundation for how quotes are utilized in professional literature.

Results and Performance

The proposed LTR model significantly outperformed several state-of-the-art baselines, including simple Cosine Similarity and more complex embedding models like BLSRec. As shown in the performance analysis, the model achieved a Mean Reciprocal Rank (MRR) of 0.360, a substantial improvement over the 0.106 achieved by keyword matching.

Recall performance of the proposed approach compared to various baselines across different top-k values.

In terms of recall, the system successfully identified the correct "gold" quote within the top 30 recommendations over 50% of the time, demonstrating its practical utility for writers.

The Critical Role of Context

A key insight of this research is that a quote's own text is often less informative for recommendation than the text surrounding it in historical examples. The authors conducted an ablation study to quantify the impact of different feature sets.

Ablation study illustrating the significant performance drop when context-based features are removed.

When "Context-Based" features were removed, the MRR plummeted from 0.360 to 0.097. This confirms that historical usage data is the primary driver of effective recommendation, effectively giving each quote a larger "semantic footprint" through its surrounding prose.

Conclusion

By leveraging a Learning to Rank framework and historical context, this approach provides a robust solution to the vocabulary gap in quote retrieval. While the reliance on historical data presents challenges for rare quotes (the "long tail"), the integration of context-based features represents a significant step forward. Future work may involve deep learning techniques to further model the metaphorical nature of quotations and improve performance on quotes with limited historical usage.

Summary updated

BibTeX
@inproceedings{tan2015learning,
  author = {Jiwei Tan and Xiaojun Wan and Jianguo Xiao},
  title = {{Learning to Recommend Quotes for Writing}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2015},
  doi = {10.1609/aaai.v29i1.9530},
}
Figure