Changeset 2548
- Timestamp:
- 10/28/08 11:29:53 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.text.normalization/src/edu/iu/nwb/preprocessing/text/normalization/StandardNormalyzer.java
r2546 r2548 44 44 this.parameters = parameters; 45 45 this.context = context; 46 try { 47 String[] stopWords = getStopWords(); 46 47 String[] stopWords = null; 48 stopWords = getStopWords(); 49 if (stopWords != null) { 48 50 this.analyzer = new SnowballAnalyzer("English", stopWords); 49 }catch (IOException ioe) { 50 System.out.println (">>>got IOException, do not apply stopwords.txt. "+ioe.toString()); 51 } 52 else { 53 System.out.println(">>>no stopwords. "); 51 54 this.analyzer = new SnowballAnalyzer("English"); 52 } 55 } 56 53 57 } 54 58 … … 72 76 } 73 77 74 private String[] getStopWords() throws IOException{78 private String[] getStopWords() { 75 79 String filePath = "/edu/iu/nwb/preprocessing/text/normalization/stopwords.txt"; 76 80 InputStream is = null; … … 78 82 String line; 79 83 ArrayList list = new ArrayList(); 84 String[]stopWords = null; 80 85 81 86 try { … … 86 91 list.add(line); 87 92 } 93 stopWords = new String[list.size()]; 94 for (int ii=0; ii<list.size(); ii++){ 95 stopWords[ii] = (String) list.get(ii); 96 System.out.println("index = "+ii+", value = "+stopWords[ii]); 97 } 88 98 } 89 99 catch (Exception e) { … … 99 109 } 100 110 } 111 return stopWords; 101 112 102 String[]stopWords = new String[list.size()];103 for (int ii=0; ii<list.size(); ii++){104 stopWords[ii] = (String) list.get(ii);105 System.out.println("index = "+ii+", value = "+stopWords[ii]);106 }107 return stopWords;108 113 } 109 114
