source: branches/MetisMQI/src/main/java/weka/core/stemmers/NullStemmer.java

Last change on this file was 29, checked in by gnappo, 15 years ago

Taggata versione per la demo e aggiunto branch.

File size: 2.3 KB
Line 
1/*
2 *    This program is free software; you can redistribute it and/or modify
3 *    it under the terms of the GNU General Public License as published by
4 *    the Free Software Foundation; either version 2 of the License, or
5 *    (at your option) any later version.
6 *
7 *    This program is distributed in the hope that it will be useful,
8 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 *    GNU General Public License for more details.
11 *
12 *    You should have received a copy of the GNU General Public License
13 *    along with this program; if not, write to the Free Software
14 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17/*
18 * NullStemmer.java
19 * Copyright (C) 2005 University of Waikato, Hamilton, New Zealand
20 *
21 */
22
23package weka.core.stemmers;
24
25import weka.core.RevisionUtils;
26
27/**
28 <!-- globalinfo-start -->
29 * A dummy stemmer that performs no stemming at all.
30 * <p/>
31 <!-- globalinfo-end -->
32 *
33 * @author    FracPete (fracpete at waikato dot ac dot nz)
34 * @version   $Revision: 5953 $
35 */
36public class NullStemmer 
37  implements Stemmer {
38
39  /** for serialization */
40  static final long serialVersionUID = -3671261636532625496L;
41 
42  /**
43   * Returns a string describing the stemmer
44   * @return a description suitable for
45   *         displaying in the explorer/experimenter gui
46   */
47  public String globalInfo() {
48    return 
49        "A dummy stemmer that performs no stemming at all.";
50  }
51 
52  /**
53   * Returns the word as it is.
54   *
55   * @param word      the unstemmed word
56   * @return          the unstemmed word, again
57   */
58  public String stem(String word) {
59    return new String(word);
60  }
61
62  /**
63   * returns a string representation of the stemmer
64   *
65   * @return a string representation of the stemmer
66   */
67  public String toString() {
68    return getClass().getName();
69  }
70 
71  /**
72   * Returns the revision string.
73   *
74   * @return            the revision
75   */
76  public String getRevision() {
77    return RevisionUtils.extract("$Revision: 5953 $");
78  }
79
80  /**
81   * Runs the stemmer with the given options
82   *
83   * @param args      the options
84   */
85  public static void main(String[] args) {
86    try {
87      Stemming.useStemmer(new NullStemmer(), args);
88    }
89    catch (Exception e) {
90      e.printStackTrace();
91    }
92  }
93}
Note: See TracBrowser for help on using the repository browser.