Ejemplo n.º 1
0
        public List <Sentence> Sentences(string text)
        {
            lock (lockObj)
            {
                requireValidHandle();
                List <Sentence> result = new List <Sentence>();
                if (!isValidInput(text))
                {
                    result.Add(new Sentence(text, SentenceStartType.NONE));
                    return(result);
                }
                byte[] textBytes = ByteArray.s2n(text);
                int    textLen   = textBytes.Length - 1;

                IntPtr sentenceLenByRef = new IntPtr();
                while (textLen > 0)
                {
                    int sentenceTypeInt            = Libvoikko.voikkoNextSentenceStartCstr(handle, textBytes, new IntPtr(textLen), ref sentenceLenByRef);
                    int sentenceLen                = sentenceLenByRef.ToInt32();
                    SentenceStartType sentenceType = (SentenceStartType)Enum.ToObject(typeof(SentenceStartType), sentenceTypeInt);
                    string            tokenText    = text.Substring(0, sentenceLen);
                    result.Add(new Sentence(tokenText, sentenceType));
                    text      = text.Substring(sentenceLen);
                    textBytes = ByteArray.s2n(text);
                    textLen   = textBytes.Length - 1;
                }

                return(result);
            }
        }
Ejemplo n.º 2
0
 public Sentence(string text, SentenceStartType nextStartType)
 {
     this.text          = text;
     this.nextStartType = nextStartType;
 }
Ejemplo n.º 3
0
		public Sentence(string text, SentenceStartType nextStartType)
		{
			this.text = text;
			this.nextStartType = nextStartType;
		}