prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Language: support mention type in Entity.mentions.
  [Currently](https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/language/google/cloud/language/entity.py#L79) the mentions property of an entity is only a list of strings whereas it should be a list of objects containing the mention text and mention type.
  
  Furthermore, this change should add mention_type information to the mention documentation.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `language/google/cloud/language/entity.py`
  Content:
  ```
  1 # Copyright 2016-2017 Google Inc.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 """Definition for Google Cloud Natural Language API entities.
  16 
  17 An entity is used to describe a proper name extracted from text.
  18 """
  19 
  20 
  21 class EntityType(object):
  22     """List of possible entity types."""
  23 
  24     UNKNOWN = 'UNKNOWN'
  25     """Unknown entity type."""
  26 
  27     PERSON = 'PERSON'
  28     """Person entity type."""
  29 
  30     LOCATION = 'LOCATION'
  31     """Location entity type."""
  32 
  33     ORGANIZATION = 'ORGANIZATION'
  34     """Organization entity type."""
  35 
  36     EVENT = 'EVENT'
  37     """Event entity type."""
  38 
  39     WORK_OF_ART = 'WORK_OF_ART'
  40     """Work of art entity type."""
  41 
  42     CONSUMER_GOOD = 'CONSUMER_GOOD'
  43     """Consumer good entity type."""
  44 
  45     OTHER = 'OTHER'
  46     """Other entity type (i.e. known but not classified)."""
  47 
  48 
  49 class Entity(object):
  50     """A Google Cloud Natural Language API entity.
  51 
  52     Represents a phrase in text that is a known entity, such as a person,
  53     an organization, or location. The API associates information, such as
  54     salience and mentions, with entities.
  55 
  56     .. _Entity message: https://cloud.google.com/natural-language/\
  57                         reference/rest/v1/Entity
  58     .. _EntityType enum: https://cloud.google.com/natural-language/\
  59                          reference/rest/v1/Entity#Type
  60 
  61     See `Entity message`_.
  62 
  63     :type name: str
  64     :param name: The name / phrase identified as the entity.
  65 
  66     :type entity_type: str
  67     :param entity_type: The type of the entity. See `EntityType enum`_.
  68 
  69     :type metadata: dict
  70     :param metadata: The metadata associated with the entity.
  71                      Wikipedia URLs and Knowledge Graph MIDs are
  72                      provided, if available. The associated keys are
  73                      "wikipedia_url" and "mid", respectively.
  74 
  75     :type salience: float
  76     :param salience: The prominence of the entity / phrase within the text
  77                      containing it.
  78 
  79     :type mentions: list
  80     :param mentions: List of strings that mention the entity.
  81     """
  82 
  83     def __init__(self, name, entity_type, metadata, salience, mentions):
  84         self.name = name
  85         self.entity_type = entity_type
  86         self.metadata = metadata
  87         self.salience = salience
  88         self.mentions = mentions
  89 
  90     @classmethod
  91     def from_api_repr(cls, payload):
  92         """Convert an Entity from the JSON API into an :class:`Entity`.
  93 
  94         :param payload: dict
  95         :type payload: The value from the backend.
  96 
  97         :rtype: :class:`Entity`
  98         :returns: The entity parsed from the API representation.
  99         """
  100         name = payload['name']
  101         entity_type = payload['type']
  102         metadata = payload['metadata']
  103         salience = payload['salience']
  104         mentions = [value['text']['content']
  105                     for value in payload['mentions']]
  106         return cls(name, entity_type, metadata, salience, mentions)
  107
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/language/google/cloud/language/entity.py b/language/google/cloud/language/entity.py
  --- a/language/google/cloud/language/entity.py
  +++ b/language/google/cloud/language/entity.py
  @@ -46,6 +46,80 @@
       """Other entity type (i.e. known but not classified)."""
   
   
  +class MentionType(object):
  +    """List of possible mention types."""
  +
  +    TYPE_UNKNOWN = 'TYPE_UNKNOWN'
  +    """Unknown mention type"""
  +
  +    PROPER = 'PROPER'
  +    """Proper name"""
  +
  +    COMMON = 'COMMON'
  +    """Common noun (or noun compound)"""
  +
  +
  +class Mention(object):
  +    """A Google Cloud Natural Language API mention.
  +
  +    Represents a mention for an entity in the text. Currently, proper noun
  +    mentions are supported.
  +    """
  +    def __init__(self, text, mention_type):
  +        self.text = text
  +        self.mention_type = mention_type
  +
  +    def __str__(self):
  +        return str(self.text)
  +
  +    @classmethod
  +    def from_api_repr(cls, payload):
  +        """Convert a Mention from the JSON API into an :class:`Mention`.
  +
  +        :param payload: dict
  +        :type payload: The value from the backend.
  +
  +        :rtype: :class:`Mention`
  +        :returns: The mention parsed from the API representation.
  +        """
  +        text = TextSpan.from_api_repr(payload['text'])
  +        mention_type = payload['type']
  +        return cls(text, mention_type)
  +
  +
  +class TextSpan(object):
  +    """A span of text from Google Cloud Natural Language API.
  +
  +    Represents a word or phrase of text, as well as its offset
  +    from the original document.
  +    """
  +    def __init__(self, content, begin_offset):
  +        self.content = content
  +        self.begin_offset = begin_offset
  +
  +    def __str__(self):
  +        """Return the string representation of this TextSpan.
  +
  +        :rtype: str
  +        :returns: The text content
  +        """
  +        return self.content
  +
  +    @classmethod
  +    def from_api_repr(cls, payload):
  +        """Convert a TextSpan from the JSON API into an :class:`TextSpan`.
  +
  +        :param payload: dict
  +        :type payload: The value from the backend.
  +
  +        :rtype: :class:`TextSpan`
  +        :returns: The text span parsed from the API representation.
  +        """
  +        content = payload['content']
  +        begin_offset = payload['beginOffset']
  +        return cls(content=content, begin_offset=begin_offset)
  +
  +
   class Entity(object):
       """A Google Cloud Natural Language API entity.
   
  @@ -101,6 +175,5 @@
           entity_type = payload['type']
           metadata = payload['metadata']
           salience = payload['salience']
  -        mentions = [value['text']['content']
  -                    for value in payload['mentions']]
  +        mentions = [Mention.from_api_repr(val) for val in payload['mentions']]
           return cls(name, entity_type, metadata, salience, mentions)
  
verification_info: {"golden_diff": "diff --git a/language/google/cloud/language/entity.py b/language/google/cloud/language/entity.py\n--- a/language/google/cloud/language/entity.py\n+++ b/language/google/cloud/language/entity.py\n@@ -46,6 +46,80 @@\n     \"\"\"Other entity type (i.e. known but not classified).\"\"\"\n \n \n+class MentionType(object):\n+    \"\"\"List of possible mention types.\"\"\"\n+\n+    TYPE_UNKNOWN = 'TYPE_UNKNOWN'\n+    \"\"\"Unknown mention type\"\"\"\n+\n+    PROPER = 'PROPER'\n+    \"\"\"Proper name\"\"\"\n+\n+    COMMON = 'COMMON'\n+    \"\"\"Common noun (or noun compound)\"\"\"\n+\n+\n+class Mention(object):\n+    \"\"\"A Google Cloud Natural Language API mention.\n+\n+    Represents a mention for an entity in the text. Currently, proper noun\n+    mentions are supported.\n+    \"\"\"\n+    def __init__(self, text, mention_type):\n+        self.text = text\n+        self.mention_type = mention_type\n+\n+    def __str__(self):\n+        return str(self.text)\n+\n+    @classmethod\n+    def from_api_repr(cls, payload):\n+        \"\"\"Convert a Mention from the JSON API into an :class:`Mention`.\n+\n+        :param payload: dict\n+        :type payload: The value from the backend.\n+\n+        :rtype: :class:`Mention`\n+        :returns: The mention parsed from the API representation.\n+        \"\"\"\n+        text = TextSpan.from_api_repr(payload['text'])\n+        mention_type = payload['type']\n+        return cls(text, mention_type)\n+\n+\n+class TextSpan(object):\n+    \"\"\"A span of text from Google Cloud Natural Language API.\n+\n+    Represents a word or phrase of text, as well as its offset\n+    from the original document.\n+    \"\"\"\n+    def __init__(self, content, begin_offset):\n+        self.content = content\n+        self.begin_offset = begin_offset\n+\n+    def __str__(self):\n+        \"\"\"Return the string representation of this TextSpan.\n+\n+        :rtype: str\n+        :returns: The text content\n+        \"\"\"\n+        return self.content\n+\n+    @classmethod\n+    def from_api_repr(cls, payload):\n+        \"\"\"Convert a TextSpan from the JSON API into an :class:`TextSpan`.\n+\n+        :param payload: dict\n+        :type payload: The value from the backend.\n+\n+        :rtype: :class:`TextSpan`\n+        :returns: The text span parsed from the API representation.\n+        \"\"\"\n+        content = payload['content']\n+        begin_offset = payload['beginOffset']\n+        return cls(content=content, begin_offset=begin_offset)\n+\n+\n class Entity(object):\n     \"\"\"A Google Cloud Natural Language API entity.\n \n@@ -101,6 +175,5 @@\n         entity_type = payload['type']\n         metadata = payload['metadata']\n         salience = payload['salience']\n-        mentions = [value['text']['content']\n-                    for value in payload['mentions']]\n+        mentions = [Mention.from_api_repr(val) for val in payload['mentions']]\n         return cls(name, entity_type, metadata, salience, mentions)\n", "issue": "Language: support mention type in Entity.mentions.\n[Currently](https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/language/google/cloud/language/entity.py#L79) the mentions property of an entity is only a list of strings whereas it should be a list of objects containing the mention text and mention type.\r\n\r\nFurthermore, this change should add mention_type information to the mention documentation.\n", "before_files": [{"content": "# Copyright 2016-2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Definition for Google Cloud Natural Language API entities.\n\nAn entity is used to describe a proper name extracted from text.\n\"\"\"\n\n\nclass EntityType(object):\n    \"\"\"List of possible entity types.\"\"\"\n\n    UNKNOWN = 'UNKNOWN'\n    \"\"\"Unknown entity type.\"\"\"\n\n    PERSON = 'PERSON'\n    \"\"\"Person entity type.\"\"\"\n\n    LOCATION = 'LOCATION'\n    \"\"\"Location entity type.\"\"\"\n\n    ORGANIZATION = 'ORGANIZATION'\n    \"\"\"Organization entity type.\"\"\"\n\n    EVENT = 'EVENT'\n    \"\"\"Event entity type.\"\"\"\n\n    WORK_OF_ART = 'WORK_OF_ART'\n    \"\"\"Work of art entity type.\"\"\"\n\n    CONSUMER_GOOD = 'CONSUMER_GOOD'\n    \"\"\"Consumer good entity type.\"\"\"\n\n    OTHER = 'OTHER'\n    \"\"\"Other entity type (i.e. known but not classified).\"\"\"\n\n\nclass Entity(object):\n    \"\"\"A Google Cloud Natural Language API entity.\n\n    Represents a phrase in text that is a known entity, such as a person,\n    an organization, or location. The API associates information, such as\n    salience and mentions, with entities.\n\n    .. _Entity message: https://cloud.google.com/natural-language/\\\n                        reference/rest/v1/Entity\n    .. _EntityType enum: https://cloud.google.com/natural-language/\\\n                         reference/rest/v1/Entity#Type\n\n    See `Entity message`_.\n\n    :type name: str\n    :param name: The name / phrase identified as the entity.\n\n    :type entity_type: str\n    :param entity_type: The type of the entity. See `EntityType enum`_.\n\n    :type metadata: dict\n    :param metadata: The metadata associated with the entity.\n                     Wikipedia URLs and Knowledge Graph MIDs are\n                     provided, if available. The associated keys are\n                     \"wikipedia_url\" and \"mid\", respectively.\n\n    :type salience: float\n    :param salience: The prominence of the entity / phrase within the text\n                     containing it.\n\n    :type mentions: list\n    :param mentions: List of strings that mention the entity.\n    \"\"\"\n\n    def __init__(self, name, entity_type, metadata, salience, mentions):\n        self.name = name\n        self.entity_type = entity_type\n        self.metadata = metadata\n        self.salience = salience\n        self.mentions = mentions\n\n    @classmethod\n    def from_api_repr(cls, payload):\n        \"\"\"Convert an Entity from the JSON API into an :class:`Entity`.\n\n        :param payload: dict\n        :type payload: The value from the backend.\n\n        :rtype: :class:`Entity`\n        :returns: The entity parsed from the API representation.\n        \"\"\"\n        name = payload['name']\n        entity_type = payload['type']\n        metadata = payload['metadata']\n        salience = payload['salience']\n        mentions = [value['text']['content']\n                    for value in payload['mentions']]\n        return cls(name, entity_type, metadata, salience, mentions)\n", "path": "language/google/cloud/language/entity.py"}], "after_files": [{"content": "# Copyright 2016-2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Definition for Google Cloud Natural Language API entities.\n\nAn entity is used to describe a proper name extracted from text.\n\"\"\"\n\n\nclass EntityType(object):\n    \"\"\"List of possible entity types.\"\"\"\n\n    UNKNOWN = 'UNKNOWN'\n    \"\"\"Unknown entity type.\"\"\"\n\n    PERSON = 'PERSON'\n    \"\"\"Person entity type.\"\"\"\n\n    LOCATION = 'LOCATION'\n    \"\"\"Location entity type.\"\"\"\n\n    ORGANIZATION = 'ORGANIZATION'\n    \"\"\"Organization entity type.\"\"\"\n\n    EVENT = 'EVENT'\n    \"\"\"Event entity type.\"\"\"\n\n    WORK_OF_ART = 'WORK_OF_ART'\n    \"\"\"Work of art entity type.\"\"\"\n\n    CONSUMER_GOOD = 'CONSUMER_GOOD'\n    \"\"\"Consumer good entity type.\"\"\"\n\n    OTHER = 'OTHER'\n    \"\"\"Other entity type (i.e. known but not classified).\"\"\"\n\n\nclass MentionType(object):\n    \"\"\"List of possible mention types.\"\"\"\n\n    TYPE_UNKNOWN = 'TYPE_UNKNOWN'\n    \"\"\"Unknown mention type\"\"\"\n\n    PROPER = 'PROPER'\n    \"\"\"Proper name\"\"\"\n\n    COMMON = 'COMMON'\n    \"\"\"Common noun (or noun compound)\"\"\"\n\n\nclass Mention(object):\n    \"\"\"A Google Cloud Natural Language API mention.\n\n    Represents a mention for an entity in the text. Currently, proper noun\n    mentions are supported.\n    \"\"\"\n    def __init__(self, text, mention_type):\n        self.text = text\n        self.mention_type = mention_type\n\n    def __str__(self):\n        return str(self.text)\n\n    @classmethod\n    def from_api_repr(cls, payload):\n        \"\"\"Convert a Mention from the JSON API into an :class:`Mention`.\n\n        :param payload: dict\n        :type payload: The value from the backend.\n\n        :rtype: :class:`Mention`\n        :returns: The mention parsed from the API representation.\n        \"\"\"\n        text = TextSpan.from_api_repr(payload['text'])\n        mention_type = payload['type']\n        return cls(text, mention_type)\n\n\nclass TextSpan(object):\n    \"\"\"A span of text from Google Cloud Natural Language API.\n\n    Represents a word or phrase of text, as well as its offset\n    from the original document.\n    \"\"\"\n    def __init__(self, content, begin_offset):\n        self.content = content\n        self.begin_offset = begin_offset\n\n    def __str__(self):\n        \"\"\"Return the string representation of this TextSpan.\n\n        :rtype: str\n        :returns: The text content\n        \"\"\"\n        return self.content\n\n    @classmethod\n    def from_api_repr(cls, payload):\n        \"\"\"Convert a TextSpan from the JSON API into an :class:`TextSpan`.\n\n        :param payload: dict\n        :type payload: The value from the backend.\n\n        :rtype: :class:`TextSpan`\n        :returns: The text span parsed from the API representation.\n        \"\"\"\n        content = payload['content']\n        begin_offset = payload['beginOffset']\n        return cls(content=content, begin_offset=begin_offset)\n\n\nclass Entity(object):\n    \"\"\"A Google Cloud Natural Language API entity.\n\n    Represents a phrase in text that is a known entity, such as a person,\n    an organization, or location. The API associates information, such as\n    salience and mentions, with entities.\n\n    .. _Entity message: https://cloud.google.com/natural-language/\\\n                        reference/rest/v1/Entity\n    .. _EntityType enum: https://cloud.google.com/natural-language/\\\n                         reference/rest/v1/Entity#Type\n\n    See `Entity message`_.\n\n    :type name: str\n    :param name: The name / phrase identified as the entity.\n\n    :type entity_type: str\n    :param entity_type: The type of the entity. See `EntityType enum`_.\n\n    :type metadata: dict\n    :param metadata: The metadata associated with the entity.\n                     Wikipedia URLs and Knowledge Graph MIDs are\n                     provided, if available. The associated keys are\n                     \"wikipedia_url\" and \"mid\", respectively.\n\n    :type salience: float\n    :param salience: The prominence of the entity / phrase within the text\n                     containing it.\n\n    :type mentions: list\n    :param mentions: List of strings that mention the entity.\n    \"\"\"\n\n    def __init__(self, name, entity_type, metadata, salience, mentions):\n        self.name = name\n        self.entity_type = entity_type\n        self.metadata = metadata\n        self.salience = salience\n        self.mentions = mentions\n\n    @classmethod\n    def from_api_repr(cls, payload):\n        \"\"\"Convert an Entity from the JSON API into an :class:`Entity`.\n\n        :param payload: dict\n        :type payload: The value from the backend.\n\n        :rtype: :class:`Entity`\n        :returns: The entity parsed from the API representation.\n        \"\"\"\n        name = payload['name']\n        entity_type = payload['type']\n        metadata = payload['metadata']\n        salience = payload['salience']\n        mentions = [Mention.from_api_repr(val) for val in payload['mentions']]\n        return cls(name, entity_type, metadata, salience, mentions)\n", "path": "language/google/cloud/language/entity.py"}]}