ANALISIS DAN PERANCANGAN
3.2 Arsitektur Umum
Pada bagian ini akan membahas tahapan yang akan dilakukan dalam penelitian. Tahap yang dilakukan sebagai berikut : preprocessing yang terdiri dari tokenizing, stopwords removal, stemming dan case folding; pemilihan calon fitur; ekstraksi fitur menggunakan TF-IDF, TextRank dan K-Means; identifikasi menggunakan sentiment orientation.
14
Setelah tahap-tahap tersebut dilakukan, aplikasi dapat menghasilkan luaran berupa hasil identifikasi review berdasarkan fitur-fitur yang dihasilkan. Adapun tahap-tahap tersebut dapat dilihat dalam bentuk arsitektur umum pada Gambar 3.1.
Gambar 3.1. Arsitektur Umum 3.2.1 Input
Input pada penelitian ini merupakan dokumen teks yang berisi review film yang telah dipisahkan menjadi data per kalimat. Kumpulan kalimat tersebut telah dikelompokkan secara manual menjadi 3 yaitu positif, negatif dan netral. Penelitian ini menggunakan korpus sebagai data pada sistem klasifikasinya. Adapun contoh kalimat komentar yang akan diproses dapat dilihat pada tabel 3.2 berikut.
Tabel 3.2. Contoh Kalimat Komentar
Kelompok Kalimat
Positif
1. I just LOVE finding old slasher films on VHS because the cover artwork is fantastic.
2. The only thing that made this at all worth watching was a decent hand on the camera - the cinematography was almost refreshing, which comes close to making up for the horrible film itself - but not quite.
3. At lest they have characters you care about, a sense of humor and nothing but real actors in the cast.
4. The best thing about "The Prey" is the tag line..."It's not human and it's got an axe"!
5. The climax has a hunky forest ranger trying to get to the teens in time before the last cute girl becomes buzzard bait.
Negatif
1. No magic here, it was all I could do to keep from turning it off an hour in.
2. There is pretty much no plot and it is a big problem when you root for no-one.
3. Even the killing scenes are a failure.
4. Overall, I wouldn't recommend this film to anyone other than slasher completists - it really is a big mess.
5. There are glaring pauses, boring tableaux, and zero sense of pacing throughout.
Netral
1. Six horny pot smoking students decide to go camping.
2. I saw a lot of people running around in a factory, shooting at everything around them.
3. It was the crossing of the Rhine that the Allies had been trying to achieve for six months.
4. There were several scenes of this little kid getting poop and pee thrown on him.
5. Most people learn that from their mother when they're about 5 years old.
16
3.2.2 Text-Preprocessing
Dokumen teks yang diperoleh akan melewati beberapa tahapan preprocessing, yaitu 3.2.2.1 Tokenizing
Tokenizing adalah proses pemecahan teks dari bentuk kalimat menjadi rangkaian kata dan rangkaian huruf dengan angka. Pada tahap ini dilakukan penghapusan tanda baca dan angka dari setiap kalimat. Contoh tahap tokenizing dapat dilihat pada tabel 3.3 berikut.
Tabel 3.3. Tahapan Tokenizing
Kalimat Hasil Tokenizing
The best thing about "The Prey" is the tag line..."It's not human and it's got an axe"!
It was the crossing of the Rhine that the Allies had been trying to achieve for six months.
It | was | the | crossing | of | the | Rhine | that | the | Allies | had | been | trying | to
| achieve | for | six | months |
3.2.2.2 Case Folding
Case Folding adalah proses penyeragaman huruf pada dokumen teks. Tahap ini akan dilakukan untuk mengubah setiap huruf pada tahap sebelumnya menjadi huruf kecil (lowercase). Contoh tahap case folding dapat dilihat pada tabel 3.4 berikut.
Tabel 3.4. Tahapan Case Folding
Hasil Tokenizing Hasil Case Folding The | best | thing | about | The | Prey | is |
Tabel 3.4. Tahapan Case Folding (lanjutan)
Hasil Tokenizing Hasil Case Folding Even | the | killing | scenes | are | a |
3.2.2.3 Stopwords Removal
Stopwords Removal adalah proses penghapusan kata-kata yang tidak memiliki makna tertentu dan tidak berpengaruh dalam kalimat seperti kata depan dan kata hubung (Triawati, 2009). Tahap ini akan memanfaatkan data korpus stopwords bahasa Inggris yang ada pada library NLTK python. Kata-kata yang termasuk dalam data korpus tersebut akan dihapus. Data korpus yang akan digunakan dapat dilhat pada tabel 3.5 dan contoh tahap stopwords removal dapat dilihat pada tabel 3.6 berikut.
Tabel 3.5. Stopwords Stopwords
18
your whom an above any just hadn't won't
yours this the below both don hasn wouldn
Tabel 3.5. Stopwords (lanjutan) Stopwords
Tabel 3.6. Tahapan Stopwords Removal
Hasil Case Folding Hasil Stopwords Removal the | best | thing | about | the | prey | is |
crossing | rhine | allies | trying | achieve | six | months |
3.2.2.4 Stemming
Stemming adalah proses pengubahan kata menjadi kata baku atau memperbaiki/mengeliminasi kata yang tidak baku dalam kalimat. Proses ini akan memperbaiki kata yang tidak baku menjadi kata baku. Contoh stemming dapat dilihat pada tabel 3.7 berikut.
Tabel 3.7. Tahapan Stemming
Hasil Stopwords Removal Hasil Stemming best | thing | prey | tag | line | human | go
3.2.3 Selecting Candidate
Selecting Candidate adalah proses pemilihan kata yang akan menjadi calon fitur.
Dataset yang telah melewati tahapan text-preprocessing akan menjadi input proses pemilihan calon fitur. Dalam pemilihan ini akan memanfaatkan fungsi Part of Speech Tagging (POS Tagging) yang berasal dari library NLTK. Setiap kata dalam dataset akan diberikan label sesuai dengan kelas kata seperti kata benda, kata kerja, kata sifat, kata keterangan dan lainnya. Pada proses ini kata dengan label kata benda atau noun singular (NN), noun plural (NNS), proper noun singular (NNP) dan proper noun plural (NNPS) dinyatakan sebagai calon fitur. Contoh tahap selecting candidate dapat dilihat pada tabel 3.8 berikut.
Tabel 3.8. Hasil Selecting Candidate
Hasil Stemming Hasil POS Tagging Hasil Selecting Candidate best | thing | prey |
('crossing', 'VBG') | ('rhine', 'NN' ) | ('ally', 'RB') | ('trying', 'VBG')
('rhine', 'NN') | ('month', 'N N')
20
achieve | six | month |
| ('achieve', 'RB') | ('six', 'CD') | (' month', 'NN')
3.2.4 Ekstraksi Fitur
Dataset yang telah melewati proses preprocessing dan selecting candidate akan menjadi input untuk proses ekstraksi fitur. Ekstraksi fitur akan menggunakan tiga algoritma berbeda yaitu TF-IDF, TextRank dan K-Means. Contoh input berdasarkan dokumen teks pada tabel 3.2 dapat dilihat pada tabel 3.9 berikut.
Tabel 3.9. Contoh Input Ekstraksi Fitur
Kalimat Input Ekstraksi Fitur
I just LOVE finding old slasher films on VHS because the cover artwork is fantastic.
love, slasher, film, vhs, cover, artwork
The only thing that made this at all worth watching was a decent hand on the camera - the cinematography was almost
refreshing, which comes close to making up for the horrible film itself - but not quite.
thing, hand, camera, cinematography, film
At lest they have characters you care about, a sense of humor and nothing but real actors in the cast.
character, care, sense, humor, nothing, actor, cast
The best thing about "The Prey" is the tag line..."It's not human and it's got an axe"!
thing, prey, line, axe
The climax has a hunky forest ranger trying to get to the teens in time before the last cute girl becomes buzzard bait.
climax, hunky, ranger, time, girl, bait
No magic here, it was all I could do to keep from turning it off an hour in.
magic, hour
There is pretty much no plot and it is a big problem when you root for no-one.
plot, problem, root
Even the killing scenes are a failure. scene, failure
Tabel 3.9. Contoh Input Ekstraksi Fitur (lanjutan)
Kalimat Input Ekstraksi Fitur
Overall, I wouldn't recommend this film to anyone other than slasher completists - it really is a big mess.
recommend, film, anyone, slasher, co mpletists, mess
There are glaring pauses, boring tableaux, and zero sense of pacing throughout.
pause, tableau, sense
Six horny pot smoking students decide to go camping.
horny, pot, student, decide
I saw a lot of people running around in a factory, shooting at everything around them.
saw, lot, people, factory, everything
It was the crossing of the Rhine that the Allies had been trying to achieve for six months.
rhine, month
There were several scenes of this little kid getting poop and pee thrown on him.
scene, kid, pee
Most people learn that from their mother when they're about 5 years old.
people, year
Adapun untuk penjelasan setiap algoritma yang akan diterapkan tersebut adalah sebagai berikut.
3.2.4.1 TF-IDF
Pada penelitian ini akan menggunakan nilai idf, dimana idf adalah nilai yang dihitung berdasarkan suatu kata yang muncul pada seluruh dokumen. Tahap ini akan menghitung skor idf dari setiap kata yang telah dipilih pada tahap selecting candidate menggunakan
22
rumus idf pada persamaan 2.1. Hasil dari proses ini akan diurutkan berdasarkan skor tertinggi ke skor terendah.
Contoh perhitunngan skor idf pada kata βsceneβ berdasarkan data tabel 3.9 adalah sebagai berikut.
ππππ‘ = ππ (π + 1
πππ‘+ 1) + 1 = ππ (15 + 1
2 + 1) + 1 = 2.674 Dimana:
t = term dari kata βsceneβ
N = 15 πππ‘ = 2
Setelah dilakukan perhitungan pada keseluruhan kata, maka hasil ekstraksi fitur menggunakan TF-IDF berdasarkan data tabel 3.9 dapat dilihat pada tabel 3.10 berikut.
Tabel 3.10. Hasil Ekstraksi Fitur TF-IDF
No. Kata Skor idf
1 film 2.386294361119891
2 thing 2.6739764335716716
3 slasher 2.6739764335716716
4 sense 2.6739764335716716
5 scene 2.6739764335716716
β¦ β¦ β¦
49 humor 3.0794415416798357
50 hunky 3.0794415416798357
51 kid 3.0794415416798357
52 vhs 3.0794415416798357
53 year 3.0794415416798357
3.2.4.2 TextRank
TextRank melakukan pemeringkatan tiap kata berdasarkan graf yang dibangun untuk menghubungkan setiap kata dalam kalimat. Graf dibangun dengan memecah kalimat menjadi kata-kata sebagai vertex yang saling terhubung oleh edges. TextRank skor akan dihitung berdasarkan edges yang dihasilkan menggunakan rumus graph-based rangking algorithm untuk mendapatkan nilai bobot tiap vertex. Gambar 3.2 adalah hasil perhitungan rumus graph-based rangking algorithm berdasarkan data tabel 3.9.
Gambar 3.2. Graf yang telah dibangun dari algoritma TextRank berdasarkan data tabel 3.9
Hasil dari perhitungan rumus graph-based rangking algorithm untuk TextRank skor (bobot vertex) dapat dilihat pada tabel 3.11 berikut.
Tabel 3.11. Hasil Ekstraksi Fitur TextRank
No. Fitur Skor TextRank
1 film 1.716998e+07
2 slasher 1.508086e+07
3 vhs 9.111454e+06
4 anyone 9.027376e+06
5 cover 8.079023e+06
β¦ β¦ β¦
49 root 2.445850e+02
50 magic 1.000000e+00
24
51 hour 1.000000e+00
52 rhine 1.000000e+00
53 month 1.000000e+00
3.2.4.3 K-Means
K-Means merupakan metode pengelompokkan data secara automatis dengan menghitung jarak antara data dan centroid. K-Means memerlukan jumlah cluster yang ditentukan oleh pengguna. Pada penelitian ini jumlah cluster yang akan digunakan adalah 16, 18, 21 dan 26. Cluster yang dihasilkan berupa angka sehingga perlu untuk memberi nama cluster secara manual. Berikut adalah contoh hasil pada percobaan jumlah cluster 21 yang dapat dilihat pada tabel 3.12 berikut.
Tabel 3.12. Contoh Hasil K-Means 21 Cluster
Cluster Nama Cluster Cluster Nama Cluster Cluster Nama Cluster
0 (random) 7 Scene 14 Woman
1 Character 8 Time 15 Book
2 Way 9 (-) 16 Hour
3 Movie 10 Movie 17 Film
4 Film 11 People 18 Watch
5 Line 12 Film 19 Life
6 Story 13 Work 20 Series
3.2.4.4 Similarity Word
Hasil dari setiap metode ekstraksi fitur yang diterapkan memungkinkan memiliki makna kata yang sama sehingga similarity word dimanfaatkan untuk menentukan fitur yang miliki makna yang sama. Tahap ini akan menggunakan data korpus WORDNET yang tersedia pada library NLTK untuk pengecekan kata yang bermakna sama atau bersinonim. Fitur-fitur yang saling bersinonim atau memiliki makna yang sama akan dianggap sebagai 1 (satu) fitur. Diagram proses dan contoh tahap similarity word dapat dilihat pada gambar 3.3 dan 3.4 berikut.
Gambar 3.3. Diagram Proses Similarity Word
Gambar 3.4. Contoh Hasil Tahap Similarity Word
26
3.2.5 Sentiment Analysis VADER
Dataset yang akan diinput untuk proses sentiment analysis adalah data yang dipilih berdasarkan fitur yang telah dihasilkan. Data tersebut akan diproses dengan menerapkan algoritma Sentiment Analysis Vader. Vader akan menghitung skor dari tiap kalimat. Skor yang dihasilkan berupa positf, negatif dan netral. Setiap skor yang dihasilkan akan digabungkan sehingga menghasilkan compound. Compound merupakan matriks yang menghitung semua skor yang telah dinormalisasi antara -1 dan +1. Skor compound dibawah -0,05 (compound <= -0,05) dinyatakan sebagai negatif, diatas 0,05 (compound >= 0,05) sebagai positif dan diantara -0,05 dan 0,05 (-0,05 <
compound < 0,05) sebagai netral. Adapun contoh kalimat komentar yang telah melalui proses dapat dilihat pada tabel 3.13 berikut.
Tabel 3.13. Contoh Hasil Sentiment Analysis Vader
Kalimat Label
I just LOVE finding old slasher films on VHS because the cover artwork is fantastic.
{'neg': 0.0, 'neu': 0.606, 'pos': 0.394, 'compound': 0.8316}
Positif
No magic here, it was all I could do to keep from turning it off an hour in.
{'neg': 0.121, 'neu': 0.879, 'pos': 0.0, 'compound': -0.296}
Negatif
I saw a lot of people running around in a factory, shooting at everything around them.
{'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound': 0.0}
Netral