Ejemplo n.º 1
0
 /// <summary>
 /// Create an event reader based on the specified data reader of the specified type using the specified head rules.
 /// </summary>
 /// <param name="dataReader">
 /// A 1-parse-per-line Penn Treebank Style parse.
 /// </param>
 /// <param name="rules">
 /// The head rules.
 /// </param>
 /// <param name="eventType">
 /// The type of events desired (tag, chunk, build, or check).
 /// </param>
 public ParserEventReader(SharpEntropy.ITrainingDataReader <string> dataReader, IHeadRules rules, EventType eventType)
 {
     if (eventType == EventType.Build)
     {
         mBuildContextGenerator = new BuildContextGenerator();
     }
     else if (eventType == EventType.Check)
     {
         mCheckContextGenerator = new CheckContextGenerator();
     }
     else if (eventType == EventType.Chunk)
     {
         mChunkContextGenerator = new ChunkContextGenerator();
     }
     else if (eventType == EventType.Tag)
     {
         mPosContextGenerator = new PosTagger.DefaultPosContextGenerator();
     }
     mHeadRules  = rules;
     mEventType  = eventType;
     mDataReader = dataReader;
     mEventIndex = 0;
     if (dataReader.HasNext())
     {
         AddNewEvents();
     }
     else
     {
         mEvents = new SharpEntropy.TrainingEvent[0];
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create an event reader based on the specified data reader of the specified type using the specified head rules.
 /// </summary>
 /// <param name="dataReader">
 /// A 1-parse-per-line Penn Treebank Style parse. 
 /// </param>
 /// <param name="rules">
 /// The head rules.
 /// </param>
 /// <param name="eventType">
 /// The type of events desired (tag, chunk, build, or check).
 /// </param>
 public ParserEventReader(SharpEntropy.ITrainingDataReader<string> dataReader, IHeadRules rules, EventType eventType)
 {
     if (eventType == EventType.Build)
     {
         mBuildContextGenerator = new BuildContextGenerator();
     }
     else if (eventType == EventType.Check)
     {
         mCheckContextGenerator = new CheckContextGenerator();
     }
     else if (eventType == EventType.Chunk)
     {
         mChunkContextGenerator = new ChunkContextGenerator();
     }
     else if (eventType == EventType.Tag)
     {
         mPosContextGenerator = new PosTagger.DefaultPosContextGenerator();
     }
     mHeadRules = rules;
     mEventType = eventType;
     mDataReader = dataReader;
     mEventIndex = 0;
     if (dataReader.HasNext())
     {
         AddNewEvents();
     }
     else
     {
         mEvents = new SharpEntropy.TrainingEvent[0];
     }
 }