Using Conditional Random Fields to Extract Contexts and Answers of Questions from Online Forums

Shilin Ding, Gao Cong, Chin-Yew Lin, Xiaoyan Zhu

Abstract

Online forums are rich repositories of knowledge, yet extracting structured information from them is challenging due to the informal and underspecified nature of user posts. Questions often depend on preceding context for clarity, and answers may be interleaved within complex discussion threads. This paper proposes a framework using Conditional Random Fields (CRFs) to automatically extract Question-Context-Answer triples. By modeling sequential dependencies and semantic relationships through Linear-chain, Skip-chain, and 2D CRF architectures, the proposed approach significantly outperforms traditional classification baselines in identifying both question context and relevant answers.

Introduction

Online platforms like TripAdvisor or Reddit serve as invaluable sources for Question-Answering (QA) data. However, unlike formal FAQs, forum questions are frequently "underspecified." For instance, a query like "Is it necessary to take a taxi?" is uninterpretable without the preceding context: "We plan to go shopping in Causeway Bay." Research indicates that approximately 74% of forum questions require such external context to be fully understood.

Two primary challenges complicate extraction: contextual dependency, where answers often relate more to the background context than the question itself, and interweaved discussions, where asynchronous replies make it difficult to map specific answers to their corresponding queries.

Methodology

To address these challenges, the authors utilize Conditional Random Fields (CRFs), which excel at modeling dependencies in sequential data. Three specific architectures were evaluated:

  • Linear-chain CRFs: These capture the conversational flow by modeling the statistical probability that contiguous sentences share the same label (e.g., if sentence A is context, sentence B is likely context).
  • Skip-chain CRFs: These address the distance between questions and answers. By creating "skip edges" between distant but semantically similar sentences (using WordNet and Cosine similarity), the model bridges the gap across multiple intervening posts.
  • 2D CRFs: This novel approach treats a forum thread as a grid. One axis represents the sentence sequence, while the other represents different questions within the thread, allowing a single sentence to be identified as context or an answer for multiple queries simultaneously.
Architectures of Linear, Skip-chain, and 2D CRFs for modeling forum dependencies.

Experimental Setup

The study utilized a corpus of approximately 1 million threads from the TripAdvisor forum. A subset of 579 threads was manually annotated, resulting in a dataset of 1,064 questions, 1,458 context segments, and 3,534 answers. High inter-annotator agreement (Kappa scores up to 0.96) confirmed that "context" is a linguistically recognizable feature in these discussions.

Key Results and Discussion

The CRF-based models consistently outperformed traditional baselines such as Support Vector Machines (SVM) and Decision Trees (C4.5).

Performance comparison of SVM, C4.5, and Linear CRF (L-CRF) for context and answer detection.

As shown in the results, the Linear CRF (L-CRF) provides a substantial boost in F1-scores over non-sequential models. Further refinements yielded even higher performance:

  • Context Detection: The 2D+Skip-chain CRF achieved the highest performance with an F1-score of 77.34%.
  • Answer Detection: The Skip-chain CRF proved most effective for linking distant replies, reaching an F1-score of 69.40%.

The Role of Context

A critical insight from the study is that identifying context is not merely an auxiliary task; it is essential for accurate answer detection. Answers often share more lexical overlap with the context than the question. By explicitly labeling context, the model can "triangulate" the correct answer even when the question and answer share no common keywords. Furthermore, the authors debunked the "positional heuristic," finding that while 63% of sentences immediately preceding a question are context, they represent only 34% of the total correct context segments in the dataset.

Limitations and Future Work

The model encountered difficulties with "Type 3" contexts—cases where a question is syntactically complete but constrained by external facts (e.g., "I am flying from London" preceding "Can anyone recommend a tour?"). Additionally, automated anaphora resolution (resolving pronouns like "it") surprisingly decreased performance, likely due to the informal and ungrammatical nature of forum text.

Future research will focus on scaling the framework to summarize multiple threads and utilizing extracted contexts to reformulate forum questions into standalone, searchable queries for broader knowledge base integration.

Summary updated

BibTeX
@inproceedings{ding2008using,
  author = {Shilin Ding and Gao Cong and Chin-Yew Lin and Xiaoyan Zhu},
  title = {{Using Conditional Random Fields to Extract Contexts and Answers of Questions from Online Forums}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2008},
}
Figure