Noun Phrases

Learn about the concept of a noun phrase.

Overview

A noun phrase is a group of words centered around a noun. It consists of:

  • Head: The main noun representing the fact.

  • Modifiers: Optional words providing additional context to the head noun.

The NounPhase class can be used to represent a noun phrase.

Modifiers

A modifier is an optional part of a noun phrase that provides additional detail about the head noun. It appears before the head and refines the fact being referenced.

Example: Creating a Noun Phrase with Modifiers

# Create a noun phrase with a head and modifiers
np = NounPhrase("dog", ["big", "white"])
print(np)  # Outputs: big white dog

In this example:

  • Head: "dog"

  • Modifiers: "big", "white"

The resulting noun phrase is "big white dog".


Parameters as Noun Phrases

Parameters can be defined as NounPhrase types to tell the system to use a fact's name instead of its value.

Example: Defining a Parameter as a Noun Phrase

Consider the following procedure method definition, where the city parameter is defined as a NounPhrase:

This procedure can be called in an automation where London is a fact with a specific value:

In this example, when London is specified as the city parameter, the system uses the name of the fact (London) instead of its value ("windy").

Last updated

Was this helpful?