Class SimpleDictionary

java.lang.Object
smile.nlp.dictionary.SimpleDictionary
All Implemented Interfaces:
Dictionary

public class SimpleDictionary extends Object implements Dictionary
A simple implementation of dictionary interface.
  • Constructor Details

    • SimpleDictionary

      public SimpleDictionary(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 Details

    • contains

      public boolean contains(String word)
      Description copied from interface: Dictionary
      Returns true if this dictionary contains the specified word.
      Specified by:
      contains in interface Dictionary
      Parameters:
      word - the query word.
      Returns:
      true if this dictionary contains the specified word.
    • size

      public int size()
      Description copied from interface: Dictionary
      Returns the number of words in this dictionary.
      Specified by:
      size in interface Dictionary
      Returns:
      the number of words in this dictionary.
    • iterator

      public Iterator<String> iterator()
      Description copied from interface: Dictionary
      Returns an iterator over the words in this dictionary.
      Specified by:
      iterator in interface Dictionary
      Returns:
      the iterator.