コード例 #1
0
ファイル: HMMPool.cs プロジェクト: yyl-20020115/Sphinx4CSharp
        public virtual int getID(Unit unit)
        {
            if (!unit.isContextDependent())
            {
                return(this.getSimpleUnitID(unit));
            }
            LeftRightContext leftRightContext = (LeftRightContext)unit.getContext();

            if (!HMMPool.assertionsDisabled && leftRightContext.getLeftContext().Length != 1)
            {
                throw new AssertionError();
            }
            if (!HMMPool.assertionsDisabled && leftRightContext.getRightContext().Length != 1)
            {
                throw new AssertionError();
            }
            return(this.buildID(this.getSimpleUnitID(unit), this.getSimpleUnitID(leftRightContext.getLeftContext()[0]), this.getSimpleUnitID(leftRightContext.getRightContext()[0])));
        }
コード例 #2
0
 public override bool isPartialMatch(Context context)
 {
     if (context is LeftRightContext)
     {
         LeftRightContext leftRightContext = (LeftRightContext)context;
         Unit[]           array            = leftRightContext.getLeftContext();
         Unit[]           array2           = leftRightContext.getRightContext();
         return((array == null || this.leftContext == null || Unit.isContextMatch(array, this.leftContext)) && (array2 == null || this.rightContext == null || Unit.isContextMatch(array2, this.rightContext)));
     }
     return(context == Context.__EMPTY_CONTEXT && this.leftContext == null && this.rightContext == null);
 }