org.apache.lucene.analysis.compound.hyphenation.HyphenationTree.loadPatterns C# (CSharp) Method

loadPatterns() public method

Read hyphenation patterns from an XML file.
In case the parsing fails
public loadPatterns ( InputSource source ) : void
source InputSource the InputSource for the file
return void
	  public virtual void loadPatterns(InputSource source)
	  {
		PatternParser pp = new PatternParser(this);
		ivalues = new TernaryTree();

		pp.parse(source);

		// patterns/values should be now in the tree
		// let's optimize a bit
		trimToSize();
		vspace.trimToSize();
		classmap.trimToSize();

		// get rid of the auxiliary map
		ivalues = null;
	  }

Same methods

HyphenationTree::loadPatterns ( File f ) : void

Usage Example

 /// <summary>
 /// Create a hyphenator tree
 /// </summary>
 /// <param name="hyphenationSource"> the InputSource pointing to the XML grammar </param>
 /// <returns> An object representing the hyphenation patterns </returns>
 /// <exception cref="IOException"> If there is a low-level I/O error. </exception>
 public static HyphenationTree getHyphenationTree(InputSource hyphenationSource)
 {
     var tree = new HyphenationTree();
     tree.loadPatterns(hyphenationSource);
     return tree;
 }