Noun Phrases
Learn about the concept of a noun phrase.
Last updated
Was this helpful?
Learn about the concept of a noun phrase.
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.
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.
# Create a noun phrase with a head and modifiers
np = NounPhrase("dog", ["big", "white"])
print(np) # Outputs: big white dogIn this example:
Head: "dog"
Modifiers: "big", "white"
The resulting noun phrase is "big white dog".
Parameters can be defined as NounPhrase types to tell the system to use a fact's name instead of its value.
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?
Was this helpful?
@procedure("to get the (current temperature) at a city")
def current_temperature(
self, city: NounPhrase, unit: Optional[NounPhrase] = NounPhrase("metric")
) -> float:London is "windy"
get the current temperature at London
