├── .gitignore ├── nbproject ├── private │ ├── config.properties │ ├── private.properties │ └── private.xml ├── genfiles.properties ├── project.xml ├── project.properties └── build-impl.xml ├── src └── cfwsbaru │ ├── frequent │ ├── f2w_new_proc_3.txt │ ├── f2w_new_proc_4.txt │ ├── f2w_new_proc_1.txt │ └── f2w_new_proc_2.txt │ ├── ws.txt │ ├── getword │ ├── new_proc_4.txt │ ├── new_proc_3.txt │ ├── new_proc_1.txt │ └── new_proc_2.txt │ ├── pasanganNode.java │ ├── Edge.java │ ├── result │ ├── proc_4.txt │ ├── proc_3.txt │ ├── proc_1.txt │ └── proc_2.txt │ ├── resources │ ├── 4.txt │ ├── 3.txt │ ├── 1.txt │ └── 2.txt │ ├── hdProcess.java │ ├── entity │ ├── NodeHasDocument.java │ ├── Document.java │ └── Node.java │ ├── TreeLama.java │ ├── ConnectDB.java │ ├── Main.java │ ├── stopwords_list.txt │ ├── Connect.java │ ├── getWords.java │ ├── GST.java │ ├── preprocessing.java │ ├── CFWS.form │ ├── f2w.java │ └── CFWS.java ├── manifest.mf ├── output.dot └── skripsi_cfws.sql /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /nbproject/private/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/cfwsbaru/frequent/f2w_new_proc_3.txt: -------------------------------------------------------------------------------- 1 | benda rumah duren sawit jakarta ledakan lapan lokasi -------------------------------------------------------------------------------- /manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /src/cfwsbaru/ws.txt: -------------------------------------------------------------------------------- 1 | antariksa benda duren jakarta jatuh lapan ledakan lembaga lokasi penerbangan rumah sawit timur -------------------------------------------------------------------------------- /src/cfwsbaru/frequent/f2w_new_proc_4.txt: -------------------------------------------------------------------------------- 1 | lembaga penerbangan antariksa lapan benda jatuh duren sawit jakarta timur lokasi -------------------------------------------------------------------------------- /src/cfwsbaru/frequent/f2w_new_proc_1.txt: -------------------------------------------------------------------------------- 1 | lokasi ledakan duren sawit jakarta timur jatuh rumah lembaga penerbangan antariksa lapan benda -------------------------------------------------------------------------------- /src/cfwsbaru/frequent/f2w_new_proc_2.txt: -------------------------------------------------------------------------------- 1 | ledakan duren sawit jakarta timur benda jatuh rumah lembaga penerbangan antariksa lapan lokasi -------------------------------------------------------------------------------- /nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=false 2 | do.depend=false 3 | do.jar=true 4 | javac.debug=true 5 | javadoc.preview=true 6 | user.properties.file=/home/ata/.netbeans/6.9/build.properties 7 | -------------------------------------------------------------------------------- /src/cfwsbaru/getword/new_proc_4.txt: -------------------------------------------------------------------------------- 1 | lembaga penerbangan antariksa lapan meneliti benda jatuh duren sawit jakarta timur menemukan batuan sulit menyimpulkan bendanya temukan batuannya melacak peneliti bidang matahari abdurrahman lokasi berbahaya efeknya tumpukan panas meleleh bahaya efek pukul tim jatuhnya asing material puslabfor polri -------------------------------------------------------------------------------- /src/cfwsbaru/pasanganNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | /** 9 | * 10 | * @author CassiestGirl 11 | */ 12 | public class pasanganNode { 13 | int x = 0; 14 | int y = 0; 15 | 16 | public pasanganNode() { 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/cfwsbaru/getword/new_proc_3.txt: -------------------------------------------------------------------------------- 1 | menteri negara riset teknologi menristek suharna surapnata memastikan benda menimpa rumah duren sawit jakarta menunggu laporan pengawas tenaga nuklir bapeten ledakan penyebabnya instansi lapan wartawan kantor wapres jl medan merdeka porak poranda berbahaya radiasi fenomena alam pengukuran mengungkapkan lokasi bendanya berjanji laporannya memgumumkannya masyarakat -------------------------------------------------------------------------------- /src/cfwsbaru/getword/new_proc_1.txt: -------------------------------------------------------------------------------- 1 | penambahan radiasi lingkungan lokasi ledakan duren sawit jakarta timur warga khawatir uji background artinya non radioaktif pengawas tenaga nuklir bapeten as natio lasman detikcom tim tiba pukul penerjunan indikasi lakukan bone nggak usah asteroid jatuh perairan oktober rumah rusak atap lantai runtuh beruntung korban jiwa peristiwa penyebab lembaga penerbangan antariksa lapan menduga benda -------------------------------------------------------------------------------- /output.dot: -------------------------------------------------------------------------------- 1 | /* this is a generated dot file: www.graphviz.org */ 2 | diagraph suffixtree { 3 | rankdir=LR; 4 | 1[label=", Text: 0, Suffix: 0"]; 5 | 1->2[label="Hello, Text: 0, Suffix: 0"]; 6 | 2->3[label="Rest Hello West $, Text: 1, Suffix: 0"]; 7 | 2->4[label="West $, Text: 1, Suffix: 3"]; 8 | 1->5[label="Rest Hello West $, Text: 1, Suffix: 1"]; 9 | 1->6[label="West $, Text: 1, Suffix: 3"]; 10 | 1->7[label="$, Text: 1, Suffix: 4"]; 11 | } -------------------------------------------------------------------------------- /src/cfwsbaru/getword/new_proc_2.txt: -------------------------------------------------------------------------------- 1 | misteri ledakan jl delima duren sawit jakarta timur terpecahkan benda jatuh rumah sudarmodjo mirip asteroid bone oktober warga kilatan asing menimpa pecah angkasa peneliti lembaga penerbangan antariksa lapan bidang matahari abdurrahman lokasi meledak terbakar masyarakat api laut dahsyat terdengar radius kilometer ungkapnya menduga alami sejenis roket satelit simpulkan buatan efek tekanan kaca panas meleleh mendeteksi radar teleskop memantau desingan -------------------------------------------------------------------------------- /src/cfwsbaru/Edge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | /** 9 | * 10 | * @author CassiestGirl 11 | */ 12 | public class Edge { 13 | 14 | int idx = 0; 15 | int idj = 0; 16 | String value = null; 17 | 18 | public Edge(int x, int j, String nilai) { 19 | idx = x; 20 | idj = j; 21 | value = nilai; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/cfwsbaru/result/proc_4.txt: -------------------------------------------------------------------------------- 1 | lembaga penerbangan antariksa lapan meneliti benda jatuh duren sawit jakarta timur menemukan batuan benda jatuh sulit menyimpulkan menemukan bendanya temukan batuannya sulit melacak peneliti lembaga penerbangan antariksa lapan bidang matahari antariksa abdurrahman lokasi abdurrahman benda jatuh berbahaya efeknya tumpukan benda panas meleleh bahaya efek tumpukan benda benda panas meleleh pukul tim lapan lokasi jatuhnya benda asing lapan menemukan benda material lokasi puslabfor polri -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=1b8e26c0 2 | build.xml.script.CRC32=fd104bdc 3 | build.xml.stylesheet.CRC32=28e38971@1.38.1.45 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=1b8e26c0 7 | nbproject/build-impl.xml.script.CRC32=ba16923c 8 | nbproject/build-impl.xml.stylesheet.CRC32=78c6a6ee@1.38.1.45 9 | -------------------------------------------------------------------------------- /nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | file:/home/ata/Desktop/cfwsbaru/src/cfwsbaru/entity/Document.java 6 | file:/home/ata/Desktop/cfwsbaru/src/cfwsbaru/entity/Node.java 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/cfwsbaru/result/proc_3.txt: -------------------------------------------------------------------------------- 1 | menteri negara riset teknologi menristek suharna surapnata memastikan benda menimpa rumah duren sawit jakarta menristek menunggu laporan pengawas tenaga nuklir bapeten ledakan penyebabnya instansi bapeten lapan suharna wartawan kantor wapres jl medan merdeka jakarta suharna memastikan benda rumah porak poranda berbahaya radiasi fenomena fenomena alam berbahaya radiasi pengukuran bapeten suharna mengungkapkan bapeten pengukuran lokasi bendanya suharna berjanji laporannya bapeten memgumumkannya masyarakat -------------------------------------------------------------------------------- /src/cfwsbaru/result/proc_1.txt: -------------------------------------------------------------------------------- 1 | penambahan radiasi lingkungan lokasi ledakan duren sawit jakarta timur warga lokasi khawatir uji background radiasi penambahan radiasi lingkungan artinya non radioaktif pengawas tenaga nuklir bapeten as natio lasman detikcom natio tim bapeten tiba lokasi ledakan pukul penerjunan tim indikasi nuklir lakukan bone nggak usah khawatir natio asteroid jatuh perairan bone oktober ledakan duren sawit rumah rusak rumah rusak atap lantai runtuh beruntung korban jiwa peristiwa penyebab ledakan lembaga penerbangan antariksa lapan menduga benda asteroid bone -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | cfwsbaru 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/cfwsbaru/result/proc_2.txt: -------------------------------------------------------------------------------- 1 | misteri ledakan jl delima duren sawit jakarta timur terpecahkan benda jatuh rumah sudarmodjo mirip asteroid jatuh bone oktober warga kilatan benda asing menimpa rumah kilatan asteroid asteroid pecah angkasa peneliti lembaga penerbangan antariksa lapan bidang matahari antariksa abdurrahman lokasi abdurrahman ledakan duren sawit ledakan bone oktober benda meledak terbakar kilatan masyarakat api meledak angkasa jatuh laut bone ledakan dahsyat terdengar radius kilometer ungkapnya abdurrahman menduga benda jatuh duren sawit benda alami sejenis roket satelit simpulkan benda menduga benda buatan roket satelit benda alami abdurrahman lokasi efek tekanan kaca pecah efek panas benda terbakar meleleh abdurrahman mendeteksi radar teleskop memantau benda jatuh warga desingan kilatan -------------------------------------------------------------------------------- /src/cfwsbaru/resources/4.txt: -------------------------------------------------------------------------------- 1 | Lembaga Penerbangan dan Antariksa (Lapan) mengaku kesulitan dalam meneliti benda apa yang jatuh di Duren Sawit, Jakarta Timur. Kesulitan itu dikarenakan mereka tak menemukan batuan benda yang jatuh tersebut. 2 | 3 | "Kami sulit menyimpulkan karena tidak menemukan bendanya. Kita tidak temukan batuannya. Jadi sulit untuk melacak jenisnya," kata peneliti Lembaga Penerbangan dan Antariksa (Lapan) bidang Matahari dan Antariksa, Abdurrahman, di lokasi kejadian, Jumat (30/4/2010). 4 | 5 | Abdurrahman mengatakan, benda yang jatuh tersebut tidak berbahaya. Efeknya hanya terjadi tumpukan yang menyebabkan benda di sekitarnya akan panas dan meleleh. 6 | 7 | "Tidak bahaya. Tapi efek tumpukan benda biasanya akan membuat benda sekitarnya panas dan meleleh," jelasnya. 8 | 9 | Sampai pukul 17.30 WIB, tim Lapan masih di lokasi jatuhnya benda asing tersebut. Namun Lapan tak menemukan benda apa pun yang bisa untuk diteliti. Material yang ada di lokasi sudah dibawa Puslabfor Polri untuk diperiksa. -------------------------------------------------------------------------------- /src/cfwsbaru/hdProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | import java.io.File; 9 | import java.io.IOException; 10 | import java.util.logging.Level; 11 | import java.util.logging.Logger; 12 | 13 | 14 | public class hdProcess { 15 | 16 | public static void main(String[] args) { 17 | hdProcess hdp = new hdProcess(); 18 | } 19 | 20 | public hdProcess() { 21 | listFolder(); 22 | } 23 | 24 | private void listFolder() { 25 | File list[] = null; 26 | File mydir = new File ("c:/"); 27 | File[] listdir = mydir.listFiles(); 28 | for (File dir : listdir) { 29 | if (dir.isDirectory()) { 30 | list = dir.listFiles(); 31 | } 32 | } 33 | for (int i = 0; i < list.length; i++) { 34 | System.out.println(list[i]); 35 | } 36 | } 37 | 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/cfwsbaru/resources/3.txt: -------------------------------------------------------------------------------- 1 | Menteri Negara Riset dan Teknologi (Menristek) Suharna Surapnata belum bisa memastikan benda yang menimpa rumah di Duren Sawit, Jakarta. Menristek masih menunggu laporan Badan Pengawas Tenaga Nuklir (Bapeten). 2 | 3 | "Ledakan itu dari apa belum diketahui, sumber dari apa belum tahu, untuk mencari penyebabnya nanti dari berbagai instansi, Bapeten dan Lapan," ujar Suharna ketika ditemui wartawan di Kantor Wapres, Jl Medan Merdeka Selatan, Jakarta, Jumat (30/4/2010). 4 | 5 | Meski belum diketahui, Suharna memastikan jika benda yang membuat 3 dinding rumah porak-poranda itu tidaklah berbahaya dan tidak punya radiasi. Fenomena ini juga dinilai sebagai fenomena alam biasa. 6 | 7 | "Tidak berbahaya, tidak ada radiasi, itu berdasarkan hasil pengukuran dari Bapeten," katanya. 8 | 9 | Suharna mengungkapkan, Bapeten langsung melakukan pengukuran di lokasi pada hari ini. Namun, jenis bendanya belum langsung diketahui hari ini juga. 10 | 11 | Suharna berjanji jika telah ada laporannya dari Bapeten akan langsung memgumumkannya ke masyarakat. -------------------------------------------------------------------------------- /src/cfwsbaru/resources/1.txt: -------------------------------------------------------------------------------- 1 | Penambahan radiasi lingkungan tidak ditemukan di sekitar lokasi ledakan di Duren Sawit, Jakarta Timur. Warga yang tinggal di sekitar lokasi tidak perlu khawatir. 2 | 3 | "Kita uji background radiasi, hasilnya tidak ada penambahan radiasi lingkungan. Artinya, non radioaktif," kata Kepala Badan Pengawas Tenaga Nuklir (Bapeten) As Natio Lasman kepada detikcom, Jumat (30/4/2010). 4 | 5 | Natio mengatakan, tim dari Bapeten tiba di lokasi ledakan sekitar pukul 10.00 WIB. Penerjunan tim bukan karena ada indikasi nuklir, namun karena memang biasa dilakukan. 6 | 7 | "Itu memang biasa kita lakukan seperti waktu di Bone, jadi nggak usah khawatir," kata Natio. Asteroid besar jatuh di perairan Bone pada 8 Oktober 2009. 8 | 9 | Ledakan di Duren Sawit menyebabkan tiga rumah rusak, Kamis (29/4/2010). Bahkan salah satu rumah rusak berat, atap hingga lantai dua runtuh. Beruntung, tidak ada korban jiwa dalam peristiwa itu. 10 | 11 | Apa penyebab ledakan itu, belum diketahui pasti. Namun Lembaga Penerbangan dan Antariksa (Lapan) menduga, benda itu asteroid karena ada kemiripan dengan yang di Bone. 12 | -------------------------------------------------------------------------------- /src/cfwsbaru/resources/2.txt: -------------------------------------------------------------------------------- 1 | Misteri ledakan di Jl Delima, Duren Sawit, Jakarta Timur belum terpecahkan. Namun benda yang jatuh di rumah Sudarmodjo tersebut diduga mirip asteroid yang pernah jatuh di Bone pada 8 Oktober 2009. Sejumlah warga melihat adanya kilatan sebelum benda asing itu menimpa rumah. 2 | 3 | "Kalau ada kilatan bisa jadi asteroid. Asteroid itu pecah di angkasa," peneliti Lembaga Penerbangan dan Antariksa (Lapan) bidang Matahari dan Antariksa, Abdurrahman, di lokasi kejadian, Jumat (30/4/2010). 4 | 5 | Menurut Abdurrahman, ledakan di Duren Sawit ada kemiripan dengan ledakan di Bone pada tahun 8 Oktober 2010. Saat benda itu meledak dan terbakar, seperti ada kilatan. 6 | 7 | "Kalau kata masyarakat seperti kembang api. Dia meledak di angkasa kemudian jatuh di laut (Bone). Waktu itu ledakan sangat dahsyat sampai terdengar dari radius beberapa kilometer," ungkapnya. 8 | 9 | Abdurrahman menduga benda yang jatuh di Duren Sawit adalah benda alami, bukan sejenis roket atau satelit. 10 | 11 | "Kami belum bisa simpulkan itu benda apa. Kami menduga itu bukan benda buatan seperti roket atau satelit. Mungkin benda alami," ujar 12 | 13 | Abdurrahman mengatakan, setelah melihat di lokasi, memang ada terlihat efek tekanan karena banyak kaca yang pecah. Efek panas juga memang kelihatan. 14 | 15 | "Ada benda yang terbakar dan juga ada yang meleleh," katanya. 16 | 17 | Abdurrahman menjelaskan, tidak mendeteksi melalui radar atau teleskop untuk memantau benda yang jatuh. Beberapa warga menjelaskan ada desingan dan kilatan. -------------------------------------------------------------------------------- /src/cfwsbaru/entity/NodeHasDocument.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru.entity; 7 | 8 | import cfwsbaru.Connect; 9 | import java.sql.PreparedStatement; 10 | import java.sql.SQLException; 11 | import java.util.logging.Level; 12 | import java.util.logging.Logger; 13 | 14 | /** 15 | * 16 | * @author ata 17 | */ 18 | public class NodeHasDocument extends Connect{ 19 | public Integer nodeId; 20 | public Integer documentId; 21 | 22 | public NodeHasDocument(Integer nodeId, Integer documentId) { 23 | this.nodeId = nodeId; 24 | this.documentId = documentId; 25 | } 26 | 27 | 28 | 29 | public boolean exist(){ 30 | if(count("node_has_document", " nodeId = "+nodeId+" AND documentId = "+documentId) > 0){ 31 | return true; 32 | } 33 | return false; 34 | } 35 | 36 | public boolean save(){ 37 | if(exist()){ 38 | return false; 39 | } 40 | 41 | try { 42 | PreparedStatement statement = connection() 43 | .prepareStatement("INSERT INTO " 44 | + "node_has_document(nodeId, documentId)" 45 | + " VALUES(?,?)"); 46 | statement.setInt(1, nodeId); 47 | statement.setInt(2, documentId); 48 | return statement.execute(); 49 | 50 | //statement. 51 | } catch (SQLException ex) { 52 | Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex); 53 | } 54 | return false; 55 | } 56 | 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/cfwsbaru/TreeLama.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | import java.io.File; 9 | import java.io.FileNotFoundException; 10 | import java.util.HashMap; 11 | import java.util.logging.Level; 12 | import java.util.logging.Logger; 13 | 14 | /** 15 | * 16 | * @author CassiestGirl 17 | */ 18 | public class TreeLama { 19 | 20 | private static class node { 21 | private int node; 22 | 23 | public node() { 24 | } 25 | } 26 | node root; 27 | HashMap label = new HashMap(); 28 | HashMap doc = new HashMap(); 29 | File files[] = null; 30 | 31 | public TreeLama() { 32 | root = new node(); 33 | } 34 | 35 | private void bacaDoc() { 36 | File dir = new File (""); 37 | files = dir.listFiles(); 38 | for (File f : files) { 39 | try { 40 | java.util.Scanner input = new java.util.Scanner(f); 41 | input.useDelimiter("\n"); 42 | String simpanAwl = ""; 43 | while (input.hasNext()){ 44 | simpanAwl.concat(input.next()); 45 | } 46 | doc.put(f.getName(), simpanAwl); 47 | } catch (FileNotFoundException ex) { 48 | Logger.getLogger(TreeLama.class.getName()).log(Level.SEVERE, null, ex); 49 | } 50 | 51 | } 52 | } 53 | 54 | private void constructTree() { 55 | root.node = 0; 56 | doc.get(files[0]); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/cfwsbaru/ConnectDB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | import java.io.File; 9 | import java.io.FileInputStream; 10 | import java.sql.Connection; 11 | import java.sql.*; 12 | 13 | public class ConnectDB { 14 | 15 | public static void main (String [] args) throws Exception { 16 | ConnectDB db = new ConnectDB(); 17 | } 18 | 19 | public ConnectDB () throws Exception { 20 | insertFile(); 21 | } 22 | 23 | public Connection getConnection() throws Exception { 24 | String driver = "com.mysql.jdbc.Driver"; 25 | String url = "jdbc:mysql://localhost/skripsi_cfws"; 26 | String username = "root"; 27 | String password = ""; 28 | Class.forName(driver); 29 | Connection conn = DriverManager.getConnection(url, username, password); 30 | return conn; 31 | } 32 | 33 | private void insertFile() throws Exception { 34 | Connection conn = getConnection(); 35 | conn.setAutoCommit(false); 36 | PreparedStatement pstmt = null; 37 | File f = new File ("src/cfwsbaru/frequent/"); 38 | File files[] = f.listFiles(); 39 | for (File fi : files) { 40 | FileInputStream fis = new FileInputStream (fi); 41 | pstmt = conn.prepareStatement("insert into cluster_candidate(name_file, file) values (?, ?)"); 42 | pstmt.setString(1, (String) fi.getName()); 43 | pstmt.setAsciiStream(2, fis, (int) fi.length()); 44 | pstmt.executeUpdate(); 45 | conn.commit(); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/cfwsbaru/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | import cfwsbaru.entity.Document; 9 | import cfwsbaru.entity.Node; 10 | import java.util.List; 11 | 12 | /** 13 | * 14 | * @author ata 15 | */ 16 | public class Main { 17 | public static void main(String[] args){ 18 | //testNewDocument(); 19 | testDocument(); 20 | ///testNewNode(); 21 | //testAddDocument(); 22 | 23 | } 24 | 25 | public static void testAddDocument(){ 26 | Document doc = new Document(); 27 | doc.fileName = "namafile.txt"; 28 | doc.content = "Halow saya lapar sekali"; 29 | doc.save(); 30 | Node.addDocument(doc); 31 | } 32 | 33 | public static void testNewNode(){ 34 | Node node = new Node(); 35 | node.words = "Saya sangat lapar"; 36 | node.save(); 37 | System.out.println(node.id); 38 | } 39 | public static void testDocument(){ 40 | System.out.println("Test Load Document"); 41 | List documents = Document.loads("src/cfwsbaru/frequent/"); 42 | Document.saveAll(documents); 43 | for(Document doc: Document.findAll()){ 44 | System.out.println(doc.id); 45 | System.out.println(doc.fileName); 46 | System.out.println(doc.content); 47 | Node.addDocument(doc); 48 | } 49 | } 50 | 51 | public static void testNewDocument(){ 52 | Document document = new Document(); 53 | document.fileName = "Asal Aja"; 54 | document.content = "Asal Juga"; 55 | document.save();; 56 | System.out.println(document.id); 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /skripsi_cfws.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 2.11.8.1deb5+lenny4 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: Jul 22, 2010 at 02:14 PM 7 | -- Server version: 5.0.51 8 | -- PHP Version: 5.3.2-0.dotdeb.2 9 | 10 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; 11 | 12 | 13 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 14 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 15 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 16 | /*!40101 SET NAMES utf8 */; 17 | 18 | -- 19 | -- Database: `skripsi_cfws` 20 | -- 21 | 22 | -- -------------------------------------------------------- 23 | 24 | -- 25 | -- Table structure for table `document` 26 | -- 27 | 28 | CREATE TABLE IF NOT EXISTS `document` ( 29 | `id` bigint(20) NOT NULL auto_increment, 30 | `fileName` varchar(255) NOT NULL, 31 | `content` text NOT NULL, 32 | PRIMARY KEY (`id`) 33 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; 34 | 35 | -- 36 | -- Dumping data for table `document` 37 | -- 38 | 39 | 40 | -- -------------------------------------------------------- 41 | 42 | -- 43 | -- Table structure for table `node` 44 | -- 45 | 46 | CREATE TABLE IF NOT EXISTS `node` ( 47 | `id` bigint(20) NOT NULL auto_increment, 48 | `words` text NOT NULL, 49 | `wordLength` int(11) NOT NULL, 50 | `documentCount` int(11) NOT NULL, 51 | `parentId` bigint(20) NOT NULL, 52 | PRIMARY KEY (`id`), 53 | KEY `parentId` (`parentId`) 54 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; 55 | 56 | -- 57 | -- Dumping data for table `node` 58 | -- 59 | 60 | 61 | -- -------------------------------------------------------- 62 | 63 | -- 64 | -- Table structure for table `node_has_document` 65 | -- 66 | 67 | CREATE TABLE IF NOT EXISTS `node_has_document` ( 68 | `nodeId` bigint(20) NOT NULL, 69 | `documentId` bigint(20) NOT NULL, 70 | KEY `nodeId` (`nodeId`,`documentId`) 71 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 72 | 73 | -- 74 | -- Dumping data for table `node_has_document` 75 | -- 76 | 77 | -------------------------------------------------------------------------------- /src/cfwsbaru/stopwords_list.txt: -------------------------------------------------------------------------------- 1 | yang di dan itu dengan untuk tidak ini dari dalam akan pada juga saya ke karena tersebut bisa ada mereka lebih kata tahun sudah atau saat oleh menjadi orang ia telah adalah seperti sebagai bahwa dapat para harus namun kita dua satu masih hari hanya mengatakan kepada kami setelah melakukan lalu belum lain dia kalau terjadi banyak menurut anda hingga tak baru beberapa ketika saja jalan sekitar secara dilakukan sementara tapi sangat hal sehingga seorang bagi besar lagi selama antara waktu sebuah jika sampai jadi terhadap tiga serta pun salah merupakan atas sejak membuat baik memiliki kembali selain tetapi pertama kedua memang pernah apa mulai sama tentang bukan agar semua sedang kali kemudian hasil sejumlah juta persen sendiri katanya demikian masalah mungkin umum setiap bulan bagian bila lainnya terus luar cukup termasuk sebelumnya bahkan wib tempat perlu menggunakan memberikan rabu sedangkan kamis langsung apakah pihak melalui diri mencapai minggu aku berada tinggi ingin sebelum tengah kini the tahu bersama depan selasa begitu merasa berbagai mengenai maka jumlah masuk katanya mengalami sering ujar kondisi akibat hubungan empat paling mendapatkan selalu lima meminta melihat sekarang mengaku mau kerja acara menyatakan masa proses tanpa selatan sempat adanya hidup datang senin rasa maupun seluruh mantan lama jenis segera misalnya mendapat bawah jangan meski terlihat akhirnya jumat punya yakni terakhir kecil panjang badan juni of jelas jauh tentu semakin tinggal kurang mampu posisi asal sekali sesuai sebesar berat dirinya memberi pagi sabtu ternyata mencari sumber ruang menunjukkan biasanya nama sebanyak utara berlangsung barat kemungkinan yaitu berdasarkan sebenarnya cara utama pekan terlalu membawa kebutuhan suatu menerima penting tanggal bagaimana terutama tingkat awal sedikit nanti pasti muncul dekat lanjut ketiga biasa dulu kesempatan ribu akhir membantu terkait sebab menyebabkan khusus bentuk ditemukan diduga mana ya kegiatan sebagian tampil hampir bertemu usai berarti keluar pula digunakan justru padahal menyebutkan gedung apalagi program milik teman menjalani keputusan sumber a upaya mengetahui mempunyai berjalan menjelaskan b mengambil benar lewat belakang ikut barang meningkatkan kejadian kehidupan keterangan penggunaan masing-masing menghadapi -------------------------------------------------------------------------------- /nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.run.all.processors=true 4 | application.title=cfwsbaru 5 | application.vendor=CassiestGirl 6 | build.classes.dir=${build.dir}/classes 7 | build.classes.excludes=**/*.java,**/*.form 8 | # This directory is removed when the project is cleaned: 9 | build.dir=build 10 | build.generated.dir=${build.dir}/generated 11 | build.generated.sources.dir=${build.dir}/generated-sources 12 | # Only compile against the classpath explicitly listed here: 13 | build.sysclasspath=ignore 14 | build.test.classes.dir=${build.dir}/test/classes 15 | build.test.results.dir=${build.dir}/test/results 16 | debug.classpath=\ 17 | ${run.classpath} 18 | debug.test.classpath=\ 19 | ${run.test.classpath} 20 | # This directory is removed when the project is cleaned: 21 | dist.dir=dist 22 | dist.jar=${dist.dir}/cfwsbaru.jar 23 | dist.javadoc.dir=${dist.dir}/javadoc 24 | endorsed.classpath= 25 | excludes= 26 | includes=** 27 | jar.compress=false 28 | javac.classpath=\ 29 | ${libs.MySQLDriver.classpath} 30 | # Space-separated list of extra javac options 31 | javac.compilerargs= 32 | javac.deprecation=false 33 | javac.processorpath=\ 34 | ${javac.classpath} 35 | javac.source=1.5 36 | javac.target=1.5 37 | javac.test.classpath=\ 38 | ${javac.classpath}:\ 39 | ${build.classes.dir}:\ 40 | ${libs.junit_4.classpath} 41 | javadoc.additionalparam= 42 | javadoc.author=false 43 | javadoc.encoding=${source.encoding} 44 | javadoc.noindex=false 45 | javadoc.nonavbar=false 46 | javadoc.notree=false 47 | javadoc.private=false 48 | javadoc.splitindex=true 49 | javadoc.use=true 50 | javadoc.version=false 51 | javadoc.windowtitle= 52 | main.class=cfwsbaru.Main 53 | manifest.file=manifest.mf 54 | meta.inf.dir=${src.dir}/META-INF 55 | platform.active=default_platform 56 | run.classpath=\ 57 | ${javac.classpath}:\ 58 | ${build.classes.dir} 59 | # Space-separated list of JVM arguments used when running the project 60 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value 61 | # or test-sys-prop.name=value to set system properties for unit tests): 62 | run.jvmargs= 63 | run.test.classpath=\ 64 | ${javac.test.classpath}:\ 65 | ${build.test.classes.dir} 66 | source.encoding=UTF-8 67 | src.dir=src 68 | test.src.dir=test 69 | -------------------------------------------------------------------------------- /src/cfwsbaru/Connect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | import java.sql.Connection; 9 | import java.sql.DriverManager; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import java.sql.Statement; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | 16 | /** 17 | * 18 | * @author ata 19 | */ 20 | public class Connect { 21 | private static Connection connection = null; 22 | private static Connect instance = null; 23 | public static Connection getConnection(){ 24 | if(connection == null){ 25 | try { 26 | String driver = "com.mysql.jdbc.Driver"; 27 | String url = "jdbc:mysql://localhost/skripsi_cfws"; 28 | String username = "root"; 29 | String password = "root"; 30 | try { 31 | Class.forName(driver); 32 | } catch (ClassNotFoundException ex) { 33 | Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex); 34 | } 35 | connection = DriverManager.getConnection(url, username, password); 36 | } catch (SQLException ex) { 37 | Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex); 38 | } 39 | } 40 | return connection; 41 | } 42 | 43 | public static Connect getInstance(){ 44 | if(instance == null){ 45 | instance = new Connect(); 46 | } 47 | return instance; 48 | } 49 | 50 | protected Connection connection(){ 51 | return Connect.getConnection(); 52 | } 53 | 54 | 55 | 56 | public ResultSet query(String query){ 57 | 58 | try { 59 | Statement statement = connection().createStatement(); 60 | return statement.executeQuery(query); 61 | } catch (SQLException ex) { 62 | Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex); 63 | } 64 | return null; 65 | } 66 | 67 | public int count(String table, String condition){ 68 | int count = 0; 69 | try { 70 | ResultSet result = query("SELECT COUNT(*) FROM " + table 71 | + " WHERE " + condition); 72 | while (result.next()) { 73 | count = result.getInt(1); 74 | } 75 | } catch (SQLException ex) { 76 | Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex); 77 | } 78 | return count; 79 | } 80 | 81 | public int count(String table){ 82 | return count(table, "1"); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/cfwsbaru/getWords.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package cfwsbaru; 6 | 7 | import java.io.File; 8 | import java.io.FileOutputStream; 9 | import java.io.IOException; 10 | import java.util.HashSet; 11 | import java.util.Set; 12 | import java.util.Vector; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | 16 | public class getWords { 17 | 18 | private Vector vector = null; 19 | 20 | /* public static void main(String[] args) { 21 | getWords gw = new getWords(); 22 | }*/ 23 | 24 | public getWords() { 25 | File dir = new File ("src/cfwsbaru/result/"); 26 | vector = new Vector(); 27 | //simpanWords(); 28 | bacaFolder(dir); 29 | } 30 | 31 | private void simpanWords(File file) { 32 | try { 33 | //File file = new File("src/cfwsbaru/result/preprocess_1.txt"); 34 | java.util.Scanner list = new java.util.Scanner(file); 35 | while (list.hasNext()) { 36 | String wordlist = list.next(); 37 | if (!vector.contains(wordlist)){ 38 | vector.add(wordlist); 39 | 40 | /* if (!vector.equals(wordlist)) { 41 | System.out.println(wordlist); 42 | 43 | }*/ 44 | } 45 | } 46 | tulisFile(file, vector); 47 | vector.clear(); 48 | 49 | } catch (Exception e) { 50 | } 51 | } 52 | private void tulisFile(File namaFile, Vector vec) { 53 | //Vector v = new Vector(); 54 | String path = "src/cfwsbaru/getword/" ; 55 | String pathAsli = path.replaceFirst(namaFile.getName(), ""); 56 | FileOutputStream fos = null; 57 | try { 58 | fos = new FileOutputStream(pathAsli + "new_" + namaFile.getName()); 59 | //BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos)); 60 | for (int i = 0; i < vec.size(); i++) { 61 | String tulis = (String) vec.get(i) + " "; 62 | fos.write(tulis.getBytes()); 63 | } 64 | //out.newLine(); 65 | 66 | } catch (Exception ex) { 67 | Logger.getLogger(preprocessing.class.getName()).log(Level.SEVERE, null, ex); 68 | } finally { 69 | try { 70 | fos.flush(); 71 | fos.close(); 72 | } catch (IOException ex) { 73 | Logger.getLogger(preprocessing.class.getName()).log(Level.SEVERE, null, ex); 74 | } 75 | } 76 | //out.newLine(); 77 | 78 | } 79 | 80 | private void bacaFolder(File dir) { 81 | //File dir = new File ("src/cfwsbaru/resources/"); 82 | File files[] = dir.listFiles(); 83 | for (File f : files) { 84 | simpanWords(f); 85 | } 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/cfwsbaru/GST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | import cfwsbaru.entity.Node; 9 | import cfwsbaru.entity.Document; 10 | import java.util.ArrayList; 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class GST { 15 | public static Integer no = 0; 16 | public static Node root = null; 17 | /* 18 | public static void add(Document doc){ 19 | System.out.println(doc.no); 20 | String content = doc.content; 21 | int count = wordCount(content); 22 | while(count > 0){ 23 | no++; 24 | Node node = new Node(no, content); 25 | node.addDoc(doc); 26 | node.firtdoc = doc; 27 | root.addChild(node); 28 | content = removeFirstWord(content); 29 | count = wordCount(content); 30 | System.out.println(doc.no); 31 | } 32 | 33 | } 34 | 35 | public static String removeFirstWord(String str){ 36 | List tmp = Arrays.asList(str.split(" ")); 37 | ArrayList words = new ArrayList(tmp); 38 | words.remove(0); 39 | return array2string(words.toArray()); 40 | } 41 | 42 | public static String array2string(Object[] words){ 43 | String result = ""; 44 | for(Object word: words){ 45 | result += " " + (String) word; 46 | } 47 | return result; 48 | } 49 | public static int wordCount(String str){ 50 | return str.trim().split(" ").length; 51 | } 52 | 53 | public static List pembanding(String lama, String baru){ 54 | List list_lama = Arrays.asList(lama.split(" ")); 55 | List list_baru = Arrays.asList(baru.split(" ")); 56 | 57 | int length = list_baru.size(); 58 | if(list_lama.size() < length){ 59 | length = list_lama.size(); 60 | } 61 | 62 | int jumlah_sama = 0; 63 | for(int i = 0; i < length; i++){ 64 | if(list_baru.get(i).equalsIgnoreCase(list_lama.get(i))){ 65 | list_baru.remove(i); 66 | list_lama.remove(i); 67 | jumlah_sama++; 68 | } else { 69 | break; 70 | } 71 | } 72 | List result = new ArrayList(); 73 | if(jumlah_sama != 0){ 74 | 75 | if(list_lama.size() > 0){ 76 | result.add(array2string(list_lama.toArray())); 77 | } 78 | if(list_baru.size() > 0){ 79 | result.add(array2string(list_baru.toArray())); 80 | } 81 | return result; 82 | } 83 | return result; 84 | } 85 | 86 | 87 | public static void main(String[] args){ 88 | root = new Node(0); 89 | for(Document doc: Document.loads("src/cfwsbaru/frequent/")){ 90 | add(doc); 91 | } 92 | System.out.println(root); 93 | 94 | } 95 | * 96 | */ 97 | } 98 | -------------------------------------------------------------------------------- /src/cfwsbaru/entity/Document.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru.entity; 7 | 8 | import cfwsbaru.Connect; 9 | import java.io.File; 10 | import java.io.FileNotFoundException; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | import java.util.Scanner; 17 | import java.util.logging.Level; 18 | import java.util.logging.Logger; 19 | 20 | /** 21 | * 22 | * @author CassiestGirl 23 | */ 24 | public class Document extends Connect{ 25 | public Integer id = 0; 26 | public String fileName = ""; 27 | public String content =""; 28 | 29 | 30 | 31 | public boolean exist(){ 32 | if(count("document", " fileName='"+fileName+"'") > 0){ 33 | try { 34 | ResultSet resultSet = query("SELECT * FROM document " 35 | + "WHERE fileName = '" + fileName + "'"); 36 | if (resultSet.next()) { 37 | id = resultSet.getInt("id"); 38 | fileName = resultSet.getString("fileName"); 39 | content = resultSet.getString("content"); 40 | } 41 | return true; 42 | } catch (SQLException ex) { 43 | Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex); 44 | } 45 | } 46 | return false; 47 | } 48 | 49 | 50 | 51 | public boolean save(){ 52 | if(exist()){ 53 | return false; 54 | } 55 | try { 56 | PreparedStatement statement = connection() 57 | .prepareStatement("INSERT INTO document(fileName, content)" 58 | + " VALUES(?,?)"); 59 | statement.setString(1, fileName); 60 | statement.setString(2, content); 61 | boolean result = statement.execute(); 62 | ResultSet rs = statement.getGeneratedKeys(); 63 | if(rs.next()){ 64 | id = rs.getInt(1); 65 | } 66 | return result; 67 | } catch (SQLException ex) { 68 | Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex); 69 | } 70 | return false; 71 | } 72 | 73 | 74 | /** 75 | * Mengambil Document Dari file 76 | * @param file 77 | * @return Document 78 | */ 79 | public static Document load(File file){ 80 | Document doc = new Document(); 81 | doc.fileName = file.getName(); 82 | try { 83 | Scanner scanner = new Scanner(file); 84 | scanner.useDelimiter(" "); 85 | while (scanner.hasNext()) { 86 | doc.content += " " + scanner.next(); 87 | } 88 | doc.content = doc.content.replaceAll("null ",""); 89 | doc.content = doc.content.trim(); 90 | } catch (FileNotFoundException ex) { 91 | Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex); 92 | } 93 | return doc; 94 | } 95 | /** 96 | * Mengambil banyak file dari folder 97 | * @param folderPath 98 | * @return ArrayList 99 | */ 100 | public static List loads(String folderPath){ 101 | File folder = new File(folderPath); 102 | ArrayList docs = new ArrayList(); 103 | for(File file: folder.listFiles()){ 104 | docs.add(load(file)); 105 | } 106 | return docs; 107 | } 108 | 109 | public static void saveAll(List documents){ 110 | for(Document document: documents){ 111 | document.save(); 112 | } 113 | 114 | } 115 | 116 | public static List findAll(){ 117 | ResultSet result = Connect.getInstance().query("SELECT * FROM document"); 118 | List documents = new ArrayList(); 119 | try { 120 | 121 | while (result.next()) { 122 | Document document = new Document(); 123 | document.id = result.getInt("id"); 124 | document.fileName = result.getString("fileName"); 125 | document.content = result.getString("content"); 126 | documents.add(document); 127 | } 128 | 129 | } catch (SQLException ex) { 130 | Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex); 131 | } 132 | return documents; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/cfwsbaru/preprocessing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | import java.io.BufferedWriter; 9 | import java.io.File; 10 | import java.io.FileNotFoundException; 11 | import java.io.FileOutputStream; 12 | import java.io.IOException; 13 | import java.io.OutputStreamWriter; 14 | import java.util.Vector; 15 | import java.util.logging.Level; 16 | import java.util.logging.Logger; 17 | 18 | 19 | public class preprocessing { 20 | 21 | //private File file = null; 22 | private Vector vector = null; 23 | 24 | 25 | public static void main (String[] args) { 26 | //preprocessing pre = new preprocessing(); 27 | } 28 | 29 | public preprocessing(File dir) { 30 | vector = new Vector(); 31 | simpanList(); 32 | bacaFolder(dir); 33 | //bacaFile(); 34 | } 35 | 36 | private void simpanList () { 37 | try { 38 | File file = new File("src/cfwsbaru/stopwords_list.txt"); 39 | java.util.Scanner input = new java.util.Scanner(file); 40 | input.useDelimiter(" "); 41 | while (input.hasNext()) { 42 | String kata = input.next(); 43 | if (kata.length() > 1) { 44 | vector.add(kata); 45 | } 46 | } 47 | /*for (int i = 0; i < vector.size(); i++) { 48 | 49 | System.out.println(vector.get(i)); 50 | System.out.println("###########################################"); 51 | }*/ 52 | } catch (Exception e) {} 53 | } 54 | 55 | private void bacaFile (File file) { 56 | try { 57 | //File file = new File("src/cfwsbaru/resources/1.txt"); 58 | java.util.Scanner input = new java.util.Scanner(file); 59 | Vector ve = new Vector(); 60 | input.useDelimiter("\n"); 61 | String simpan = ""; 62 | while (input.hasNext()) { 63 | String kata = input.next(); 64 | //ve.add(kata); 65 | simpan += kata; 66 | 67 | } 68 | //System.out.println(simpan); 69 | String[] hasil = simpan.split("[\\p{Punct}\\p{Digit}]"); 70 | 71 | for (int i = 0; i < hasil.length; i ++) { 72 | String[] hasil2 = hasil[i].split("\\s"); 73 | 74 | for (int j = 0; j < hasil2.length; j++) 75 | if (hasil2[j].length() > 1) { 76 | //System.out.println(hasil2[j]); 77 | ve.add(hasil2[j].toLowerCase()); 78 | } 79 | } 80 | 81 | //System.out.println("VECTOR SIZE " + vector.size()); 82 | 83 | for (int i = 0; i < vector.size(); i++) { 84 | String penghilang = (String) vector.get(i); 85 | //System.out.println("^^^^^^^^^^^^^^^^^^^^^^^"); 86 | //System.out.println(penghilang); 87 | //System.out.println("^^^^^^^^^^^^^^^^^^^^^^^"); 88 | int j = 0; 89 | while (j < ve.size()) {//ve.get(j) != null) { 90 | String hilang = (String) ve.get(j); 91 | //System.out.println(hilang); 92 | if (hilang.startsWith(penghilang)) { 93 | 94 | //System.out.println("HAPUS*******************************"); 95 | ve.removeElementAt(j); 96 | } else 97 | j++; 98 | } 99 | } 100 | System.out.println("SELESAI"); 101 | 102 | for (int i = 0; i < ve.size(); i++) { 103 | System.out.println((String)ve.get(i)); 104 | } 105 | System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); 106 | System.out.println(file.getPath()); 107 | 108 | tulisFile(file, ve); 109 | /*for (int i = 0; i < vector.size(); i++) { 110 | //input.useDelimiter((String)vector.get(i)); 111 | input = input.skip((String)vector.get(i)); 112 | } 113 | while (input.hasNext()) { 114 | String kata = input.next(); 115 | System.out.print(kata); 116 | }*/ 117 | } catch (Exception e) {} 118 | } 119 | 120 | private void tulisFile(File namaFile, Vector vec) { 121 | //Vector v = new Vector(); 122 | String path = "src/cfwsbaru/result/" ; 123 | String pathAsli = path.replaceFirst(namaFile.getName(), ""); 124 | FileOutputStream fos = null; 125 | try { 126 | fos = new FileOutputStream(pathAsli + "proc_" + namaFile.getName()); 127 | //BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos)); 128 | for (int i = 0; i < vec.size(); i++) { 129 | String tulis = (String) vec.get(i) + " "; 130 | fos.write(tulis.getBytes()); 131 | } 132 | //out.newLine(); 133 | 134 | } catch (Exception ex) { 135 | Logger.getLogger(preprocessing.class.getName()).log(Level.SEVERE, null, ex); 136 | } finally { 137 | try { 138 | fos.flush(); 139 | fos.close(); 140 | } catch (IOException ex) { 141 | Logger.getLogger(preprocessing.class.getName()).log(Level.SEVERE, null, ex); 142 | } 143 | } 144 | //out.newLine(); 145 | 146 | } 147 | 148 | private void bacaFolder(File dir) { 149 | //File dir = new File ("src/cfwsbaru/resources/"); 150 | File files[] = dir.listFiles(); 151 | for (File f : files) { 152 | bacaFile(f); 153 | } 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /src/cfwsbaru/CFWS.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /src/cfwsbaru/f2w.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru; 7 | 8 | import java.io.File; 9 | import java.io.FileNotFoundException; 10 | import java.io.FileOutputStream; 11 | import java.io.IOException; 12 | import java.util.ArrayList; 13 | import java.util.Arrays; 14 | import java.util.Collections; 15 | import java.util.Comparator; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | import java.util.TreeMap; 19 | import java.util.Vector; 20 | import java.util.logging.Level; 21 | import java.util.logging.Logger; 22 | 23 | /** 24 | * 25 | * @author CassiestGirl 26 | */ 27 | public class f2w { 28 | private Vector vec = null; 29 | public Vector hasil = null; 30 | 31 | /* public static void main (String[] args) throws FileNotFoundException { 32 | f2w fw = new f2w(); 33 | }*/ 34 | 35 | public f2w() { 36 | vec = new Vector(); 37 | countWord(); 38 | bacaWS(); 39 | readFolder(); 40 | } 41 | 42 | private void countWord(){ 43 | try { 44 | Map map = new TreeMap(); 45 | Integer One = new Integer(1); 46 | File dir = new File("src/cfwsbaru/getword/"); 47 | File[] files = dir.listFiles(); 48 | for (File f : files) { 49 | java.util.Scanner input = new java.util.Scanner(f); 50 | input.useDelimiter("\n"); 51 | String simpan = ""; 52 | while (input.hasNext()) { 53 | String kata = input.next(); 54 | simpan += kata; 55 | } 56 | // System.out.println(simpan); 57 | String[] hasil = simpan.split(" "); 58 | 59 | for (int i = 0; i < hasil.length; i++) { 60 | if (hasil[i].length() > 0) { 61 | Integer freq = (Integer) map.get(hasil[i]); 62 | if (freq == null) { 63 | freq = One; 64 | } else { 65 | int val = freq.intValue(); 66 | freq = new Integer(val + 1); 67 | } 68 | map.put(hasil[i], freq); 69 | } 70 | } 71 | } 72 | // System.out.println(map); 73 | ArrayList> entries = new ArrayList>(map.entrySet()); 74 | //String[] resultw = new String[map.size()]; 75 | ArrayList resultw = new ArrayList(); 76 | //int[] resultc = new int [map.size()]; 77 | // ArrayList resultc = new ArrayList(); 78 | int i = 0; 79 | // int k = 0; 80 | for (Map.Entry ent : entries) { 81 | if (ent.getValue() >= 3) { 82 | //resultw[i++] = ; 83 | resultw.add(ent.getKey()); 84 | } 85 | } 86 | /*for (Map.Entry ent1 : entries) { 87 | if (ent1.getValue() >= 2) { 88 | //resultc[k++] = ent1.getValue(); 89 | resultc.add(ent1.getValue()); 90 | } 91 | }*/ 92 | String fi = "src/cfwsbaru/ws.txt"; 93 | FileOutputStream fos = null; 94 | try { 95 | fos = new FileOutputStream(fi); 96 | for (int j = 0; j < resultw.size(); j++) { 97 | String tulis = (String) resultw.get(j) + " "; 98 | fos.write(tulis.getBytes()); 99 | } 100 | } catch (Exception e) { 101 | } 102 | fos.close(); 103 | } catch (IOException ex) { 104 | Logger.getLogger(f2w.class.getName()).log(Level.SEVERE, null, ex); 105 | } 106 | } 107 | 108 | private void bacaWS() { 109 | try { 110 | File file = new File("src/cfwsbaru/ws.txt"); 111 | java.util.Scanner input = new java.util.Scanner(file); 112 | input.useDelimiter(" "); 113 | while (input.hasNext()) { 114 | String kata = input.next(); 115 | if (kata.length() > 1) { 116 | vec.add(kata); 117 | } 118 | } 119 | 120 | } catch (Exception e) { } 121 | } 122 | 123 | private void readFolder() { 124 | File dir = new File ("src/cfwsbaru/getword/"); 125 | File files[] = dir.listFiles(); 126 | for (File f : files) { 127 | removeWords(f); 128 | 129 | } 130 | } 131 | 132 | public void removeWords(File file) { 133 | try { 134 | java.util.Scanner in = new java.util.Scanner(file); 135 | Vector v = new Vector(); 136 | in.useDelimiter(" "); 137 | while (in.hasNext()) { 138 | String word = in.next(); 139 | if (word.length() > 1) { 140 | v.add(word); 141 | } 142 | } 143 | hasil = new Vector(); 144 | int i =0; 145 | while (i < v.size()) { 146 | String f2w = (String) v.get(i); 147 | // System.out.println ("---------"); 148 | // System.out.println (f2w); 149 | // System.out.println("----------"); 150 | for (int j =0; j < vec.size(); j++) { 151 | String fw = (String) vec.get(j); 152 | // System.out.println("$$$$$$$$$$$$$$"); 153 | // System.out.println(fw); 154 | if(f2w.equals(fw)) { 155 | hasil.add(f2w); 156 | // System.out.println("^^^^^^^^^^"); 157 | // System.out.println(); 158 | 159 | } 160 | } 161 | i++; 162 | } 163 | /* for (int k =0; k < hasil.size(); k++) { 164 | System.out.println((String) hasil.get(k)); 165 | } 166 | System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); 167 | System.out.println(file.getPath());*/ 168 | tulisFile(file, hasil); 169 | } catch (Exception e) { } 170 | } 171 | private void tulisFile(File namaFile, Vector vec) { 172 | //Vector v = new Vector(); 173 | String path = "src/cfwsbaru/frequent/" ; 174 | String pathAsli = path.replaceFirst(namaFile.getName(), ""); 175 | FileOutputStream fos = null; 176 | try { 177 | fos = new FileOutputStream(pathAsli + "f2w_" + namaFile.getName()); 178 | //BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos)); 179 | for (int i = 0; i < vec.size(); i++) { 180 | String tulis = (String) vec.get(i) + " "; 181 | fos.write(tulis.getBytes()); 182 | } 183 | 184 | } catch (Exception ex) { 185 | Logger.getLogger(preprocessing.class.getName()).log(Level.SEVERE, null, ex); 186 | } finally { 187 | try { 188 | fos.flush(); 189 | fos.close(); 190 | } catch (IOException ex) { 191 | Logger.getLogger(preprocessing.class.getName()).log(Level.SEVERE, null, ex); 192 | } 193 | } 194 | 195 | } 196 | 197 | } 198 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /src/cfwsbaru/entity/Node.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package cfwsbaru.entity; 7 | 8 | import cfwsbaru.Connect; 9 | import java.sql.PreparedStatement; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | 17 | /** 18 | * 19 | * @author CassiestGirl 20 | */ 21 | public class Node extends Connect{ 22 | public Integer id = 0; 23 | public String words = ""; 24 | public Integer wordLength = 0; 25 | public Integer documentCount = 0; 26 | //public ArrayList docs = new ArrayList(); 27 | public List childs = new ArrayList(); 28 | public Integer parentId = 0; 29 | 30 | 31 | public List getChilds(){ 32 | try { 33 | ResultSet resultSet = query("SELECT * FROM node " + "WHERE parentId = '" + id + "'"); 34 | while(resultSet.next()) { 35 | Node node = new Node(); 36 | node.id = resultSet.getInt("id"); 37 | node.words = resultSet.getString("words"); 38 | node.wordLength = resultSet.getInt("wordLength"); 39 | node.documentCount = resultSet.getInt("documentCount"); 40 | node.parentId = resultSet.getInt("parentId"); 41 | childs.add(node); 42 | } 43 | return childs; 44 | } catch (SQLException ex) { 45 | Logger.getLogger(Node.class.getName()).log(Level.SEVERE, null, ex); 46 | } 47 | return null; 48 | } 49 | 50 | public boolean exist(){ 51 | if(count("node", " words='"+words+"'") > 0){ 52 | try { 53 | ResultSet resultSet = query("SELECT * FROM node " 54 | + "WHERE words = '" + words + "'"); 55 | if (resultSet.next()) { 56 | id = resultSet.getInt("id"); 57 | words = resultSet.getString("words"); 58 | wordLength = resultSet.getInt("wordLength"); 59 | documentCount = resultSet.getInt("documentCount"); 60 | parentId = resultSet.getInt("parentId"); 61 | } 62 | return true; 63 | } catch (SQLException ex) { 64 | Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex); 65 | } 66 | } 67 | return false; 68 | } 69 | 70 | 71 | public boolean update(){ 72 | wordLength = words.split(" ").length; 73 | 74 | try { 75 | PreparedStatement statement = connection() 76 | .prepareStatement("UPDATE node SET" 77 | + "words = ?," 78 | + "wordLength = ?," 79 | + "documentCount = ?," 80 | + "parentId = ? " 81 | + "WHERE id = ?"); 82 | statement.setString(1, words); 83 | statement.setInt(2, wordLength); 84 | statement.setInt(3, documentCount); 85 | statement.setInt(4, parentId); 86 | statement.setInt(5, id); 87 | statement.execute(); 88 | //statement. 89 | } catch (SQLException ex) { 90 | Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex); 91 | } 92 | return false; 93 | } 94 | 95 | public boolean save(){ 96 | if(exist()){ 97 | return false; 98 | } 99 | if(id != 0){ 100 | return update(); 101 | } 102 | wordLength = words.split(" ").length; 103 | 104 | try { 105 | PreparedStatement statement = connection() 106 | .prepareStatement("INSERT INTO " 107 | + "node(words, wordLength, documentCount, parentId)" 108 | + " VALUES(?,?,?,?)"); 109 | statement.setString(1, words); 110 | statement.setInt(2, wordLength); 111 | statement.setInt(3, documentCount); 112 | statement.setInt(4, parentId); 113 | //statement.execute(); 114 | boolean result = statement.execute(); 115 | ResultSet rs = statement.getGeneratedKeys(); 116 | if(rs.next()){ 117 | id = rs.getInt(1); 118 | } 119 | return result; 120 | //statement. 121 | } catch (SQLException ex) { 122 | Logger.getLogger(Document.class.getName()).log(Level.SEVERE, null, ex); 123 | } 124 | return false; 125 | } 126 | 127 | public boolean removeFirstWord(){ 128 | String[] strs = words.split(" "); 129 | if(strs.length - 1 == 0){ 130 | return false; 131 | } 132 | String result = ""; 133 | for(int i = 1; i < strs.length; i++){ 134 | if(i == 1){ 135 | result += strs[i]; 136 | } else { 137 | result += " " + strs[i]; 138 | } 139 | 140 | } 141 | words = result; 142 | return true; 143 | } 144 | 145 | public boolean addChild(Node node){ 146 | node.parentId = id; 147 | return node.save(); 148 | } 149 | 150 | public List createChildsFromWorlds(List words){ 151 | List nodes = new ArrayList(); 152 | for(String word: words){ 153 | Node node = new Node(); 154 | node.words = word; 155 | addChild(node); 156 | nodes.add(node); 157 | } 158 | if(!nodes.isEmpty()){ 159 | return nodes; 160 | } 161 | return null; 162 | } 163 | /** 164 | * Jika word2 lebih pendek dari word1, maka akan langsung mengembalikan null 165 | * @param words1 166 | * @param words2 167 | * @return 168 | */ 169 | private List compareWords(String words1, String words2){ 170 | String tail1 = null; 171 | String tail2 = null; 172 | List result = new ArrayList(); 173 | String[] arrayWords1 = words1.split(" "); 174 | String[] arrayWords2 = words2.split(" "); 175 | if(arrayWords2.length < arrayWords1.length){ 176 | return null; 177 | } 178 | 179 | int countSame = 0; 180 | int minLength = arrayWords1.length; 181 | for(int i = 0; i < minLength;i++){ 182 | if(arrayWords1[i].equalsIgnoreCase(arrayWords2[i])){ 183 | countSame++; 184 | } else { 185 | if(tail1 == null){ 186 | tail1 = arrayWords1[i]; 187 | tail2 = arrayWords2[i]; 188 | } else { 189 | tail1 += arrayWords1[i]; 190 | tail2 += arrayWords2[i]; 191 | } 192 | } 193 | } 194 | if(countSame != 0){ 195 | if(arrayWords1.length != countSame){ 196 | result.add(tail1); 197 | } 198 | result.add(tail2); 199 | return result; 200 | } 201 | 202 | return null; 203 | } 204 | 205 | 206 | 207 | public List createChildsFromDocument(Document document){ 208 | List tails = compareWords(words, document.content); 209 | if(tails != null){ 210 | return createChildsFromWorlds(tails); 211 | } 212 | return null; 213 | } 214 | 215 | public static boolean addDocument(Document document){ 216 | Node node = new Node(); 217 | node.words = document.content; 218 | node.save(); 219 | (new NodeHasDocument(node.id, document.id)).save(); 220 | if(node.removeFirstWord()){ 221 | node.id = 0; 222 | document.content = node.words; 223 | return addDocument(document); 224 | } 225 | return true; 226 | 227 | } 228 | 229 | 230 | } 231 | -------------------------------------------------------------------------------- /src/cfwsbaru/CFWS.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CFWS.java 3 | * 4 | * Created on May 31, 2010, 9:40 AM 5 | */ 6 | 7 | package cfwsbaru; 8 | 9 | import java.io.BufferedReader; 10 | import java.io.File; 11 | import java.io.FileInputStream; 12 | import java.io.FileReader; 13 | import java.io.InputStreamReader; 14 | 15 | /** 16 | * 17 | * @author CassiestGirl 18 | */ 19 | public class CFWS extends javax.swing.JFrame { 20 | 21 | /** Creates new form CFWS */ 22 | public CFWS() { 23 | initComponents(); 24 | 25 | } 26 | 27 | /** This method is called from within the constructor to 28 | * initialize the form. 29 | * WARNING: Do NOT modify this code. The content of this method is 30 | * always regenerated by the Form Editor. 31 | */ 32 | // //GEN-BEGIN:initComponents 33 | private void initComponents() { 34 | 35 | jFileChooser1 = new javax.swing.JFileChooser(); 36 | jOptionPane1 = new javax.swing.JOptionPane(); 37 | jScrollPane1 = new javax.swing.JScrollPane(); 38 | jTextArea1 = new javax.swing.JTextArea(); 39 | jTextField1 = new javax.swing.JTextField(); 40 | jButton1 = new javax.swing.JButton(); 41 | jButton2 = new javax.swing.JButton(); 42 | jButton3 = new javax.swing.JButton(); 43 | jButton4 = new javax.swing.JButton(); 44 | 45 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 46 | 47 | jTextArea1.setColumns(20); 48 | jTextArea1.setFont(new java.awt.Font("Arial", 1, 12)); 49 | jTextArea1.setRows(5); 50 | jScrollPane1.setViewportView(jTextArea1); 51 | 52 | jButton1.setText("Choose folder"); 53 | jButton1.addActionListener(new java.awt.event.ActionListener() { 54 | public void actionPerformed(java.awt.event.ActionEvent evt) { 55 | jButton1ActionPerformed(evt); 56 | } 57 | }); 58 | 59 | jButton2.setText("Preprocessing"); 60 | jButton2.addActionListener(new java.awt.event.ActionListener() { 61 | public void actionPerformed(java.awt.event.ActionEvent evt) { 62 | jButton2ActionPerformed(evt); 63 | } 64 | }); 65 | 66 | jButton3.setText("Frequent 2-word"); 67 | jButton3.addActionListener(new java.awt.event.ActionListener() { 68 | public void actionPerformed(java.awt.event.ActionEvent evt) { 69 | jButton3ActionPerformed(evt); 70 | } 71 | }); 72 | 73 | jButton4.setText("Clear "); 74 | jButton4.addActionListener(new java.awt.event.ActionListener() { 75 | public void actionPerformed(java.awt.event.ActionEvent evt) { 76 | jButton4ActionPerformed(evt); 77 | } 78 | }); 79 | 80 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 81 | getContentPane().setLayout(layout); 82 | layout.setHorizontalGroup( 83 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 84 | .addGroup(layout.createSequentialGroup() 85 | .addGap(32, 32, 32) 86 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) 87 | .addComponent(jButton4) 88 | .addGroup(layout.createSequentialGroup() 89 | .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE) 90 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 91 | .addComponent(jButton1)) 92 | .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 439, javax.swing.GroupLayout.PREFERRED_SIZE)) 93 | .addGap(27, 27, 27) 94 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 95 | .addComponent(jButton2) 96 | .addComponent(jButton3)) 97 | .addContainerGap(88, Short.MAX_VALUE)) 98 | ); 99 | layout.setVerticalGroup( 100 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 101 | .addGroup(layout.createSequentialGroup() 102 | .addGap(56, 56, 56) 103 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 104 | .addComponent(jButton1) 105 | .addComponent(jButton2) 106 | .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 107 | .addGap(21, 21, 21) 108 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 109 | .addGroup(layout.createSequentialGroup() 110 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 369, javax.swing.GroupLayout.PREFERRED_SIZE) 111 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 112 | .addComponent(jButton4)) 113 | .addComponent(jButton3)) 114 | .addContainerGap(34, Short.MAX_VALUE)) 115 | ); 116 | 117 | pack(); 118 | }// //GEN-END:initComponents 119 | 120 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed 121 | jFileChooser1.showOpenDialog(this); 122 | File fi = jFileChooser1.getCurrentDirectory(); 123 | String fa = fi.toString(); 124 | jTextField1.setText(fa); 125 | 126 | }//GEN-LAST:event_jButton1ActionPerformed 127 | 128 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed 129 | File fi = jFileChooser1.getCurrentDirectory(); 130 | String fa = fi.toString(); 131 | preprocessing pre = new preprocessing(fi); 132 | jOptionPane1.showMessageDialog(null, "Sucessfully preprocessing text"); 133 | 134 | 135 | 136 | }//GEN-LAST:event_jButton2ActionPerformed 137 | 138 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed 139 | // getWords gw = new getWords(); 140 | // f2w fw = new f2w(); 141 | File dir = new File ("src/cfwsbaru/frequent/"); 142 | File[] files = dir.listFiles(); 143 | for (File f : files) { 144 | try { 145 | FileInputStream fis = new FileInputStream(f); 146 | BufferedReader in = new BufferedReader(new InputStreamReader(fis)); 147 | String line = null; 148 | while ((line = in.readLine()) != null) { 149 | jTextArea1.append("\n"); 150 | jTextArea1.append(f.getName()+ " " + ":"); 151 | jTextArea1.append("\n"); 152 | jTextArea1.append(line); 153 | } 154 | } catch (Exception e) { } 155 | } 156 | 157 | }//GEN-LAST:event_jButton3ActionPerformed 158 | 159 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed 160 | jTextArea1.setText(""); 161 | }//GEN-LAST:event_jButton4ActionPerformed 162 | 163 | /** 164 | * @param args the command line arguments 165 | */ 166 | public static void main(String args[]) { 167 | java.awt.EventQueue.invokeLater(new Runnable() { 168 | public void run() { 169 | new CFWS().setVisible(true); 170 | } 171 | }); 172 | } 173 | 174 | // Variables declaration - do not modify//GEN-BEGIN:variables 175 | private javax.swing.JButton jButton1; 176 | private javax.swing.JButton jButton2; 177 | private javax.swing.JButton jButton3; 178 | private javax.swing.JButton jButton4; 179 | private javax.swing.JFileChooser jFileChooser1; 180 | private javax.swing.JOptionPane jOptionPane1; 181 | private javax.swing.JScrollPane jScrollPane1; 182 | private javax.swing.JTextArea jTextArea1; 183 | private javax.swing.JTextField jTextField1; 184 | // End of variables declaration//GEN-END:variables 185 | 186 | } 187 | -------------------------------------------------------------------------------- /nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | Must set src.dir 186 | Must set test.src.dir 187 | Must set build.dir 188 | Must set dist.dir 189 | Must set build.classes.dir 190 | Must set dist.javadoc.dir 191 | Must set build.test.classes.dir 192 | Must set build.test.results.dir 193 | Must set build.classes.excludes 194 | Must set dist.jar 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | Must set javac.includes 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | Must select some files in the IDE or set javac.includes 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | To run this application from the command line without Ant, try: 584 | 585 | 586 | 587 | 588 | 589 | 590 | java -cp "${run.classpath.with.dist.jar}" ${main.class} 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | To run this application from the command line without Ant, try: 603 | 604 | java -jar "${dist.jar.resolved}" 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | To run this application from the command line without Ant, try: 613 | 614 | java -jar "${dist.jar.resolved}" 615 | 616 | 617 | 618 | 619 | 620 | 621 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | Must select one file in the IDE or set run.class 638 | 639 | 640 | 641 | Must select one file in the IDE or set run.class 642 | 643 | 644 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | Must select one file in the IDE or set debug.class 669 | 670 | 671 | 672 | 673 | Must select one file in the IDE or set debug.class 674 | 675 | 676 | 677 | 678 | Must set fix.includes 679 | 680 | 681 | 682 | 683 | 684 | 685 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | Must select some files in the IDE or set javac.includes 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | Some tests failed; see details above. 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | Must select some files in the IDE or set test.includes 773 | 774 | 775 | 776 | Some tests failed; see details above. 777 | 778 | 779 | 784 | 785 | Must select one file in the IDE or set test.class 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 815 | 816 | Must select one file in the IDE or set applet.url 817 | 818 | 819 | 820 | 821 | 822 | 823 | 828 | 829 | Must select one file in the IDE or set applet.url 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | --------------------------------------------------------------------------------