Exemple #1
0
        /// <summary>
        /// Read parse trees from a Reader.
        /// </summary>
        /// <param name="input">The Reader</param>
        /// <param name="tf">TreeFactory -- factory to create some kind of Tree</param>
        /// <param name="tn">the method of normalizing trees</param>
        /// <param name="st">Tokenizer that divides up Reader</param>
        public PennTreeReader(TextReader input, ITreeFactory tf, TreeNormalizer tn, ITokenizer<string> st)
        {
            reader = input;
            treeFactory = tf;
            treeNormalizer = tn;
            tokenizer = st;

            // check for whacked out headers still present in Brown corpus in Treebank 3
            string first = (st.HasNext() ? st.Peek() : null);
            if (first != null && first.StartsWith("*x*x*x"))
            {
                int foundCount = 0;
                while (foundCount < 4 && st.HasNext())
                {
                    first = st.Next();
                    if (first != null && first.StartsWith("*x*x*x"))
                    {
                        foundCount++;
                    }
                }
            }
        }
        /// <summary>
        /// Read parse trees from a Reader.
        /// </summary>
        /// <param name="input">The Reader</param>
        /// <param name="tf">TreeFactory -- factory to create some kind of Tree</param>
        /// <param name="tn">the method of normalizing trees</param>
        /// <param name="st">Tokenizer that divides up Reader</param>
        public PennTreeReader(TextReader input, ITreeFactory tf, TreeNormalizer tn, ITokenizer <string> st)
        {
            reader         = input;
            treeFactory    = tf;
            treeNormalizer = tn;
            tokenizer      = st;

            // check for whacked out headers still present in Brown corpus in Treebank 3
            string first = (st.HasNext() ? st.Peek() : null);

            if (first != null && first.StartsWith("*x*x*x"))
            {
                int foundCount = 0;
                while (foundCount < 4 && st.HasNext())
                {
                    first = st.Next();
                    if (first != null && first.StartsWith("*x*x*x"))
                    {
                        foundCount++;
                    }
                }
            }
        }
Exemple #3
0
 /// <summary>
 /// Read parse trees from a Reader.
 /// </summary>
 /// <param name="input">The Reader</param>
 /// <param name="tf">TreeFactory -- factory to create some kind of Tree</param>
 /// <param name="tn">the method of normalizing trees</param>
 public PennTreeReader(TextReader input, ITreeFactory tf, TreeNormalizer tn) :
     this(input, tf, tn, new PennTreebankTokenizer(input))
 {
 }
 public LabeledScoredTreeReaderFactory(ILabelFactory lf, TreeNormalizer tm)
 {
     this.lf = lf;
     this.tm = tm;
 }
 public LabeledScoredTreeReaderFactory(TreeNormalizer tm)
 {
     lf      = CoreLabel.Factory();
     this.tm = tm;
 }
 public LabeledScoredTreeReaderFactory(ILabelFactory lf)
 {
     this.lf = lf;
     tm      = new BobChrisTreeNormalizer();
 }
 /// <summary>
 /// Create a new TreeReaderFactory with CoreLabel labels.
 /// </summary>
 public LabeledScoredTreeReaderFactory()
 {
     lf = CoreLabel.Factory();
     tm = new BobChrisTreeNormalizer();
 }
 /// <summary>
 /// Specify your own {@link TreeFactory};
 /// uses a {@link PennTreebankTokenizer}, and a {@link TreeNormalizer}.
 /// </summary>
 /// <param name="tf">The TreeFactory to use in building Tree objects to return</param>
 /// <param name="tn">The TreeNormalizer to use</param>
 public PennTreeReaderFactory(ITreeFactory tf, TreeNormalizer tn)
 {
     this.tf = tf;
     this.tn = tn;
 }
 /// <summary>
 /// Specify your own {@link TreeNormalizer};
 /// uses a {@link PennTreebankTokenizer}, and a {@link LabeledScoredTreeFactory}.
 /// </summary>
 /// <param name="tn">The TreeNormalizer to use in building Tree objects to return</param>
 public PennTreeReaderFactory(TreeNormalizer tn) :
     this(new LabeledScoredTreeFactory(), tn)
 {
 }
 /// <summary>
 /// Specify your own {@link TreeFactory};
 /// uses a {@link PennTreebankTokenizer}, and a {@link TreeNormalizer}.
 /// </summary>
 /// <param name="tf">The TreeFactory to use in building Tree objects to return</param>
 /// <param name="tn">The TreeNormalizer to use</param>
 public PennTreeReaderFactory(ITreeFactory tf, TreeNormalizer tn)
 {
     this.tf = tf;
     this.tn = tn;
 }
 /// <summary>
 /// Read parse trees from a Reader.
 /// </summary>
 /// <param name="input">The Reader</param>
 /// <param name="tf">TreeFactory -- factory to create some kind of Tree</param>
 /// <param name="tn">the method of normalizing trees</param>
 public PennTreeReader(TextReader input, ITreeFactory tf, TreeNormalizer tn) :
     this(input, tf, tn, new PennTreebankTokenizer(input))
 {
 }
 /// <summary>
 /// Specify your own {@link TreeNormalizer};
 /// uses a {@link PennTreebankTokenizer}, and a {@link LabeledScoredTreeFactory}.
 /// </summary>
 /// <param name="tn">The TreeNormalizer to use in building Tree objects to return</param>
 public PennTreeReaderFactory(TreeNormalizer tn) :
     this(new LabeledScoredTreeFactory(), tn)
 {
 }
 public LabeledScoredTreeReaderFactory(ILabelFactory lf, TreeNormalizer tm)
 {
     this.lf = lf;
     this.tm = tm;
 }
 public LabeledScoredTreeReaderFactory(TreeNormalizer tm)
 {
     lf = CoreLabel.Factory();
     this.tm = tm;
 }
 public LabeledScoredTreeReaderFactory(ILabelFactory lf)
 {
     this.lf = lf;
     tm = new BobChrisTreeNormalizer();
 }
 /// <summary>
 /// Create a new TreeReaderFactory with CoreLabel labels.
 /// </summary>
 public LabeledScoredTreeReaderFactory()
 {
     lf = CoreLabel.Factory();
     tm = new BobChrisTreeNormalizer();
 }