Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.jsword.book.search
Class Grammar

    java.lang.Object
      org.crosswire.jsword.book.search.Grammar

    public class Grammar

extends Object

A class representing various grammatical constructs (in English).

Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors.

Version:
  $Id: Grammar.java,v 1.1 2004/09/29 22:21:23 joe Exp $
Author:
  Joe Walker [joe at eireneh dot com]
See Also:
  `Licence`

Field Summary
`private static String[]` | `ENDINGS` The Endings a word can have.
`private static String[]` | `WORD_FREQ` The one hundred most used words, and the instance count

Constructor Summary
`private` | `Grammar()` Prevent Instansiation

Method Summary
`static String` | `getRoot(String word)` Strip of any parts of speech to leave a root word.
`static boolean` | `isSmallWord(String word)` Is this word one of those small words that can slaughter a DB query.
`static String[]` | `stripSmallWords(String[] words)` Is this word one of those small words that can slaughter a DB query
`static String[]` | `tokenizeWithoutSmallWords(String original, String delims)` Like PassageUtil.tokenize that leaves out the small words

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ENDINGS

    private static final String[] ENDINGS

  The Endings a word can have. These are matched in order so there is no point in having "s" before "es" because the second will not be tried.

### WORD_FREQ

    private static final String[] WORD_FREQ

  The one hundred most used words, and the instance count

Constructor Detail

### Grammar

    private Grammar()

  Prevent Instansiation

Method Detail

### getRoot

    public static String getRoot(String word)

  Strip of any parts of speech to leave a root word. This class may not be the best place for this code, however I'm not sure if we have a better place for it at the mo. Maybe it should be in passage.PassageUtil?

  Parameters:
    `word` - The word to strip
  Returns:
    The root word

### isSmallWord

    public static boolean isSmallWord(String word)

  Is this word one of those small words that can slaughter a DB query. An empty string IS a small word.

  Parameters:
    `word` - The word to test

### stripSmallWords

    public static String[] stripSmallWords(String[] words)

  Is this word one of those small words that can slaughter a DB query

### tokenizeWithoutSmallWords

    public static String[] tokenizeWithoutSmallWords(String original,
                                                     String delims)

  Like PassageUtil.tokenize that leaves out the small words

  Parameters:
    `original` - The sentance to split up
    `delims` - The word separators
  Returns:
    The long words in the string

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ? 2003-2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD