smile.nlp.dictionary
Class SimpleDictionary
- java.lang.Object
-
- smile.nlp.dictionary.SimpleDictionary
-
- All Implemented Interfaces:
- Dictionary
public class SimpleDictionary extends java.lang.Object implements Dictionary
A simple implementation of dictionary interface.
-
-
Constructor Summary
Constructors Constructor and Description SimpleDictionary(java.lang.String resource)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancontains(java.lang.String word)Returns true if this dictionary contains the specified word.java.util.Iterator<java.lang.String>iterator()Returns an iterator over the elements in this dictionary.intsize()Returns the number of elements in this dictionary.
-
-
-
Constructor Detail
-
SimpleDictionary
public SimpleDictionary(java.lang.String resource)
Constructor.- Parameters:
resource- the file name of dictionary. The file should be in plain text, in which each line is a word.
-
-
Method Detail
-
contains
public boolean contains(java.lang.String word)
Description copied from interface:DictionaryReturns true if this dictionary contains the specified word.- Specified by:
containsin interfaceDictionary
-
size
public int size()
Description copied from interface:DictionaryReturns the number of elements in this dictionary.- Specified by:
sizein interfaceDictionary
-
iterator
public java.util.Iterator<java.lang.String> iterator()
Description copied from interface:DictionaryReturns an iterator over the elements in this dictionary.- Specified by:
iteratorin interfaceDictionary
-
-
DataMelt 3.0 © DataMelt by jWork.ORG