
자연어 처리
XML
%%writefile test.xml
<?xml version="1.0" encoding="utf-8"?>
<world name="주소록과 네이버 API 서비스">
<people name="김민수">
<age>15</age>
<tall>183cm</tall>
<add>서울시 서대문구</add>
</people>
<people name="박한솔">
<age>30</age>
<tall>175cm</tall>
<add>서울시 용산구</add>
</people>
<naver_api>
<client_id>JXRlq5D6b1L0PA</client_id>
<client_secret>hwinqikqgbKvH</client_secret>
</naver_api>
</world>
import xml.etree.ElementTree as ET
# XML 파일 파싱
tree = ET.parse("test.xml")
root = tree.getroot()
# 루트 태그와 이름 속성 출력
print(root.tag)
print(root.get('name'))
# 첫 번째 자식 요소의 두 번째 자식의 텍스트 출력
print(root[0][1].text)
# 모든 자식 요소의 태그와 속성 출력
for child in root:
print(child.tag, child.attrib)
# 'add' 태그를 가진 모든 요소의 텍스트 출력
for add in root.iter('add'):
print(add.text)
JSON 파일, PDF파일도 가능
HWP파일을 경우 텍스트 파일로 변환후 사용함
웹크롤링
HTML
배운내용추가 부분
나이브 베이즈

장점
단점