Adds tags to tokens passed as argument

 @param [Array<String>, String] tokens tokens to tag
 @return [Array<String>, String] array of part-of-speech tags or string with added part-of-speech tags
502181
def tag(tokens)
      !tokens.is_a?(Array) && !tokens.is_a?(String) &&
        raise(ArgumentError, 'tokens must be an instance of String or Array')

      j_instance.tag(tokens.to_java(:String))
    end
160041
def tag_add(self, *tags):
        
        return View({**self.spec, 'tag': list(set(self.tags) | set(tags))})
685822
Tag[] tags(String tagname) {
        ListBuffer<Tag> found = new ListBuffer<Tag>();
        String target = tagname;
        if (target.charAt(0) != '@') {
            target = "@" + target;
        }
        for (Tag tag : tagList) {
            if (tag.kind().equals(target)) {
                found.append(tag);
            }
        }
        return found.toArray(new Tag[found.length()]);
    }
190733
def set_tags(tags)
      return unless tags.is_a?(Hash)
      tags.each do |k,v|
        set_tag(k, v)
      end
      self
    end
1034568
def tag(*tag_or_tags)
      tag_or_tags.flatten!
      tag_or_tags = tag_or_tags.first if tag_or_tags.length == 1

      if tag_or_tags.is_a?(Array)
        tag_or_tags.each do |tag_name|
          tags[tag_name] = 1
        end
      elsif tag_or_tags.is_a?(Hash)
        tag_or_tags.each do |tag_name, tag_value|
          tags[tag_name] = tag_value
        end
      elsif tag_or_tags.is_a?(Symbol)
        tags[tag_or_tags] = 1
      end
    end
661470
public T withTags(String... tags) {
    for (int i = 0; i < tags.length; i += 2) {
      extraTags.add(new BasicTag(tags[i], tags[i + 1]));
    }
    return (T) this;
  }
724623
function Tokenizer(str, tags) {
            this.str = str;
            this.index = 0;
            this.len = str.length;
            this.lineno = 0;
            this.colno = 0;

            this.in_code = false;

            tags = tags || {};
            this.tags = {
                BLOCK_START: tags.blockStart || BLOCK_START,
                BLOCK_END: tags.blockEnd || BLOCK_END,
                VARIABLE_START: tags.variableStart || VARIABLE_START,
                VARIABLE_END: tags.variableEnd || VARIABLE_END,
                COMMENT_START: tags.commentStart || COMMENT_START,
                COMMENT_END: tags.commentEnd || COMMENT_END
            };
        }
200385
ArrayTagSet addAll(Tag[] ts, int tsLength) {
    if (tsLength == 0) {
      return this;
    } else if (length == 0) {
      Arrays.sort(ts, 0, tsLength, TAG_COMPARATOR);
      int len = dedup(ts, 0, ts, 0, tsLength);
      return new ArrayTagSet(toStringArray(ts, len));
    } else {
      String[] newTags = new String[(length + tsLength) * 2];
      Arrays.sort(ts, 0, tsLength, TAG_COMPARATOR);
      int newLength = merge(newTags, tags, length, ts, tsLength);
      return new ArrayTagSet(newTags, newLength);
    }
  }
1029742
public MetadataBuilder addTags(String tag, String... tags)
    {
        if (!StringUtils.isBlank(tag))
            this.tags.add(tag.trim());

        if (tags != null)
        {
            for (String t : tags)
            {
                if (!StringUtils.isBlank(t))
                    this.tags.add(t.trim());
            }
        }

        return this;
    }
1364217
function add_tags( $tags )
	{
		$params = array();
		if (is_array($tags) && !empty($tags)) {
			$params['tags'] = join(',', $tags);
		} else {
			$params['tags'] = $tags;
		}
		return $this->oauth->post( 'tags/create', $params);
	}
1318153
public final String[] getTokensWithMultiWords(final String[] tokens) {
    final Span[] multiWordSpans = multiWordsToSpans(tokens);
    final List<String> tokenList = new ArrayList<String>(Arrays.asList(tokens));
    int counter = 0;
    for (final Span mwSpan : multiWordSpans) {
      final int fromIndex = mwSpan.getStart() - counter;
      final int toIndex = mwSpan.getEnd() - counter;
      // System.err.println(fromIndex + " " + toIndex);
      // add to the counter the length of the sublist removed
      // to allow the fromIndex and toIndex to match wrt to the tokenList
      // indexes
      counter = counter + tokenList.subList(fromIndex, toIndex).size() - 1;
      // create the multiword joining the sublist
      final String multiWord = Joiner.on("#").join(
          tokenList.subList(fromIndex, toIndex));
      // remove the sublist containing the tokens to be replaced in the span
      tokenList.subList(fromIndex, toIndex).clear();
      // add the multiword containing the tokens in one Span
      tokenList.add(fromIndex, multiWord);
    }
    return tokenList.toArray(new String[tokenList.size()]);
  }
794171
def add_tags(self, tags):
        

        if isinstance(tags, (str, unicode)):
            tags = [tags]

        objs = object_session(self)
        tmps = [FeedTag(tag=t, feed=self) for t in tags]
        objs.add_all(tmps)
        objs.commit()
1315813
public T withTags(Map<String, String> tags) {
    for (Map.Entry<String, String> entry : tags.entrySet()) {
      extraTags.add(new BasicTag(entry.getKey(), entry.getValue()));
    }
    return (T) this;
  }
298336
def set_tags(
            self,
            tags=""):
        
        self.refresh
        tagList = []
        regex = re.compile(r'@[^@]*', re.S)
        matchList = regex.findall(tags)
        for m in matchList:
            tagList.append(m.strip().replace("@", ""))

        self.refresh
        oldContent = self.to_string(indentLevel=1)
        self.tags = tagList
        newContent = self.to_string(indentLevel=1)

        # ADD DIRECTLY TO CONTENT IF THE PROJECT IS BEING ADDED SPECIFICALLY TO
        # THIS OBJECT
        self.parent._update_document_tree(
            oldContent=oldContent,
            newContent=newContent
        )
        self.refresh
        return None
1298785
@SuppressWarnings("unchecked")
    public T addTags(List<String> tags) {
        if (this.tags_ == null) {
            tags_ = new ArrayList<>();
        }
        this.tags_.addAll(tags);
        return (T) this;
    }
512747
public CreateRobotResult withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }
455113
private void addTokens(final Token curToken, final List<Token> tokens) {
    if (curToken.tokenLength() != 0) {
      if (this.unTokenizable) {
        tokens.add(curToken);
      } else if (!this.unTokenizable) {
        if (!replacement.matcher(curToken.getTokenValue()).matches()) {
          tokens.add(curToken);
        }
      }
    }
  }