Package org.apache.lucene.analysis.email

# Class UAX29URLEmailTokenizer

java.lang.Object
org.apache.lucene.util.AttributeSource
org.apache.lucene.analysis.TokenStream
org.apache.lucene.analysis.Tokenizer
org.apache.lucene.analysis.email.UAX29URLEmailTokenizer

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public final class UAX29URLEmailTokenizer extends Tokenizer
This class implements Word Break rules from the Unicode Text Segmentation algorithm, as specified in Unicode Standard Annex #29 URLs and email addresses are also tokenized according to the relevant RFCs.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource

`AttributeSource.State`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ALPHANUM`
Alpha/numeric token type
`static final int`
`EMAIL`
Email token type
`static final int`
`EMOJI`
Emoji token type.
`static final int`
`HANGUL`
Hangul token type
`static final int`
`HIRAGANA`
Hiragana token type
`static final int`
`IDEOGRAPHIC`
Ideographic token type
`static final int`
`KATAKANA`
Katakana token type
`static final int`
`MAX_TOKEN_LENGTH_LIMIT`
Absolute maximum sized token
`static final int`
`NUM`
Numeric token type
`static final int`
`SOUTHEAST_ASIAN`
Southeast Asian token type
`static final String[]`
`TOKEN_TYPES`
String token types that correspond to token type int constants
`static final int`
`URL`
URL token type

### Fields inherited from class org.apache.lucene.analysis.Tokenizer

`input`

### Fields inherited from class org.apache.lucene.analysis.TokenStream

`DEFAULT_TOKEN_ATTRIBUTE_FACTORY`

## Constructor Summary

Constructors
Constructor
Description
`UAX29URLEmailTokenizer()`
Creates a new instance of the UAX29URLEmailTokenizer.
`UAX29URLEmailTokenizer(AttributeFactory factory)`
Creates a new UAX29URLEmailTokenizer with a given `AttributeFactory`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`final void`
`end()`
`int`
`getMaxTokenLength()`
`final boolean`
`incrementToken()`
`void`
`reset()`
`void`
`setMaxTokenLength(int length)`
Set the max allowed token length.

### Methods inherited from class org.apache.lucene.analysis.Tokenizer

`correctOffset, setReader, setReaderTestPoint`

### Methods inherited from class org.apache.lucene.util.AttributeSource

`addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### ALPHANUM

public static final int ALPHANUM
Alpha/numeric token type

See Also:
  - Constant Field Values

### NUM

public static final int NUM
Numeric token type

See Also:
  - Constant Field Values

### SOUTHEAST_ASIAN

public static final int SOUTHEAST_ASIAN
Southeast Asian token type

See Also:
  - Constant Field Values

### IDEOGRAPHIC

public static final int IDEOGRAPHIC
Ideographic token type

See Also:
  - Constant Field Values

### HIRAGANA

public static final int HIRAGANA
Hiragana token type

See Also:
  - Constant Field Values

### KATAKANA

public static final int KATAKANA
Katakana token type

See Also:
  - Constant Field Values

### HANGUL

public static final int HANGUL
Hangul token type

See Also:
  - Constant Field Values

### URL

public static final int URL
URL token type

See Also:
  - Constant Field Values

### EMAIL

public static final int EMAIL
Email token type

See Also:
  - Constant Field Values

### EMOJI

public static final int EMOJI
Emoji token type.

See Also:
  - Constant Field Values

### TOKEN_TYPES

public static final String[] TOKEN_TYPES
String token types that correspond to token type int constants

### MAX_TOKEN_LENGTH_LIMIT

public static final int MAX_TOKEN_LENGTH_LIMIT
Absolute maximum sized token

See Also:
  - Constant Field Values

## Constructor Details

### UAX29URLEmailTokenizer

public UAX29URLEmailTokenizer()
Creates a new instance of the UAX29URLEmailTokenizer. Attaches the `input` to the newly created JFlex scanner.

### UAX29URLEmailTokenizer

public UAX29URLEmailTokenizer(AttributeFactory factory)
Creates a new UAX29URLEmailTokenizer with a given `AttributeFactory`

## Method Details

### setMaxTokenLength

public void setMaxTokenLength(int length)
Set the max allowed token length. Tokens larger than this will be chopped up at this token length and emitted as multiple tokens. If you need to skip such large tokens, you could increase this max length, and then use `LengthFilter` to remove long tokens. The default is `UAX29URLEmailAnalyzer.DEFAULT_MAX_TOKEN_LENGTH`.

Throws:
  `IllegalArgumentException` - if the given length is outside of the range [1, 1048576].

### getMaxTokenLength

public int getMaxTokenLength()

See Also:
  - `setMaxTokenLength(int)`

### incrementToken

public final boolean incrementToken() throws IOException

Specified by:
  `incrementToken` in class `TokenStream`
Throws:
  `IOException`

### end

public final void end() throws IOException

Overrides:
  `end` in class `TokenStream`
Throws:
  `IOException`

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `Tokenizer`
Throws:
  `IOException`

### reset

public void reset() throws IOException

Overrides:
  `reset` in class `Tokenizer`
Throws:
  `IOException`