회사의 내부 위키에 대한 접근 권한이 없으므로 우리는 실제 위키백과 덤프를 사용한다. 다만
어마어마한 규모의 영어 덤프 대신 간단한 영어 위키 덤프를 사용한다.
간단한 영어는 영어의 부분집합이다. 고유명사와 일부 전문용어를 제외하고 약
1
,
500
개의 단
어를 사용한다. 우리가 작성해야 하는 코드를 단순화하는 일에 도움이 되므로 유용하다. 만약
이것이 실제 회사 위키라면 데이터 정리를 몇 번 반복해야 할 것이다. 쉬운 영어 위키백과
Simple
English
Wikipedia
1
의 덤프를 살펴보자.
계획은 다음과 같다.
① 데이터 얻기
② 데이터 탐색
③ 개체 및 관계에 대한 위키 구문 분석
④ 개체 및 관계를
CSV
로 저장
⑤
Neo4j
에
CSV
를 로드
13.4
솔루션 구현
먼저 데이터를 로드하자. 대부분의 위키 덤프는
bzip2
압축
XML
파일로 제공된다. 다행히 스
파크는 이러한 종류의 데이터를 처리할 수 있다. 그럼 로드해보자.
import json
import re
import pandas as pd
import sparknlp
from pyspark.ml import Pipeline
from pyspark.sql import SparkSession, Row
from pyspark.sql.functions import lit, col ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.