Class PatternParser
A XMLReader document handler to read and parse hyphenation patterns from a XML file.
LUCENENET: This class has been refactored from its Java counterpart to use XmlReader rather than a SAX parser.
Inheritance
Inherited Members
Namespace: Lucene.Net.Analysis.Compound.Hyphenation
Assembly: Lucene.Net.Analysis.Common.dll
Syntax
public class PatternParser
Constructors
| Improve this Doc View SourcePatternParser()
Declaration
public PatternParser()
PatternParser(IPatternConsumer)
Declaration
public PatternParser(IPatternConsumer consumer)
Parameters
Type | Name | Description |
---|---|---|
IPatternConsumer | consumer |
Properties
| Improve this Doc View SourceConsumer
Declaration
public virtual IPatternConsumer Consumer { get; set; }
Property Value
Type | Description |
---|---|
IPatternConsumer |
Methods
| Improve this Doc View SourceCharacters(Char[], Int32, Int32)
Receive notification of character data.
The Parser will call this method to report each chunk of character data. Parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.
The application must not attempt to read from the array outside of the specified range.
Declaration
public virtual void Characters(char[] ch, int start, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | ch | |
System.Int32 | start | |
System.Int32 | length |
EndElement(String, String, String)
Receive notification of the end of an element.
The parser will invoke this method at the end of every element in the XML document; there will be a corresponding StartElement(String, String, String, IDictionary<String, String>) event for every EndElement(String, String, String) event (even when the element is empty).
Declaration
public virtual void EndElement(string uri, string local, string raw)
Parameters
Type | Name | Description |
---|---|---|
System.String | uri | the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed |
System.String | local | the local name (without prefix), or the empty string if Namespace processing is not being performed |
System.String | raw |
GetExceptionWord<T1>(IList<T1>)
Declaration
protected virtual string GetExceptionWord<T1>(IList<T1> ex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T1> | ex |
Returns
Type | Description |
---|---|
System.String |
Type Parameters
Name | Description |
---|---|
T1 |
GetInterletterValues(String)
Declaration
protected static string GetInterletterValues(string pat)
Parameters
Type | Name | Description |
---|---|---|
System.String | pat |
Returns
Type | Description |
---|---|
System.String |
GetPattern(String)
Declaration
protected static string GetPattern(string word)
Parameters
Type | Name | Description |
---|---|---|
System.String | word |
Returns
Type | Description |
---|---|
System.String |
NormalizeException<T1>(IList<T1>)
Declaration
protected virtual IList<object> NormalizeException<T1>(IList<T1> ex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T1> | ex |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<System.Object> |
Type Parameters
Name | Description |
---|---|
T1 |
Parse(FileInfo)
Parses a hyphenation pattern file.
Declaration
public virtual void Parse(FileInfo file)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | file | a System.IO.FileInfo object representing the file |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | In case of an exception while parsing |
Parse(FileInfo, Encoding)
Parses a hyphenation pattern file.
Declaration
public virtual void Parse(FileInfo file, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | file | a System.IO.FileInfo object representing the file |
System.Text.Encoding | encoding | The character encoding to use |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | In case of an exception while parsing |
Parse(Stream)
Parses a hyphenation pattern file.
Declaration
public virtual void Parse(Stream xmlStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | xmlStream | The stream containing the XML data. The PatternParser scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | In case of an exception while parsing |
Parse(String)
Parses a hyphenation pattern file.
Declaration
public virtual void Parse(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The complete file path to be read. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | In case of an exception while parsing |
Parse(String, Encoding)
Parses a hyphenation pattern file.
Declaration
public virtual void Parse(string path, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The complete file path to be read. |
System.Text.Encoding | encoding | The character encoding to use |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | In case of an exception while parsing |
Parse(XmlReader)
Parses a hyphenation pattern file.
Declaration
public virtual void Parse(XmlReader source)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | source | System.Xml.XmlReader input source for the file |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | In case of an exception while parsing |
ReadToken(StringBuilder)
Declaration
protected virtual string ReadToken(StringBuilder chars)
Parameters
Type | Name | Description |
---|---|---|
System.Text.StringBuilder | chars |
Returns
Type | Description |
---|---|
System.String |
StartElement(String, String, String, IDictionary<String, String>)
Receive notification of the beginning of an element.
The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding EndElement(String, String, String) event for every StartElement(String, String, String, IDictionary<String, String>) event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement event.
Declaration
public virtual void StartElement(string uri, string local, string raw, IDictionary<string, string> attrs)
Parameters
Type | Name | Description |
---|---|---|
System.String | uri | the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed |
System.String | local | the local name (without prefix), or the empty string if Namespace processing is not being performed |
System.String | raw | |
System.Collections.Generic.IDictionary<System.String, System.String> | attrs | the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined |