Ejemplo n.º 1
0
        public static List <TPosLen>[] wordBreak(string lang, IList <string> texts)
        {
            var breaker = Creators.createBreaker(lang);
            var res     = new List <TPosLen> [texts.Count];

            for (var i = 0; i < texts.Count; i++)
            {
                var pl   = res[i] = new List <TPosLen>();
                var word = texts[i];
                wordBreak(word, breaker, (type, pos, len) => {
                    if (type != PutTypes.put)
                    {
                        return;             // && type != PutTypes.alt) return;
                    }
                    pl.Add(new TPosLen {
                        Pos = pos, Len = len
                    });
                });
            }
            return(res);
        }
Ejemplo n.º 2
0
        public static IEnumerable <string> wordBreak(string lang, IEnumerable <string> sentences)
        {
            var breaker = Creators.createBreaker(lang);

            return(sentences.SelectMany(par => wordBreak(breaker, par)));
        }