Skip to content

Syntax Analysis Config

🔵 Default value: SyntaxOptions()

In the Syntax config, users can modify thresholds to determine what is considered a short or a long utterance, as well as select the spaCy model and the dependency tags used for certain syntax-related smart tags. More details are explained in Syntax Analysis.

Note that language-related defaults are dynamically selected based on the language specified in the Language Config (default is English). As such, the spaCy model and dependency tag lists will generally not need to be modified.

from pydantic import BaseModel

class SyntaxOptions(BaseModel):
    short_utterance_max_word int = 3 # (1)
    long_utterance_min_word: int = 12 # (2)
    spacy_model: SupportedSpacyModels = SupportedSpacyModels.use_default  # Language-based default (3)
    subj_tags: List[str] = []  # Language-based default value (4)
    obj_tags: List[str] = []  # Language-based default value (5)
  1. Maximum number of words for an utterance to be tagged as short (e.g <=3 for the default)
  2. Minimum number of words for an utterance to be tagged as long (e.g >=12 for the default)
  3. spaCy model to use for syntax tagging.
  4. spaCy dependency tags used to determine whether a word is a subject (noun).
  5. spaCy dependency tags used to determine whether a word is an object (noun).
{
  "syntax": {
    "short_utterance_max_word": 5
  }
}
import spacy

# Part of Speech
subj_tags = ["nsubj", "nsubjpass"]
obj_tags = ["dobj", "pobj", "dobj"]
spacy_model = spacy.load("en_core_web_sm")
import spacy

# Part of Speech
subj_tags = ["nsubj", "nsubj:pass"]
obj_tags = ["obj", "iobj", "obl:arg", "obl:agent", "obl:mod"]
spacy_model = spacy.load("fr_core_news_md")