public override ObjectStream <ChunkSample> create(string[] args)
        {
            Parameters @params = ArgumentParser.parse(args, typeof(Parameters));

            language = @params.Lang;

            FileInputStream sampleDataIn = CmdLineUtil.openInFile(@params.Data);

            ObjectStream <string> lineStream = new PlainTextByLineStream(sampleDataIn.Channel, @params.Encoding);

            ADChunkSampleStream sampleStream = new ADChunkSampleStream(lineStream);

            if (@params.Start != null && @params.Start > -1)
            {
                sampleStream.Start = @params.Start.Value;
            }

            if (@params.End != null && @params.End > -1)
            {
                sampleStream.End = @params.End.Value;
            }

            return(sampleStream);
        }
示例#2
0
        protected internal virtual void processLeaf(Leaf leaf, bool isIntermediate, string phraseTag, IList <string> sentence, IList <string> tags, IList <string> target)
        {
            string chunkTag;

            if (leaf.FunctionalTag != null && phraseTag.Equals(OTHER))
            {
                phraseTag = getPhraseTagFromPosTag(leaf.FunctionalTag);
            }

            if (!phraseTag.Equals(OTHER))
            {
                if (isIntermediate)
                {
                    chunkTag = "I-" + phraseTag;
                }
                else
                {
                    chunkTag = "B-" + phraseTag;
                }
            }
            else
            {
                chunkTag = phraseTag;
            }

            sentence.Add(leaf.Lexeme);
            if (leaf.SyntacticTag == null)
            {
                tags.Add(leaf.Lexeme);
            }
            else
            {
                tags.Add(ADChunkSampleStream.convertFuncTag(leaf.FunctionalTag, false));
            }
            target.Add(chunkTag);
        }