Пример #1
0
 public AbstractDependencyGrammar(ITreebankLanguagePack tlp, ITagProjection tagProjection, bool directional, bool useDistance, bool useCoarseDistance, Options op, IIndex <string> wordIndex, IIndex <string> tagIndex)
 {
     this.tlp               = tlp;
     this.tagProjection     = tagProjection;
     this.directional       = directional;
     this.useDistance       = useDistance;
     this.useCoarseDistance = useCoarseDistance;
     this.op        = op;
     this.wordIndex = wordIndex;
     this.tagIndex  = tagIndex;
     stopTW         = new IntTaggedWord(IntTaggedWord.StopWordInt, IntTaggedWord.StopTagInt);
     wildTW         = new IntTaggedWord(IntTaggedWord.AnyWordInt, IntTaggedWord.AnyTagInt);
     InitTagBins();
 }
 public MLEDependencyGrammar(ITagProjection tagProjection, ITreebankLangParserParams tlpParams, bool directional, bool useDistance, bool useCoarseDistance, Options op, IIndex <string> wordIndex, IIndex <string> tagIndex)
     : base(tlpParams.TreebankLanguagePack(), tagProjection, directional, useDistance, useCoarseDistance, op, wordIndex, tagIndex)
 {
     // reduced tag space
     //  public double distanceDecay = 0.0;
     // extra smoothing hyperparameters for tag projection backoff.  Only used if useSmoothTagProjection is true.
     // back off Bayesian m-estimate of aTW given aT to aPTW given aPT
     // back off Bayesian m-estimate of aTW_hTd to aPTW_hPTd (?? guessed, not tuned)
     // back off Bayesian m-estimate of aT_hTd to aPT_hPTd (?? guessed, not tuned)
     // back off word prediction from tag to projected tag (only used if useUnigramWordSmoothing is true)
     useSmoothTagProjection  = op.useSmoothTagProjection;
     useUnigramWordSmoothing = op.useUnigramWordSmoothing;
     argCounter  = new ClassicCounter <IntDependency>();
     stopCounter = new ClassicCounter <IntDependency>();
     double[] smoothParams = tlpParams.MLEDependencyGrammarSmoothingParams();
     smooth_aT_hTWd  = smoothParams[0];
     smooth_aTW_hTWd = smoothParams[1];
     smooth_stop     = smoothParams[2];
     interp          = smoothParams[3];
     // cdm added Jan 2007 to play with dep grammar smoothing.  Integrate this better if we keep it!
     smoothTP = new BasicCategoryTagProjection(tlpParams.TreebankLanguagePack());
 }