Noun-phrases

At a glance

The Noun Phrases model extracts non-overlapping noun phrases from the input text. For example, in the text:

Anna went to school at University of California Santa Cruz

the noun phrases extracted are: Anna, school, University of California Santa Cruz.

Class definition
watson_nlp.blocks.noun_phrases.rbr.RBR

For language support, see Supported languages.

Pretrained models

Model names are listed below.

Model ID Container Image
noun-phrases_rbr_lang_ar_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_ar_stock:1.4.1
noun-phrases_rbr_lang_cs_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_cs_stock:1.4.1
noun-phrases_rbr_lang_da_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_da_stock:1.4.1
noun-phrases_rbr_lang_de_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_de_stock:1.4.1
noun-phrases_rbr_lang_en_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_en_stock:1.4.1
noun-phrases_rbr_lang_es_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_es_stock:1.4.1
noun-phrases_rbr_lang_fi_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_fi_stock:1.4.1
noun-phrases_rbr_lang_fr_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_fr_stock:1.4.1
noun-phrases_rbr_lang_he_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_he_stock:1.4.1
noun-phrases_rbr_lang_hi_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_hi_stock:1.4.1
noun-phrases_rbr_lang_it_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_it_stock:1.4.1
noun-phrases_rbr_lang_ja_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_ja_stock:1.4.1
noun-phrases_rbr_lang_ko_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_ko_stock:1.4.1
noun-phrases_rbr_lang_nb_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_nb_stock:1.4.1
noun-phrases_rbr_lang_nl_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_nl_stock:1.4.1
noun-phrases_rbr_lang_nn_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_nn_stock:1.4.1
noun-phrases_rbr_lang_pl_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_pl_stock:1.4.1
noun-phrases_rbr_lang_pt_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_pt_stock:1.4.1
noun-phrases_rbr_lang_ro_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_ro_stock:1.4.1
noun-phrases_rbr_lang_ru_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_ru_stock:1.4.1
noun-phrases_rbr_lang_sk_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_sk_stock:1.4.1
noun-phrases_rbr_lang_sv_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_sv_stock:1.4.1
noun-phrases_rbr_lang_tr_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_tr_stock:1.4.1
noun-phrases_rbr_lang_zh-cn_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_zh-cn_stock:1.4.1
noun-phrases_rbr_lang_zh-tw_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_zh-tw_stock:1.4.1
noun-phrases_rbr_lang_zh_stock cp.icr.io/cp/ai/watson-nlp_noun-phrases_rbr_lang_zh_stock:1.4.1

In general, noun phrases are complex. The following table describes a few possible implementations of noun phrases:

Type Definition and Computational considerations
Simple
Noun Phrases
  • Non-recursive structure consisting of a head noun and zero or more pre-modifier determiners, adjectives, numerals and/or nouns. The base noun phrase does not include noun phrase post-modifiers such as prepositional phrases or relative clauses.
  • By definition, simple noun phrases are non-overlapping
  • Computationally efficient as it only requires only parts of speech, but may miss some noun phrases
Complex
Noun Phrases
  • Recursive structure consisting of a head noun, any premodifiers (noun/adjectives/determiners) and postmodifiers (prepositional phrases, relative clauses)
  • By definition, complex noun phrases are overlapping (recursive structure)
  • Computes all noun phrases, but requires full syntactic analysis (dependency parsing) to disambiguate when post-modifiers attach to nouns (and therefore form noun phrases), as opposed to verbs. This option is therefore computationally more expensive.
Hybrid
Noun Phrases
  • Simple noun phrases, plus a restricted subset of Complex NPs allowing less ambiguous prepositional phrases that are more likely to accompany nouns (e.g., "of") as opposed to verbs (e.g., "at", "in")
  • Can be overlapping or non-overlapping
  • Provides a practical trade-off between completeness of result and computational efficiency because it can be implemented on top of part of speech, without requiring full dependency parse.

The following table illustrates the differences between these implementations, where noun phrases are enclosed between [ and ]. The implementation of the Noun Phrase model in Watson NLP follows the Hybrid non-overlapping semantics, with one modification: the noun phrases do not include leading determiners and numerals.

The list of prepositions allowed is language-specific.

The last column illustrates the output of the Noun Phrase models in Watson NLP.

Simple Noun Phrases Complex Noun Phrases Hybrid non-overlapping Noun Phrases
[a supply chain] [a supply chain]
[supply]
a [supply chain]
[the wonderful cat] [the wonderful cat] the [wonderful cat]
[25 years] [25 years] 25 [years]
[University] of [North Carolina] [University of North Carolina]
[North Carolina]
[University of North Carolina]
[the cat] in [the hat] [the cat in the hat]
[the hat]
the [cat] in the [hat]
[the cat] that was in [the hat] [the cat that was in the hat]
[the hat]
the [cat] that was in the [hat]

Running models

The Noun-phrases model request accepts the following fields:

Field Type Required
Optional
Repeated
Description
raw_document watson_core_data_model.nlp.RawDocument required The input document on which to perform Noun-phrases predictions

Example requests

REST API

curl -s \
  "http://localhost:8080/v1/watson.runtime.nlp.v1/NlpService/NounPhrasesPredict" \
  -H "accept: application/json" \
  -H "content-type: application/json" \
  -H "Grpc-Metadata-mm-model-id: noun-phrases_rbr_lang_en_stock" \
  -d '{ "raw_document": { "text": "Joe works at IBM. Joe lives in Denver. Arvind Krishna is CEO and President of IBM. One dollar is equal to 100 cents. And is more than a UK pound. It is 12:00pm somewhere. On April 12th." } }'

Response

{"nounPhrases":[
  {"span":{"begin":0, "end":3, "text":"Joe"}},
  {"span":{"begin":13, "end":16, "text":"IBM"}},
  {"span":{"begin":18, "end":21, "text":"Joe"}},
  {"span":{"begin":31, "end":37, "text":"Denver"}},
  {"span":{"begin":39, "end":53, "text":"Arvind Krishna"}},
  {"span":{"begin":57, "end":60, "text":"CEO"}},
  {"span":{"begin":65, "end":81, "text":"President of IBM"}},
  {"span":{"begin":87, "end":93, "text":"dollar"}},
  {"span":{"begin":110, "end":115, "text":"cents"}},
  {"span":{"begin":136, "end":144, "text":"UK pound"}},
  {"span":{"begin":174, "end":184, "text":"April 12th"}}],
 "producerId":{
  "name":"RBR Noun phrases", "version":"0.0.1"
 }
}

Python

import grpc

from watson_nlp_runtime_client import (
    common_service_pb2,
    common_service_pb2_grpc,
    syntax_types_pb2,
)

channel = grpc.insecure_channel("localhost:8085")

stub = common_service_pb2_grpc.NlpServiceStub(channel)

request = common_service_pb2.NounPhrasesRequest(
    raw_document=syntax_types_pb2.RawDocument(text="Joe works at IBM. Joe lives in Denver. Arvind Krishna is CEO and President of IBM. One dollar is equal to 100 cents. And is more than a UK pound. It is 12:00pm somewhere. On April 12th."),
)

  response = stub.NounPhrasesPredict(
    request, metadata=[("mm-model-id", "noun-phrases_rbr_lang_en_stock")]
)

print(response)

Response

noun_phrases {
  span {
    end: 3
    text: "Joe"
  }
}
noun_phrases {
  span {
    begin: 13
    end: 16
    text: "IBM"
  }
}
noun_phrases {
  span {
    begin: 18
    end: 21
    text: "Joe"
  }
}
noun_phrases {
  span {
    begin: 31
    end: 37
    text: "Denver"
  }
}
noun_phrases {
  span {
    begin: 39
    end: 53
    text: "Arvind Krishna"
  }
}
noun_phrases {
  span {
    begin: 57
    end: 60
    text: "CEO"
  }
}
noun_phrases {
  span {
    begin: 65
    end: 81
    text: "President of IBM"
  }
}
noun_phrases {
  span {
    begin: 87
    end: 93
    text: "dollar"
  }
}
noun_phrases {
  span {
    begin: 110
    end: 115
    text: "cents"
  }
}
noun_phrases {
  span {
    begin: 136
    end: 144
    text: "UK pound"
  }
}
noun_phrases {
  span {
    begin: 174
    end: 184
    text: "April 12th"
  }
}
producer_id {
  name: "RBR Noun phrases"
  version: "0.0.1"
}