/// <summary> /// Get the lexical chunk the specified current LSCP is within. /// </summary> private LexicalChunk GetChunk( TextLexicalService lexicalService, int lscpCurrent, int lscchLim, bool isCurrentAtWordStart, out int lscpChunk, out int lscchChunk ) { int lscpStart = lscpCurrent; int lscpLim = lscpStart + lscchLim; int cpFirst = _store.CpFirst; if (lscpStart > lscpLim) { // Start is always before limit lscpStart = lscpLim; lscpLim = lscpCurrent; } LexicalChunk chunk = new LexicalChunk(); int cchWordMax; CultureInfo textCulture; SpanVector <int> textVector; char[] rawText = _store.CollectRawWord( lscpStart, isCurrentAtWordStart, _isSideways, out lscpChunk, out lscchChunk, out textCulture, out cchWordMax, out textVector ); if (rawText != null && cchWordMax >= MinCchWordToHyphenate && lscpLim < lscpChunk + lscchChunk && textCulture != null && lexicalService != null && lexicalService.IsCultureSupported(textCulture) ) { // analyze the chunk and produce the lexical chunk to cache TextLexicalBreaks breaks = lexicalService.AnalyzeText( rawText, rawText.Length, textCulture ); if (breaks != null) { chunk = new LexicalChunk(breaks, textVector); } } return(chunk); }