Ejemplo n.º 1
0
	  public override bool accept(AttributeSource source)
	  {
		if (typeAtt == null)
		{
		  typeAtt = source.addAttribute(typeof(TypeAttribute));
		}

		//check to see if this is a Category
		return (typeToMatch.Equals(typeAtt.type()));
	  }
Ejemplo n.º 2
0
	  public override bool accept(AttributeSource source)
	  {
		try
		{
		  if (count >= lower && count < upper)
		  {
			return true;
		  }
		  return false;
		}
		finally
		{
		  count++;
		}
	  }
Ejemplo n.º 3
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: @Override public boolean incrementToken() throws java.io.IOException
        public override bool incrementToken()
        {
            if (hasMoreTokensInClone)
            {
              int start = breaker.current();
              int end = breaker.next();
              if (end != BreakIterator.DONE)
              {
            clonedToken.copyTo(this);
            termAtt.copyBuffer(clonedTermAtt.buffer(), start, end - start);
            if (hasIllegalOffsets)
            {
              offsetAtt.setOffset(clonedOffsetAtt.startOffset(), clonedOffsetAtt.endOffset());
            }
            else
            {
              offsetAtt.setOffset(clonedOffsetAtt.startOffset() + start, clonedOffsetAtt.startOffset() + end);
            }
            if (handlePosIncr)
            {
                posAtt.PositionIncrement = 1;
            }
            return true;
              }
              hasMoreTokensInClone = false;
            }

            if (!input.incrementToken())
            {
              return false;
            }

            if (termAtt.length() == 0 || char.UnicodeBlock.of(termAtt.charAt(0)) != char.UnicodeBlock.THAI)
            {
              return true;
            }

            hasMoreTokensInClone = true;

            // if length by start + end offsets doesn't match the term text then assume
            // this is a synonym and don't adjust the offsets.
            hasIllegalOffsets = offsetAtt.endOffset() - offsetAtt.startOffset() != termAtt.length();

            // we lazy init the cloned token, as in ctor not all attributes may be added
            if (clonedToken == null)
            {
              clonedToken = cloneAttributes();
              clonedTermAtt = clonedToken.getAttribute(typeof(CharTermAttribute));
              clonedOffsetAtt = clonedToken.getAttribute(typeof(OffsetAttribute));
            }
            else
            {
              this.copyTo(clonedToken);
            }

            // reinit CharacterIterator
            charIterator.setText(clonedTermAtt.buffer(), 0, clonedTermAtt.length());
            breaker.Text = charIterator;
            int end = breaker.next();
            if (end != BreakIterator.DONE)
            {
              termAtt.Length = end;
              if (hasIllegalOffsets)
              {
            offsetAtt.setOffset(clonedOffsetAtt.startOffset(), clonedOffsetAtt.endOffset());
              }
              else
              {
            offsetAtt.setOffset(clonedOffsetAtt.startOffset(), clonedOffsetAtt.startOffset() + end);
              }
              // position increment keeps as it is for first token
              return true;
            }
            return false;
        }
Ejemplo n.º 4
0
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: @Override public void reset() throws java.io.IOException
 public override void reset()
 {
     base.reset();
     hasMoreTokensInClone = false;
     clonedToken = null;
     clonedTermAtt = null;
     clonedOffsetAtt = null;
 }
Ejemplo n.º 5
0
 public override bool accept(AttributeSource a)
 {
     CharTermAttribute termAtt = a.getAttribute(typeof(CharTermAttribute));
     return termAtt.ToString().Equals("Dogs", StringComparison.CurrentCultureIgnoreCase);
 }
Ejemplo n.º 6
0
 public override bool accept(AttributeSource a)
 {
     bool b = (a != null && count % modCount == 0);
       count++;
       return b;
 }