getting started with watson api api, - ibmgetting started with watson api 왓슨api,...

16
Getting Started with Watson API 왓슨 API, 실제로 구현해보기 이용구 스위즐랩스, CTO

Upload: others

Post on 26-May-2020

41 views

Category:

Documents


0 download

TRANSCRIPT

Getting Started with Watson API

왓슨 API,

실제로 구현해보기

이용구

스위즐랩스, CTO

Swizzle에서사용하는왓슨 APIs

• Alchemy Language

• Tone Analyzer

• Natural Language Classifier

Alchemy Language

• 자연어 처리를 활용한 텍스트 분석 API

• 기호(호불호), 키워드, 엔티티, 주제등을파악할수있음

• https://www.ibm.com/watson/developercloud/alchemy-language.html

Tone Analyzer

• 텍스트의 감성이나 사회적 성향을 파악하는 언어 분석모듈

• http://www.ibm.com/watson/developercloud/tone-analyzer.html

Natural Language Classifier

• 자연어 분류기

• https://www.ibm.com/watson/developercloud/nl-classifier.html

API 를사용하는모듈 NodeJS로구현하기

Bluemix 가입및접속키생성

• https://console.ng.bluemix.net/

• Create Service

• Service Credentials

• New Credential

• username / password

• apikey

Watson Developer Cloud Node.js SDK

• https://www.npmjs.com/package/watson-developer-cloud

• npm install watson-developer-cloud

Alchemy API 생성및분석

• var AlchemyLanguageV1 = require('watson-developer-cloud/alchemy-language/v1');

var alchemy_language = new AlchemyLanguageV1({api_key: 'API_KEY‘

});

• var params = {text: 'IBM Watson won the Jeopardy television show hosted by Alex Trebek‘

};

alchemy_language.sentiment(params, function (err, response) {if (err)

console.log('error:', err);else

console.log(JSON.stringify(response, null, 2));});

Tone Analyzer 생성및분석

• var ToneAnalyzerV3 = require('watson-developer-cloud/tone-analyzer/v3');var tone_analyzer = new ToneAnalyzerV3({

username: '<username>',password: '<password>',version_date: '2016-05-19‘

});

• tone_analyzer.tone({ text: 'Greetings from Watson Developer Cloud!' },function(err, tone) {

if (err)console.log(err);

elseconsole.log(JSON.stringify(tone, null, 2));

});

자연어분류기생성 (1)

• var NaturalLanguageClassifierV1 = require('watson-developer-cloud/natural-language-classifier/v1');

• var nlc = new NaturalLanguageClassifierV1({username: 'my username',password: 'my password'

});

자연어분류기생성 (2)

• nlc.create({training_data: data,name: 'custom classifier name'language: 'ko'

}, callback);

• {"name": "TutorialClassifier","language": "en","status": "Training","url": "https://gateway.watsonplatform.net/natural-language-

classifier/api/v1/classifiers/10D41B-nlc-1","classifier_id": "10D41B-nlc-1","created": "2015-05-28T18:01:57.393Z","status_description": "The classifier instance is in its training phase, not yet

ready to accept classify requests"}

자연어분류

• nlc.classify({text: text_data,classifier_id: 'my classifier id'

}, callback);

• {"classifier_id": "10D41B-nlc-1","url": "https://gateway.watsonplatform.net/natural-language-classifier/api/v1","text": "How hot will it be today?","top_class": "temperature","classes": [

{"class_name": "temperature","confidence": 0.9998201258549781

},{

"class_name": "conditions","confidence": 0.00017987414502176904

}]

}

분류기자체테스트결과

• 데이터 셋 :

• 구글 스토어 앱 리뷰• 1279 트레이닝 셋• 1279 테스트 셋

• 분류 기준• Evaluated By Human

• 크래시, 버그, 데이터 로스

• 정확도• 90.77 %

Sample Project with NodeJs

• https://github.com/kool22/node-watson-api-example

Thank you