stoplist.java
来自「Create stop list hashmap using stoplist 」· Java 代码 · 共 36 行
JAVA
36 行
/* **** StopList.java ***********************************************
Implement stoplist as HashTable
**********************************************************************/
package drsystem;
import java.util.*;
import java.io.*;
class StopList extends Hashtable<String,String>
{
public StopList(String file) throws IOException
{
super(); //call to parent class constructor
try
{
BufferedReader Istream=new BufferedReader(new FileReader(file)); //create input stream
String word;
while((word=Istream.readLine())!=null) //read stopword in each line
put(word,word); // and put in into HashTable
Istream.close(); //close stream
} //end of try block
catch(NullPointerException e)
{
System.out.println("StopList.java: " + e.getMessage());
}
catch(FileNotFoundException e)
{
System.out.println("StopList.java: " + e.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?