google cloud natural language API

クイックスタートやってみた

入力するjsonファイルを作成

```json:entity-request.json
{
  "document":{
    "type":"PLAIN_TEXT",
    "content":"Michelangelo Caravaggio, Italian painter, is known for
              'The Calling of Saint Matthew'."
  },
  "encodingType":"UTF8"
}
```

サービス アカウントへの認証

```
gcloud auth activate-service-account --key-file=<service-account-key.json>
```

サービス アカウントを使用して承認トークンを取得

```
gcloud auth print-access-token
```
→access_tokenがコンソールに出力される

リクエスト

```
curl -s -k -H "Content-Type: application/json" \
    -H "Authorization: Bearer <access_token>" \  
    https://language.googleapis.com/v1/documents:analyzeEntities \
    -d @entity-request.json
```

レスポンス

```
{
  "entities": [
    {
      "name": "Michelangelo Caravaggio",
      "type": "PERSON",
      "metadata": {
        "mid": "/m/020bg",
        "wikipedia_url": "http://en.wikipedia.org/wiki/Caravaggio"
      },
      "salience": 0.81965727,
      "mentions": [
        {
          "text": {
            "content": "Michelangelo Caravaggio",
            "beginOffset": 0
          },
          "type": "PROPER"
        },
        {
          "text": {
            "content": "painter",
            "beginOffset": 33
          },
          "type": "COMMON"
        }
      ]
    },
    {
      "name": "Italian",
      "type": "LOCATION",
      "metadata": {
        "mid": "/m/03rjj",
        "wikipedia_url": "http://en.wikipedia.org/wiki/Italy"
      },
      "salience": 0.14426395,
      "mentions": [
        {
          "text": {
            "content": "Italian",
            "beginOffset": 25
          },
          "type": "PROPER"
        }
      ]
    },
    {
      "name": "The Calling of Saint Matthew",
      "type": "EVENT",
      "metadata": {
        "mid": "/m/085_p7",
        "wikipedia_url": "http://en.wikipedia.org/wiki/The_Calling_of_St_Matthew_(Caravaggio)"
      },
      "salience": 0.036078777,
      "mentions": [
        {
          "text": {
            "content": "The Calling of Saint Matthew",
            "beginOffset": 69
          },
          "type": "PROPER"
        }
      ]
    }
  ],
  "language": "en"
}
```

[公式解説](https://cloud.google.com/natural-language/docs/basics?hl=ja)

できること

>- 感情分析
>
>指定されたテキストを調べて、そのテキストの背景にある感情的な考え方を分析します。具体的には、執筆者の考え方がポジティブか、ネガティブか、ニュートラルかを判断します。感情分析を実行するには analyzeSentiment メソッドを使用します。感情分析で現在サポートされている言語は英語のみです。
>
>- エンティティ分析
>
>指定されたテキストに既知のエンティティ（著名人、ランドマークなどの固有名詞）が含まれていないかどうかを調べて、それらのエンティティに関する情報を返します。エンティティ分析を実行するには analyzeEntities メソッドを使用します。
>
>- 構文解析
>
>言語情報を抽出し、指定されたテキストを一連の文とトークン（通常は単語の境界）に分解して、それらのトークンをさらに分析できるようにします。構文解析を実行するには analyzeSyntax メソッドを使用します。

# トランプ大統領の就任演説の内容を感情分析してみた

[ソース](https://www.washingtonpost.com/news/the-fix/wp/2017/01/20/donald-trumps-full-inauguration-speech-transcript-annotated/?utm_term=.51761393960c)
これをテキストに落とす(trump_speech.txt)
クラウドストレージにアップロード
リクエスト記述

```json:request.json
{
  "document":{
    "type":"PLAIN_TEXT",
    "language": "EN",
    "gcsContentUri":"gs://<bucket/text>"
  },
  "encodingType":"UTF8"
}
```

リクエスト発行

```shell-session:analyzeEntities.sh
FILE=request.json
curl -s -k -H "Content-Type: application/json" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \  
    https://language.googleapis.com/v1/documents:analyzeEntities \
    -d @"${FILE}" > result.json
```

## 結果

```json:result.json
{
  "documentSentiment": {
    "magnitude": 42.6,
    "score": 0.2
  },
  "language": "en",
  "sentences": [
    {
      "text": {
        "content": "Chief Justice Roberts, President Carter, President Clinton, President Bush, President Obama, fellow Americans and people of the world, thank you.",
        "beginOffset": 0
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "We, the citizens of America, are now joined in a great national effort to rebuild our country and restore its promise for all of our people.",
        "beginOffset": 147
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "Together, we will determine the course of America and the world for many, many years to come.",
        "beginOffset": 289
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "We will face challenges, we will confront hardships, but we will get the job done.",
        "beginOffset": 383
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "Every four years, we gather on these steps to carry out the orderly and peaceful transfer of power, and we are grateful to President Obama and First Lady Michelle Obama for their gracious aid throughout this transition.",
        "beginOffset": 467
      },
      "sentiment": {
        "magnitude": 0.8,
        "score": 0.8
      }
    },
    {
      "text": {
        "content": "They have been magnificent.",
        "beginOffset": 687
      },
      "sentiment": {
        "magnitude": 0.6,
        "score": 0.6
      }
    },
    {
      "text": {
        "content": "Thank you.",
        "beginOffset": 715
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "Today's ceremony, however, has very special meaning because today, we are not merely transferring power from one administration to another or from one party to another, but we are transferring power from Washington, D.C. and giving it back to you, the people.",
        "beginOffset": 727
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": -0.5
      }
    },
    {
      "text": {
        "content": "For too long, a small group in our nation's capital has reaped the rewards of government while the people have borne the cost.",
        "beginOffset": 988
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": -0.1
      }
    },
    {
      "text": {
        "content": "Washington flourished, but the people did not share in its wealth.",
        "beginOffset": 1115
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "Politicians prospered, but the jobs left and the factories closed.",
        "beginOffset": 1182
      },
      "sentiment": {
        "magnitude": 0.6,
        "score": -0.6
      }
    },
    {
      "text": {
        "content": "The establishment protected itself, but not the citizens of our country.",
        "beginOffset": 1249
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": -0.4
      }
    },
    {
      "text": {
        "content": "Their victories have not been your victories.",
        "beginOffset": 1322
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "Their triumphs have not been your triumphs.",
        "beginOffset": 1368
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "And while they celebrated in our nation's capital, there was little to celebrate for struggling families all across our land.",
        "beginOffset": 1412
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "That all changes starting right here and right now because this moment is your moment, it belongs to you.",
        "beginOffset": 1539
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "It belongs to everyone gathered here today and everyone watching all across America.",
        "beginOffset": 1646
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "This is your day.",
        "beginOffset": 1731
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "This is your celebration.",
        "beginOffset": 1749
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "And this, the United States of America, is your country.",
        "beginOffset": 1775
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "What truly matters is not which party controls our government, but whether our government is controlled by the people.",
        "beginOffset": 1833
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": -0.2
      }
    },
    {
      "text": {
        "content": "January 20th, 2017 will be remembered as the day the people became the rulers of this nation again.",
        "beginOffset": 1953
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "The forgotten men and women of our country will be forgotten no longer.",
        "beginOffset": 2054
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": -0.4
      }
    },
    {
      "text": {
        "content": "Everyone is listening to you now.",
        "beginOffset": 2127
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "You came by the tens of millions to become part of a historic movement, the likes of which the world has never seen before.",
        "beginOffset": 2161
      },
      "sentiment": {
        "magnitude": 0.6,
        "score": 0.6
      }
    },
    {
      "text": {
        "content": "At the center of this movement is a crucial conviction, that a nation exists to serve its citizens.",
        "beginOffset": 2286
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "Americans want great schools for their children, safe neighborhoods for their families, and good jobs for themselves.",
        "beginOffset": 2386
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "These are just and reasonable demands of righteous people and a righteous public.",
        "beginOffset": 2504
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "But for too many of our citizens, a different reality exists: mothers and children trapped in poverty in our inner cities; rusted out factories scattered like tombstones across the landscape of our nation; an education system flush with cash, but which leaves our young and beautiful students deprived of all knowledge; and the crime and the gangs and the drugs that have stolen too many lives and robbed our country of so much unrealized potential.",
        "beginOffset": 2587
      },
      "sentiment": {
        "magnitude": 0.8,
        "score": -0.8
      }
    },
    {
      "text": {
        "content": "This American carnage stops right here and stops right now.",
        "beginOffset": 3038
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": -0.4
      }
    },
    {
      "text": {
        "content": "We are one nation and their pain is our pain.",
        "beginOffset": 3099
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": 0.1
      }
    },
    {
      "text": {
        "content": "Their dreams are our dreams.",
        "beginOffset": 3145
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "And their success will be our success.",
        "beginOffset": 3174
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "We share one heart, one home, and one glorious destiny.",
        "beginOffset": 3213
      },
      "sentiment": {
        "magnitude": 0.8,
        "score": 0.8
      }
    },
    {
      "text": {
        "content": "The oath of office I take today is an oath of allegiance to all Americans.",
        "beginOffset": 3269
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": -0.5
      }
    },
    {
      "text": {
        "content": "For many decades, we've enriched foreign industry at the expense of American industry; subsidized the armies of other countries, while allowing for the very sad depletion of our military.",
        "beginOffset": 3345
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": -0.1
      }
    },
    {
      "text": {
        "content": "We've defended other nations' borders while refusing to defend our own.",
        "beginOffset": 3533
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "And spent trillions and trillions of dollars overseas while America's infrastructure has fallen into disrepair and decay.",
        "beginOffset": 3606
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": -0.7
      }
    },
    {
      "text": {
        "content": "We've made other countries rich, while the wealth, strength and confidence of our country has dissipated over the horizon.",
        "beginOffset": 3728
      },
      "sentiment": {
        "magnitude": 0.9,
        "score": 0.9
      }
    },
    {
      "text": {
        "content": "One by one, the factories shuttered and left our shores, with not even a thought about the millions and millions of American workers that were left behind.",
        "beginOffset": 3852
      },
      "sentiment": {
        "magnitude": 0.6,
        "score": -0.6
      }
    },
    {
      "text": {
        "content": "The wealth of our middle class has been ripped from their homes and then redistributed all across the world.",
        "beginOffset": 4008
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": -0.4
      }
    },
    {
      "text": {
        "content": "But that is the past.",
        "beginOffset": 4118
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "And now, we are looking only to the future.",
        "beginOffset": 4140
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "We assembled here today are issuing a new decree to be heard in every city, in every foreign capital, and in every hall of power.",
        "beginOffset": 4185
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "From this day forward, a new vision will govern our land.",
        "beginOffset": 4315
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "From this day forward, it's going to be only America first, America first.",
        "beginOffset": 4373
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "Every decision on trade, on taxes, on immigration, on foreign affairs will be made to benefit American workers and American families.",
        "beginOffset": 4449
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "We must protect our borders from the ravages of other countries making our products, stealing our companies and destroying our jobs.",
        "beginOffset": 4583
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "Protection will lead to great prosperity and strength.",
        "beginOffset": 4717
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "I will fight for you with every breath in my body and I will never ever let you down.",
        "beginOffset": 4772
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "America will start winning again, winning like never before.",
        "beginOffset": 4859
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": 0.1
      }
    },
    {
      "text": {
        "content": "We will bring back our jobs.",
        "beginOffset": 4921
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "We will bring back our borders.",
        "beginOffset": 4950
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "We will bring back our wealth.",
        "beginOffset": 4982
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "And we will bring back our dreams.",
        "beginOffset": 5013
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "We will build new roads and highways and bridges and airports and tunnels and railways all across our wonderful nation.",
        "beginOffset": 5049
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "We will get our people off of welfare and back to work, rebuilding our country with American hands and American labor.",
        "beginOffset": 5169
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "We will follow two simple rules; buy American and hire American.",
        "beginOffset": 5289
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "We will seek friendship and goodwill with the nations of the world, but we do so with the understanding that it is the right of all nations to put their own interests first.",
        "beginOffset": 5355
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "We do not seek to impose our way of life on anyone, but rather to let it shine as an example.",
        "beginOffset": 5529
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": -0.2
      }
    },
    {
      "text": {
        "content": "We will shine for everyone to follow.",
        "beginOffset": 5623
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "We will reinforce old alliances and form new ones and unite the civilized world against radical Islamic terrorism, which we will eradicate from the face of the Earth.",
        "beginOffset": 5662
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": -0.1
      }
    },
    {
      "text": {
        "content": "At the bedrock of our politics will be a total allegiance to the United States of America, and through our loyalty to our country, we will rediscover our loyalty to each other.",
        "beginOffset": 5830
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "When you open your heart to patriotism, there is no room for prejudice.",
        "beginOffset": 6007
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": -0.3
      }
    },
    {
      "text": {
        "content": "The Bible tells us how good and pleasant it is when God's people live together in unity.",
        "beginOffset": 6080
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "We must speak our minds openly, debate our disagreements honestly, but always pursue solidarity.",
        "beginOffset": 6169
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "When America is united, America is totally unstoppable.",
        "beginOffset": 6266
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "There should be no fear.",
        "beginOffset": 6323
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": 0.1
      }
    },
    {
      "text": {
        "content": "We are protected and we will always be protected.",
        "beginOffset": 6348
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "We will be protected by the great men and women of our military and law enforcement.",
        "beginOffset": 6398
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "And most importantly, we will be protected by God.",
        "beginOffset": 6483
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "Finally, we must think big and dream even bigger.",
        "beginOffset": 6535
      },
      "sentiment": {
        "magnitude": 0.8,
        "score": 0.8
      }
    },
    {
      "text": {
        "content": "In America, we understand that a nation is only living as long as it is striving.",
        "beginOffset": 6585
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": 0.1
      }
    },
    {
      "text": {
        "content": "We will no longer accept politicians who are all talk and no action, constantly complaining, but never doing anything about it.",
        "beginOffset": 6667
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": -0.5
      }
    },
    {
      "text": {
        "content": "The time for empty talk is over.",
        "beginOffset": 6796
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": -0.3
      }
    },
    {
      "text": {
        "content": "Now arrives the hour of action.",
        "beginOffset": 6829
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "Do not allow anyone to tell you that it cannot be done.",
        "beginOffset": 6862
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": -0.7
      }
    },
    {
      "text": {
        "content": "No challenge can match the heart and fight and spirit of America.",
        "beginOffset": 6918
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": -0.1
      }
    },
    {
      "text": {
        "content": "We will not fail.",
        "beginOffset": 6984
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "Our country will thrive and prosper again.",
        "beginOffset": 7002
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "We stand at the birth of a new millennium, ready to unlock the mysteries of space, to free the earth from the miseries of disease, and to harness the energies, industries and technologies of tomorrow.",
        "beginOffset": 7046
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "A new national pride will stir ourselves, lift our sights and heal our divisions.",
        "beginOffset": 7247
      },
      "sentiment": {
        "magnitude": 0.6,
        "score": 0.6
      }
    },
    {
      "text": {
        "content": "It's time to remember that old wisdom our soldiers will never forget, that whether we are black or brown or white, we all bleed the same red blood of patriots.",
        "beginOffset": 7330
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "We all enjoy the same glorious freedoms and we all salute the same great American flag.",
        "beginOffset": 7491
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "And whether a child is born in the urban sprawl of Detroit or the wind-swept plains of Nebraska, they look up at the same night sky, they fill their heart with the same dreams, and they are infused with the breath of life by the same almighty creator.",
        "beginOffset": 7580
      },
      "sentiment": {
        "magnitude": 0.6,
        "score": 0.6
      }
    },
    {
      "text": {
        "content": "So to all Americans in every city near and far, small and large, from mountain to mountain, from ocean to ocean, hear these words: You will never be ignored again.",
        "beginOffset": 7833
      },
      "sentiment": {
        "magnitude": 0.1,
        "score": 0.1
      }
    },
    {
      "text": {
        "content": "Your voice, your hopes, and your dreams will define our American destiny.",
        "beginOffset": 7998
      },
      "sentiment": {
        "magnitude": 0,
        "score": 0
      }
    },
    {
      "text": {
        "content": "And your courage and goodness and love will forever guide us along the way.",
        "beginOffset": 8072
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "Together, we will make America strong again.",
        "beginOffset": 8149
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    },
    {
      "text": {
        "content": "We will make America wealthy again.",
        "beginOffset": 8194
      },
      "sentiment": {
        "magnitude": 0.2,
        "score": 0.2
      }
    },
    {
      "text": {
        "content": "We will make America proud again.",
        "beginOffset": 8230
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "We will make America safe again.",
        "beginOffset": 8264
      },
      "sentiment": {
        "magnitude": 0.3,
        "score": 0.3
      }
    },
    {
      "text": {
        "content": "And yes, together we will make America great again.",
        "beginOffset": 8297
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "Thank you.",
        "beginOffset": 8350
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "God bless you.",
        "beginOffset": 8361
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "And God bless America.",
        "beginOffset": 8376
      },
      "sentiment": {
        "magnitude": 0.5,
        "score": 0.5
      }
    },
    {
      "text": {
        "content": "Thank you.",
        "beginOffset": 8400
      },
      "sentiment": {
        "magnitude": 0.7,
        "score": 0.7
      }
    },
    {
      "text": {
        "content": "God bless America.",
        "beginOffset": 8412
      },
      "sentiment": {
        "magnitude": 0.4,
        "score": 0.4
      }
    }
  ]
}
```

## 結果の見方
[公式サイト](https://cloud.google.com/natural-language/docs/basics?hl=ja)
>- score: -1.0（ネガティブ）～1.0（ポジティブ）のスコアで感情が表されます。これは、テキストの全体的な感情の傾向に相当します。
>- magnitude: 指定したテキストの全体的な感情の強度（ポジティブとネガティブの両方）が 0.0～+inf の値で示されます。score と違って magnitude は正規化されていないため、テキスト内で感情（ポジティブとネガティブの両方）が表現されるたびにテキストの magnitude の値が増加します（そのため、長いテキスト ブロックで値が高くなる傾向があります）。

## 結果まとめ
結構ポジティブ