You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

复杂语句意图分类:带筛选条件的电影查询意图处理问题

Hey there! Let's tackle this dual-filter intent classification problem you're facing—you're already halfway there with the entities and action types identified, so let's build on that foundation to handle those complex "but" queries.

Approach to Dual-Filter Intent Classification for Complex Movie Queries

1. Define Composite Intent Labels

Stop limiting yourself to single-purpose intents. Instead, create combined labels that explicitly capture the dual conditional logic in each query. For your examples, these would look like:

  • filter_movie_watched_by_X_not_watched_by_Y (for "Srikanth看过但Tarun没看过的电影")
  • filter_movie_directed_by_X_excluding_cast_Y (for "Christopher Nolan执导但没有Christian Bale参演的电影")
  • filter_movie_watched_by_X_disliked_by_Y (for "Srikanth看过但Tarun不喜欢的电影")

These labels make it instantly clear that the intent requires applying two linked filters, not just one.

2. Model Intents as Sub-Intent + Logical Operator Pairs

Each query uses "but" as a logical AND (both conditions must be true, with the second being a negation or opposite of a related action). You can structure each intent to reflect this:

  • A primary sub-intent (e.g., user_watched_movie with entity Srikanth)
  • A secondary sub-intent (e.g., user_not_watched_movie with entity Tarun, cast_not_in_movie with entity Christian Bale)
  • A fixed logical operator (AND, since both filters need to be satisfied)

Here's how you might represent this in a schema for your system:

{
  "intent_type": "dual_filter_movie",
  "sub_intents": [
    {"action": "watched", "target_entity": "Srikanth"},
    {"action": "not_watched", "target_entity": "Tarun"}
  ],
  "operator": "AND"
}

3. Use Rule-Based Matching for Consistent Query Patterns

Since your queries follow a predictable structure ([Entity] [Action] but [Entity] [Opposite/Exclusion Action]), start with rule-based triggers to catch these cases reliably:

  • First, check for the presence of "but" (or its equivalents in your language) in the query
  • Split the query into two segments at the "but" marker
  • Extract the entity and action type from each segment
  • Map the combination of actions and entities to your pre-defined composite intent labels

For example, splitting your first query:

  • Left segment: "Srikanth看过" → action: watched, entity: Srikanth
  • Right segment: "Tarun没看过" → action: not_watched, entity: Tarun
  • Mapped intent: filter_movie_watched_by_X_not_watched_by_Y

4. Train a ML Model on Annotated Composite Intent Data

If you need to scale to more varied phrasing (e.g., "Show me films Srikanth saw that Tarun hasn't gotten to yet"), annotate a dataset with your composite intent labels and train a classification model. Make sure to include:

  • Variations of the same core query (different wording, synonyms for "watched" or "directed")
  • Edge cases (e.g., queries with more formal language or reversed order of conditions)

The key here is to train the model to recognize the relationship between the two entities and their respective actions, not just identify individual entities in isolation.

Once you've classified the intent, translate it directly into a structured query for your database. For example, for the filter_movie_watched_by_X_not_watched_by_Y intent:

SELECT movie_title 
FROM movies
WHERE movie_id IN (
  SELECT movie_id FROM user_movie_interactions 
  WHERE user_id = (SELECT id FROM users WHERE name = 'Srikanth') AND interaction_type = 'watched'
)
AND movie_id NOT IN (
  SELECT movie_id FROM user_movie_interactions 
  WHERE user_id = (SELECT id FROM users WHERE name = 'Tarun') AND interaction_type = 'watched'
)

This bridges the gap between intent classification and actually retrieving the movies the user wants.

内容的提问来源于stack exchange,提问作者Tarun

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 07:05:09