{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# 농사로 API"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# \t//서비스 명\n",
"# \t//오퍼레이션 명\n",
"# \toperationName=\"monthNewFdLst\";\n",
"\n",
"# \t//XML 받을 URL 생성\n",
"# \tparameter = \"/\"+serviceName+\"/\"+operationName;\n",
"# \tparameter += \"?apiKey=\"+ apiKey;\n",
"# \tparameter += \"&thisYear=\"+thisYear;\n",
"# \tparameter += \"&thisMonth=\"+thisMonth;\n",
"\n",
"# \t//서버와 통신\n",
"# \tapiUrl = new URL(\"http://api.nongsaro.go.kr/service\"+parameter);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"자연어 분석\n",
"1. Token\n",
"1. Sentence\n",
"1. Weight (Tf-idf, word2vec)\n",
"1. Grammer (CFG)\n",
"1. 유사도 분석\n",
"1. 다양한 단위로 분석 : N-Gram(단어, 음절단위)\n",
"1. **음절단위 분석** : 객체의 구분 및 유사도 측정\n",
"1. 딥러닝을 활용한 분석"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import requests"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"url_api = \"http://api.nongsaro.go.kr/service\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\"?apiKey\":\"2019050393063BM2CHKBQNDHLZA\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\r\\n12입력한 인증키는 일시적으로 사용할 수 없거나, 신청하지 않은 서비스를 요청하고 있습니다.92019\\r\\n'"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"url = \"http://api.nongsaro.go.kr/service/monthFd/monthFdYearLst?apiKey=2019050393063BM2CHKBQNDHLZA&thisYear=2019&thisMonth=9\"\n",
"resp = requests.get(url).text\n",
"resp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from konlpy.tag import Mecab"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[('안녕', 'NNG'),\n",
" ('하', 'XSV'),\n",
" ('세요', 'EP+EF'),\n",
" ('파이썬', 'NNP'),\n",
" ('수업', 'NNG'),\n",
" ('입니다', 'VCP+EC')]"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Mecab().pos(\"안녕하세요 파이썬 수업 입니다\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[('삼성전자', 'NNP'),\n",
" ('파이썬', 'NNP'),\n",
" ('수업', 'NNG'),\n",
" ('자료', 'NNG'),\n",
" ('입니다', 'VCP+EC')]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"text = \"삼성전자 파이썬 수업 자료 입니다\"\n",
"Mecab().pos(text)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[('아침', 'NNG'),\n",
" ('시간', 'NNG'),\n",
" ('일어나', 'VV'),\n",
" ('서', 'EC'),\n",
" ('운동', 'NNG'),\n",
" ('을', 'JKO'),\n",
" ('합니다', 'VV+EC')]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"text = \"아침시간 일어나서 운동을 합니다\"\n",
"Mecab().pos(text)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from khaiii import test_khaiii"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "'module' object is not callable",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtest_khaiii\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"삼성전자\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m: 'module' object is not callable"
]
}
],
"source": [
"test_khaiii()."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}