「CSG Actuarial, LLC は Google Cloud Platform を活用して、保険募集人向けのイノベーティブなソリューションを短期間で設計、実装しています。2 月にはマルチキャリアのオンライン加入手続きツールである Medicare Supplement を導入し、今後は Google Cloud Platform HIPAA BAA のもとで、個人の健康情報を App Engine によってセキュアに格納できるようになるでしょう。」 — Bryan Neary 氏、CSG Actuarial, LLC の社長
「安全性とプライバシーを尊重し、HIPAA に準拠した形で堅牢な機械学習モデルをトレーニングできる能力は、Arterys のビジネスにとって必要不可欠です。コア アプリケーションの開発と技術スタック上での構築に集中できるインフラストラクチャのサポートという点で、Google Cloud Platform は私たちの期待以上でした。」 — John Axerio-Cilies 氏、Arterys の CTO
「リアルタイムのインテリジェンスとアクショナブルな知見を提供できるだけでなく、高度な規制を受けている薬物送達や医療機器もサポートできるセキュアなクラウド プラットフォームが必要だと、私たちは考えていました。これからは、Google との戦略的パートナーシップを通じて、世界中のさまざまな個人情報、機密保護法制に準拠し、規制を受けたマネージド サービスの枠組みの範囲内で、医療の世界にまったく新しいレベルの知的情報を提供できます。」 — Kal Patel 氏、Flex のデジタル医療担当シニア VP
def parse_xml(xml): page = etree.fromstring(xml) children = dict((el.tag, el) for el in page) if 'redirect' in children or \ WIKIPEDIA_NAMESPACES.match(children['title'].text): raise StopIteration() revisions = (rev.text for rev in children['revision'].iter('text')) yield { 'article_id': children['id'].text, 'article_title': children['title'].text, 'wikitext': revisions.next(), } def parse_wikitext(content): text = content['wikitext'] parsed_md = mwparserfromhell.parse(content['wikitext']) content['text'] = _strip_code(parsed_md) yield content p = apache_beam.Pipeline(argv=pipeline_args) value = p | apache_beam.Read('Read XML', custom_sources.XmlFileSource('page', gcs_path)) value = value | apache_beam.FlatMap('Parse XML and filter', parse_xml) value = value | apache_beam.Map('Wikitext to text', parse_wikitext) ...
def analyze_entities(content): analysis = language.annotate_text( content['text'], extract_entities=True, extract_document_sentiment=True) sentiment = analysis.get('documentSentiment', {}) for entity in analysis.get('entities', []): entity_dict = { 'article_id': content['article_id'], ... 'article_sentiment_polarity': sentiment.get('polarity'), 'entity_name': entity['name'], } yield entity_dict value = value | apache_beam.FlatMap('Entities', analyze_entities) value = value | apache_beam.Write( 'Dump metadata to BigQuery', apache_beam.io.BigQuerySink( destination_table, schema=', '.join([ 'article_id:STRING', ... 'article_sentiment_polarity:FLOAT', 'entity_name:STRING', ]), ...)))
SELECT top(entity_name, 5) as entity_name, count(*) as num_articles FROM [nl-wikipedia:nl_wikipedia.nl_wikipedia];
SELECT top(entity_name, 5) as entity_name, count(*) as num_articles FROM [nl-wikipedia:nl_wikipedia.nl_wikipedia] where entity_type = 'CONSUMER_GOOD';
SELECT entity_name, sum(article_sentiment_polarity) as sentiment FROM [nl-wikipedia:nl_wikipedia.nl_wikipedia] where entity_type='CONSUMER_GOOD' and entity_salience > .5 group by entity_name order by sentiment desc limit 5
select top(entity_name, 5) as entity_name, count(*) as num_articles from [nl_wikipedia.nl_wikipedia] where article_id in ( SELECT article_id FROM [nl_wikipedia.nl_wikipedia] where entity_name like '%Android%') and entity_name not like '%Android%' and entity_type = 'CONSUMER_GOOD'
"entities": [ { "name": "Rowling", "type": "PERSON", "metadata": { "wikipedia_url": "http://en.wikipedia.org/wiki/J._K._Rowling" }, "salience": 0.58328295, "mentions": [ { "text": { "content": "J. K.", "beginOffset": -1 } }, { "text": { "content": "Rowling", "beginOffset": -1 } } ] }, { "name": "LONDON", "type": "LOCATION", "metadata": { "wikipedia_url": "http://en.wikipedia.org/wiki/London" }, "salience": 0.13440432, "mentions": [ { "text": { "content": "LONDON", "beginOffset": -1 } } ] }, { "name": "Harry Potter", "type": "PERSON", "metadata": { "wikipedia_url": "http://en.wikipedia.org/wiki/Harry_Potter" }, "salience": 0.05211971, "mentions": [ { "text": { "content": "Harry Potter", "beginOffset": -1 } }, { "text": { "content": "Harry Potter", "beginOffset": -1 } } ] }]
var requestUrl = "https://language.googleapis.com/v1beta1/documents:analyzeEntities?key=MY_API_K EY" var requestBody = { "document": { "type": "PLAIN_TEXT", "content": nytText } } var options = { url: requestUrl, method: "POST", body: requestBody, json: true } request(options, function(err, resp, body) { if (!err && resp.statusCode == 200) { var entities = body.entities; for (index in entities) { var entity = entities[index]; console.log(entity); } } else { console.log('NL API error: ', err); } }
{ "name": "Rowling", "type": "PERSON", "metadata": { "wikipedia_url": "http://en.wikipedia.org/wiki/J._K._Rowling" }, "salience": 0.58328295, "mentions": [ { "text": { "content": "J. K.", "beginOffset": -1 } }, { "text": { "content": "Rowling", "beginOffset": -1 } } ] }
var gcloud = require('gcloud')({ keyFilename: 'your-keyfile.json', projectId: 'YOUR-PROJECT-ID' }); var bigquery = gcloud.bigquery(); var dataset = bigquery.dataset('your-BigQuery-dataset-name'); var table = dataset.table('your-BigQuery-table-name');
var row = { entity_wiki_url: wiki_url, entity_name: entity.name, entity_type: entity.type, article_section: article.section, article_created_date: article.created_date, article_url: article.url, article_abstract: article.abstract } table.insert(row, function(error, insertError, apiResponse) { if (error || insertErr.length != 0) { // Handle error } else { // Successfully inserted into our table! } });
SELECT entity_wiki_url, COUNT(entity_wiki_url) as entity_count FROM [sara-bigquery:nytdata.entities_from_abstracts] GROUP BY entity_wiki_url ORDER BY entity_count DESC
var sentimentUrl = "https://language.googleapis.com/v1beta1/documents:analyzeSentiment?key=MY_API_ KEY";
{ "documentSentiment": { "polarity": 1, "magnitude": 0.9 } }
{ "documentSentiment": { "polarity": -1, "magnitude": 0.4 } }
SELECT AVG(polarity * magnitude) as avg_sentiment FROM [sara-bigquery:nytdata.article_sentiment]
SELECT section, COUNT(section) as num_articles_per_section, ROUND(AVG(polarity * magnitude), 2) as avg_section_sentiment FROM [sara-bigquery:nytdata.article_sentiment] GROUP BY section ORDER BY num_articles_per_section DESC