示例#1
0
    private static int syllableIndices(string text)
    {
        int mask = 0;

        text = Syllable.Syllabify(text);

        int i = text.IndexOf('∙');

        while (i != -1)
        {
            mask |= (1 << (i));
            i     = text.IndexOf('∙', i + 1);
        }

        return(mask);
    }
示例#2
0
    public static ReturnModel Handle(string text, MSCGJson son)
    {
        string[][] sentences = son.result;

        string[] originalSentences = text.Split(' ');
        int      originIndex       = 0;
        int      wordIndex         = 0;

        Word[][]    postags = new Word[sentences.Length][];
        List <Word> list;

        for (int i = 0; i < sentences.Length; ++i)
        {
            list = new List <Word>();

            foreach (string j in sentences[i])
            {
                if (!isMSCGSymbol(j))
                {
                    list.Add(new Word(originalSentences[originIndex], POSType(j), syllableIndices(originalSentences[originIndex]), Syllable.Syllabify(originalSentences[originIndex++]), wordIndex++));
                }
            }


            postags[i] = list.ToArray();
        }

        return(new ReturnModel(postags, GenerateHTML(postags, true)));
    }