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

如何从Stanford NLP输出(JSON/XML)识别指定动作动词?

Extracting Target Action Verbs from Stanford CoreNLP Output

Absolutely! You can absolutely pull the specific action verbs you want (like assigns and make in your example, excluding tries) from Stanford CoreNLP's JSON or XML results. The key is to combine part-of-speech (POS) tagging with dependency parsing to distinguish between "action verbs" and verbs that express intention/attempt (like tries).

Step 1: Understand the Role of Each Verb in Your Sentence

Looking at your parsed tree, let’s break down each verb’s syntactic role:

  • assigns (VBZ): This is the core action verb of the subordinate clause ("when a teacher assigns a project"). It’s an independent, concrete action with no higher-level intention verb governing it—so it’s a keeper.
  • tries (VBZ): This is the root verb of the main clause, but it only expresses the student’s attempt to perform an action. The actual concrete action happens in its complement clause—so we exclude it.
  • make (VB): This is the core verb of the infinitive complement (to make it) attached to tries. It’s the concrete action the student is attempting, so it’s a keeper.

Step 2: Extract & Filter from JSON/XML Output

Stanford CoreNLP’s JSON/XML output includes both POS tags and dependency relationships, which we’ll use to filter:

First: Filter for Verbs via POS Tags

First, pull all tokens with verb POS tags. These include:

  • VB (base form verb, e.g., make)
  • VBZ (3rd person singular present, e.g., assigns, tries)
  • Other verb tags like VBD (past tense), VBG (gerund), VBN (past participle), VBP (plural present)

Second: Filter Out Intention/Attempt Verbs via Dependency Parsing

Next, use dependency labels to exclude verbs that act as "intention holders" (like tries):

  • Look for verbs that are marked as the ROOT of the main clause, and have an xcomp (open clausal complement) dependency pointing to another verb. These verbs (like tries) are typically intention/attempt verbs that don’t represent the concrete action you want.
  • Alternatively, maintain a small list of common intention/attempt verbs (e.g., try, want, plan, intend, attempt) and exclude any lemma matching these terms.

Example JSON Logic

In CoreNLP’s JSON output, each token will have fields like pos, dep (dependency label), governor, and lemma. For your sentence:

  • The token for assigns will have pos: "VBZ" and dep: "ROOT" (of its subordinate clause) → keep it.
  • The token for tries will have pos: "VBZ", dep: "ROOT" (main clause), and will have a dependent token (make) with dep: "xcomp" → exclude it.
  • The token for make will have pos: "VB" and dep: "xcomp" → keep it.

Final Note

This approach works reliably because it combines syntactic structure (dependency parsing) with basic POS filtering to target exactly the concrete action verbs you need, while excluding verbs that only express intention or attempt.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 06:35:23