/// <summary> /// Hyphenates the specified word. /// </summary> /// <param name="word"> /// The word. /// </param> /// <returns> /// the result of the hyphenation /// </returns> public HyphenResult Hyphenate(string word) { if (this.IsDisposed) { throw new ObjectDisposedException("SpellFactory"); } if (this.hunspells == null) { throw new InvalidOperationException("Hyphen Dictionary isn't loaded"); } this.hyphenSemaphore.WaitOne(); Hyphen current = null; try { current = this.hyphens.Pop(); return(current.Hyphenate(word)); } finally { if (current != null) { this.hyphens.Push(current); } this.hyphenSemaphore.Release(); } }
/// <summary> /// Hyphenates the specified word. /// </summary> /// <param name="word"> /// The word. /// </param> /// <returns> /// the result of the hyphenation /// </returns> public HyphenResult Hyphenate(string word) { Hyphen hyphen = this.HyphenPop(); try { return(hyphen.Hyphenate(word)); } finally { this.HyphenPush(hyphen); } }
internal static IEnumerable<string> Trenne_in_Silben(string wort) { using (var hyphen = new Hyphen("hyph_de_DE.dic")) { var result = hyphen.Hyphenate(wort); return result?.HyphenatedWord.Split('=') ?? new[] { "" }; } }