All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cc.mallet.extract.Field Maven / Gradle / Ivy

Go to download

MALLET is a Java-based package for statistical natural language processing, document classification, clustering, topic modeling, information extraction, and other machine learning applications to text.

The newest version!
/* Copyright (C) 2003 Univ. of Massachusetts Amherst, Computer Science Dept.
   This file is part of "MALLET" (MAchine Learning for LanguagE Toolkit).
   http://www.cs.umass.edu/~mccallum/mallet
   This software is provided under the terms of the Common Public License,
   version 1.0, as published by http://www.opensource.org.  For further
   information, see the file `LICENSE' included with this distribution. */
package cc.mallet.extract;


import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
import java.util.ListIterator;

import cc.mallet.types.Label;

/**
 * Created: Oct 12, 2004
 *
 * @author filler is an exact match to one of the values
   *  of this field.
   */
  public boolean isValue (String filler)
  {
    return values.contains (filler);
  }

  public boolean isValue (String filler, FieldComparator comper)
  {
    for (Iterator it = values.iterator (); it.hasNext ();) {
      String s = (String) it.next ();
      if (comper.matches (filler, s))
        return true;
    }
    return false;
  }

  public String toString () {
    StringBuffer buf = new StringBuffer ();
    buf.append ("FIELD NAME: ");
    buf.append (name);
    buf.append ("\n");
    for (Iterator it = values.iterator (); it.hasNext ();) {
      String s = (String) it.next ();
      buf.append ("FILLER:");
      buf.append (s);
      buf.append ("\n");
    }
    return buf.toString ();
  }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy